Skip to content

Check code quality #369

Check code quality

Check code quality #369

Workflow file for this run

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@12aca0a884f6137d619d6a8a09fcc3406ced5281 # v5.3.0
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@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.19
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 tests
run: |
make test
- name: Code coverage
run: |
make coverage
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
verbose: true
- name: Build Examples
run: |
make build-examples
- name: Check SSL Certificates
run: |
make test-ssl-certificates
- name: Run Tests Many Times
# Run test multiple times to check for flaky tests
if: github.ref_name == 'main'
run: |
make test-many-times COUNT=5