Gazelle refactor #529
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
branches: [master] | |
env: | |
GOPROXY: https://proxy.golang.org | |
jobs: | |
pre-commit: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
submodules: "true" | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
- uses: actions/setup-go@v3 | |
- uses: bazelbuild/setup-bazelisk@v2 | |
- run: echo "PATH=$PATH:/home/runner/go/bin" >> $GITHUB_ENV | |
- uses: pre-commit/action@v3.0.0 | |
commit-check: | |
name: Commit checks | |
strategy: | |
matrix: | |
go: ["1.13"] | |
os: [ubuntu-latest] | |
python: ["3.x"] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Setup Go ${{ matrix.go }} | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ${{matrix.go}} | |
id: go | |
- name: Setup Python ${{ matrix.python }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
submodules: "true" | |
- name: Install python dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r .github/pip_requirements.txt | |
go-tests: | |
name: Go ${{ matrix.go }} tests ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
go: | |
[ | |
"1.11", | |
"1.12", | |
"1.13", | |
"1.14", | |
"1.15", | |
"1.16", | |
"1.17", | |
"1.18", | |
"1.19", | |
"1.20", | |
] | |
os: [ubuntu-latest] | |
include: | |
- go: "1.13" | |
os: macos-latest | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
submodules: "true" | |
- name: Setup Go ${{ matrix.go }} | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ${{matrix.go}} | |
id: go | |
- name: Install dependencies | |
run: go mod download | |
- name: Build | |
run: go build -v ./... | |
- name: Test | |
run: go test -v ./... | |
- name: Run go vet | |
run: go vet ./... | |
python-tests: | |
name: Python ${{ matrix.python }} tests ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
python: ["3.7", "3.8", "3.9"] | |
os: [ubuntu-latest] | |
include: | |
- python: "3.7" | |
os: macos-latest | |
- python: "3.6" | |
os: ubuntu-20.04 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Setup Python ${{ matrix.python }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Install python dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r .github/pip_requirements.txt | |
- name: config_system regression tests | |
run: config_system/tests/run_tests.py | |
- name: Mconfigfmt tests | |
run: config_system/tests/run_tests_formatter.py | |
- name: config_system pytest | |
run: pytest config_system | |
- name: scripts pytest | |
run: pytest scripts/env_hash.py | |
build-tests: | |
name: Test ${{ matrix.os }}, Go ${{ matrix.go }}, Python ${{ matrix.python }} | |
strategy: | |
fail-fast: false | |
matrix: | |
go: | |
[ | |
"1.11", | |
"1.12", | |
"1.13", | |
"1.14", | |
"1.15", | |
"1.16", | |
"1.17", | |
"1.18", | |
"1.19", | |
"1.20", | |
] | |
os: [ubuntu-latest] | |
python: ["3.x"] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Setup Go ${{ matrix.go }} | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ${{matrix.go}} | |
id: go | |
- name: Setup Python ${{ matrix.python }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Install tools | |
run: | | |
if [ "$RUNNER_OS" == "Linux" ] ; then | |
sudo apt-get install ninja-build rsync | |
elif [ "$RUNNER_OS" == "macOS" ] ; then | |
brew install ninja rsync | |
else | |
echo "$RUNNER_OS not supported" | |
exit 1 | |
fi | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
submodules: "true" | |
- name: Install python dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r .github/pip_requirements.txt | |
- name: Relative path tests | |
run: tests/relative_path_tests.sh | |
- name: Build tests | |
run: tests/build_tests.sh | |
- name: Test example project | |
run: .github/build_example_proj.sh | |
- name: Bootstrap version test | |
run: .github/run_bootstrap_test.sh | |
bazel: | |
name: "Bazel ${{matrix.bazel}} ${{ matrix.os }}" | |
env: | |
USE_BAZEL_VERSION: ${{ matrix.bazel }} | |
strategy: | |
fail-fast: false | |
matrix: | |
bazel: ["latest", "6.2.0", "6.0.0"] | |
os: [ubuntu-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
submodules: "true" | |
- uses: bazelbuild/setup-bazelisk@v2 | |
- name: Mount bazel cache # Optional | |
uses: actions/cache@v3 | |
with: | |
path: "~/.cache/bazel" | |
key: bazel-${{matrix.bazel}}-${{matrix.os}} | |
- name: Bazel test `bob` | |
run: bazel test --config=ci //... | |
- name: Bazel test `bob-gazelle` | |
run: bazel test --config=ci //... | |
working-directory: ./gazelle | |
- name: Bazel test `bob-gazelle integration tests` | |
run: | | |
bazel run @gazelle//:gazelle --config=ci | |
if [[ `git diff` ]]; then | |
exit 1 | |
fi | |
bazel build //... | |
working-directory: ./gazelle/tests/integration_tests | |
bazel-coverage: | |
name: "Bazel Coverage" | |
env: | |
USE_BAZEL_VERSION: latest | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
submodules: "true" | |
- uses: bazelbuild/setup-bazelisk@v2 | |
- name: Mount bazel cache | |
uses: actions/cache@v3 | |
with: | |
path: "~/.cache/bazel" | |
key: bazel-coverage | |
- name: Setup LCOV | |
uses: hrishikesh-kadam/setup-lcov@v1 | |
- name: Generate Coverage | |
run: | | |
bazel coverage --config=ci --instrument_test_targets --@io_bazel_rules_go//go/config:cover_format=lcov --combined_report=lcov //... | |
cp "$(bazelisk info output_path)/_coverage/_coverage_report.dat" coverage_report.dat | |
- name: Report code coverage | |
uses: zgosalvez/github-actions-report-lcov@v3 | |
with: | |
coverage-files: coverage_report.dat | |
artifact-name: code-coverage-report | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
update-comment: true |