Use globset to specify src for nix-snapshotter #604
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: [ main ] | |
pull_request: | |
types: [ opened, reopened, labeled, synchronize ] | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
linter: | |
- golangci-lint | |
steps: | |
- uses: actions/checkout@v4 | |
# - name: Setup Nix | |
# uses: ./.github/actions/setup-nix | |
# - name: Run linter | |
# run: nix run .#lint-${{ matrix.linter }} | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
package: | |
- nix-snapshotter | |
- image-hello | |
- image-redis | |
- image-redisWithShell | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Nix | |
uses: ./.github/actions/setup-nix | |
- name: Build package | |
run: nix build .#${{ matrix.package }} | |
integration-test: | |
runs-on: nix-snapshotter-runner | |
strategy: | |
matrix: | |
test: | |
- snapshotter | |
- push-n-pull | |
- kubernetes | |
- k3s | |
- k3s-external | |
- k3s-rootless | |
- gvisor | |
needs: [lint, build] | |
if: contains(github.event.pull_request.labels.*.name, 'ok-to-test') | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Nix | |
uses: ./.github/actions/setup-nix | |
with: | |
enable-kvm: true | |
- name: Build snapshotter | |
run: nix build | |
- name: Run integration tests | |
run: nix run -L .#test-${{ matrix.test }} | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.test }}_build | |
path: build | |
if-no-files-found: ignore | |
retention-days: 1 | |
coverage-report: | |
runs-on: ubuntu-latest | |
needs: [integration-test] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
path: build | |
merge-multiple: true | |
- uses: actions/setup-go@v4 | |
with: { go-version: '1.20' } | |
- name: Collect test coverage | |
run: | | |
mkdir -p "$PWD/build/go-cover/unit" | |
go test -cover ./... -args -test.gocoverdir="$PWD/build/go-cover/unit" | |
go tool covdata textfmt -i=`find ./build/go-cover -mindepth 1 -type d | paste -sd ","` -o ./build/go-cover/profile | |
echo "# Coverage report" >> $GITHUB_STEP_SUMMARY | |
echo '```' >> $GITHUB_STEP_SUMMARY | |
go tool cover -func ./build/go-cover/profile >> $GITHUB_STEP_SUMMARY | |
echo '```' >> $GITHUB_STEP_SUMMARY |