Check code quality #1100
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: Check code quality | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
schedule: | |
- cron: '0 4 * * *' | |
permissions: | |
actions: write # Needed for skip-duplicate-jobs job | |
contents: read | |
jobs: | |
# Special job which automatically cancels old runs for the same branch, prevents runs for the | |
# same file set which has already passed, etc. | |
pre_job: | |
name: Skip Duplicate Jobs Pre Job | |
runs-on: ubuntu-latest | |
outputs: | |
should_skip: ${{ steps.skip_check.outputs.should_skip }} | |
steps: | |
- id: skip_check | |
uses: fkirc/skip-duplicate-actions@f75f66ce1886f00957d99748a42c724f4330bdcf # v5.3.1 | |
with: | |
cancel_others: 'true' | |
github_token: ${{ github.token }} | |
build: | |
runs-on: ubuntu-latest | |
needs: pre_job | |
if: ${{ needs.pre_job.outputs.should_skip != 'true' || github.ref_name == 'main' }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.11 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.21' | |
cache: true | |
cache-dependency-path: | | |
go.sum | |
examples/**/go.sum | |
- name: Install pre-commit | |
run: | | |
python -m pip install -U pip | |
python -m pip install pre-commit | |
- name: Install pre-commit hooks | |
run: | | |
pre-commit install | |
- name: Install Go tools | |
run: | | |
./scripts/install-dev-tools.sh | |
- name: Run go mod vendor | |
run: | | |
go mod vendor | |
- name: Run pre-commit | |
run: | | |
pre-commit run -a | |
- name: Code coverage | |
timeout-minutes: 15 | |
run: | | |
make coverage | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
fail_ci_if_error: true | |
verbose: true | |
- name: Build Examples | |
run: | | |
make build-examples | |
- name: Check SSL Certificates | |
timeout-minutes: 10 | |
run: | | |
make test-ssl-certificates |