Use go.mod go version in integration test Dockerfiles #488
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: PR Build | |
on: | |
pull_request: {} | |
workflow_dispatch: {} | |
permissions: | |
contents: read | |
jobs: | |
cache-deps: | |
name: cache-deps (linux) | |
runs-on: ubuntu-22.04 | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: 'go.mod' | |
- name: Setup dep cache | |
uses: actions/cache@v4 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
- name: Pull go deps | |
run: go mod download | |
lint: | |
name: lint (linux) | |
runs-on: ubuntu-22.04 | |
needs: cache-deps | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: 'go.mod' | |
- name: Load cached deps | |
uses: actions/cache@v4 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
- name: Setup build tool cache | |
uses: actions/cache@v4 | |
with: | |
path: .build | |
key: ${{ runner.os }}-tools-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-tools- | |
- name: Lint | |
run: make lint | |
- name: Tidy check | |
run: make tidy-check | |
unit-test: | |
strategy: | |
matrix: | |
OS: [ubuntu-22.04, macos-latest] | |
runs-on: ${{ matrix.OS }} | |
needs: cache-deps | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: 'go.mod' | |
- name: Load cached deps | |
uses: actions/cache@v4 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
- name: Run unit tests | |
run: make test | |
- name: Run clean check | |
run: make git-clean-check | |
build-matrix: | |
name: Build matrix | |
runs-on: ubuntu-22.04 | |
needs: [lint] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- id: set-matrix | |
name: Collect all tests | |
run: | | |
tests="$(find .github/tests -maxdepth 1 -type f -name '*.sh' -exec basename {} \; | sort | uniq)" | |
tests_json="$(echo "$tests" | jq -c --slurp --raw-input 'split("\n") | map(select(. != ""))')" | |
echo "tests=$tests_json" >> $GITHUB_OUTPUT | |
echo "Collected tests: $tests_json" | |
outputs: | |
tests: ${{ steps.set-matrix.outputs.tests }} | |
integration-tests: | |
runs-on: ubuntu-22.04 | |
needs: [build-matrix] | |
permissions: | |
contents: read | |
strategy: | |
matrix: | |
tests: ${{ fromJson(needs.build-matrix.outputs.tests) }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: 'go.mod' | |
- name: Build containers | |
run: ./build.sh | |
shell: bash | |
working-directory: ./.github/tests/it | |
- name: Run tests | |
run: bash ${{ matrix.tests }} | |
shell: bash | |
working-directory: ./.github/tests | |
build: | |
name: build (linux) | |
runs-on: ubuntu-22.04 | |
needs: cache-deps | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: 'go.mod' | |
- name: Load cached deps | |
uses: actions/cache@v4 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
- name: Setup build tool cache | |
uses: actions/cache@v4 | |
with: | |
path: .build | |
key: ${{ runner.os }}-tools-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-tools- | |
- name: Build images | |
run: make build | |
- name: Archive image | |
uses: actions/upload-artifact@v4 | |
with: | |
name: spiffe-helper | |
path: spiffe-helper | |
build-images: | |
runs-on: ubuntu-22.04 | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: 'go.mod' | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build image | |
run: make docker-build |