ci(github): 👷 refactor for potential multi-arch t… #420
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: Test | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
permissions: | |
contents: read | |
env: | |
GO_VERSION: 1.22 | |
ARCH: amd64 | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@a4aa98b93cab29d9b1101a6143fb8bce00e2eac4 # v1 | |
with: | |
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs | |
- name: Checkout | |
id: checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up environment | |
run: | | |
echo "BUILD_ENV=build/env.$ARCH" >> $GITHUB_ENV | |
- name: Install build dependencies | |
id: install_packages | |
run: build/scripts/install-deps | |
- name: Set up Go | |
id: setup_go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Install Mage | |
uses: magefile/mage-action@v3 | |
with: | |
install-only: true | |
- name: Run tests | |
run: mage -d build/magefiles -w . tests:test | |
continue-on-error: true | |
- name: Upload Coverage | |
id: upload_coverage | |
uses: codecov/codecov-action@v4 | |
continue-on-error: true | |
with: | |
token: ${{secrets.CODECOV_TOKEN}} | |
file: ./coverage.txt | |
fail_ci_if_error: false | |
golangci: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: read # Use with `only-new-issues` option. | |
steps: | |
- uses: step-security/harden-runner@a4aa98b93cab29d9b1101a6143fb8bce00e2eac4 # v2.7.1 | |
with: | |
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs | |
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | |
- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
cache: false # golangci-lint maintains its own cache | |
- name: Set up environment | |
run: | | |
echo "BUILD_ENV=build/env.$ARCH" >> $GITHUB_ENV | |
- name: Install build dependencies | |
id: install_packages | |
run: build/scripts/install-deps | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@a4f60bb28d35aeee14e6880718e0c85ff1882e64 # v6.0.1 | |
with: | |
only-new-issues: true | |
github-token: ${{ secrets.GITHUB_TOKEN }} |