Merge pull request #51 from bank-vaults/dependabot/go_modules/github.… #112
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: | |
permissions: | |
contents: read | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | |
- name: Set up Nix | |
uses: cachix/install-nix-action@6ed004b9ccb68dbc28e7c85bee15fa93dbd214ac # v22 | |
with: | |
extra_nix_config: | | |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} | |
- name: Prepare Nix shell | |
run: nix develop --impure .#ci | |
- name: Build | |
run: nix develop --impure .#ci -c make build | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
vault_version: ["1.10.11", "1.11.11", "1.12.7", "1.13.3"] | |
services: | |
vault: | |
image: vault:${{ matrix.vault_version }} | |
env: | |
SKIP_SETCAP: true | |
VAULT_DEV_ROOT_TOKEN_ID: 227e1cce-6bf7-30bb-2d2a-acc854318caf | |
ports: | |
- 8200:8200 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | |
- name: Set up Nix | |
uses: cachix/install-nix-action@6ed004b9ccb68dbc28e7c85bee15fa93dbd214ac # v22 | |
with: | |
extra_nix_config: | | |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} | |
- name: Prepare Nix shell | |
run: nix develop --impure .#ci | |
- name: Test | |
run: nix develop --impure .#ci -c make test | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | |
- name: Set up Nix | |
uses: cachix/install-nix-action@6ed004b9ccb68dbc28e7c85bee15fa93dbd214ac # v22 | |
with: | |
extra_nix_config: | | |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} | |
- name: Prepare Nix shell | |
run: nix develop --impure .#ci | |
- name: Lint | |
run: nix develop --impure .#ci -c make lint -j | |
license-check: | |
name: License check | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | |
- name: Set up Nix | |
uses: cachix/install-nix-action@6ed004b9ccb68dbc28e7c85bee15fa93dbd214ac # v22 | |
with: | |
extra_nix_config: | | |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} | |
- name: Cache license information | |
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 | |
with: | |
path: .licensei.cache | |
key: licensei-v1-${{ github.ref_name }}-${{ hashFiles('go.sum') }} | |
restore-keys: | | |
licensei-v1-${{ github.ref_name }} | |
licensei-v1-main | |
licensei-v1 | |
- name: Prepare Nix shell | |
run: nix develop --impure .#ci | |
- name: Populate license cache | |
run: nix develop --impure .#ci -c licensei cache | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Check licenses | |
run: nix develop --impure .#ci -c make license-check | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
dev: | |
name: Developer environment | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | |
- name: Set up Nix | |
uses: cachix/install-nix-action@6ed004b9ccb68dbc28e7c85bee15fa93dbd214ac # v22 | |
with: | |
extra_nix_config: | | |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} | |
- name: Check | |
run: nix flake check --impure | |
- name: Dev shell | |
run: nix develop --impure | |
artifacts: | |
name: Artifacts | |
uses: ./.github/workflows/artifacts.yaml | |
with: | |
publish: ${{ github.event_name == 'push' }} | |
permissions: | |
contents: read | |
packages: write | |
id-token: write | |
security-events: write | |
dependency-review: | |
name: Dependency review | |
runs-on: ubuntu-latest | |
if: github.event_name == 'pull_request' | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | |
- name: Dependency Review | |
uses: actions/dependency-review-action@1360a344ccb0ab6e9475edef90ad2f46bf8003b1 # v3.0.6 | |
e2e-test: | |
name: E2E test | |
runs-on: ubuntu-latest | |
needs: [artifacts] | |
strategy: | |
matrix: | |
k8s_version: ["v1.24.15", "v1.25.11", "v1.26.6", "v1.27.3"] | |
# vault_version: ["1.10.11", "1.11.11", "1.12.7", "1.13.3"] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | |
- name: Set up Nix | |
uses: cachix/install-nix-action@6ed004b9ccb68dbc28e7c85bee15fa93dbd214ac # v22 | |
with: | |
extra_nix_config: | | |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} | |
- name: Prepare Nix shell | |
run: nix develop --impure .#ci | |
- name: Download docker image | |
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | |
with: | |
name: "[container-image] Docker tarball" | |
- name: Download helm chart | |
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | |
with: | |
name: "[helm-chart] package" | |
- name: Test | |
run: nix develop --impure .#ci -c make test-e2e | |
env: | |
KIND_K8S_VERSION: ${{ matrix.k8s_version }} | |
LOAD_IMAGE_ARCHIVE: ${{ github.workspace }}/docker.tar | |
# VAULT_VERSION: ${{ matrix.vault_version }} | |
WEBHOOK_VERSION: ${{ needs.artifacts.outputs.container-image-tag }} | |
HELM_CHART: "${{ github.workspace }}/${{ needs.artifacts.outputs.helm-chart-package }}" | |
LOG_VERBOSE: "true" |