Skip to content

Allow multiple JWT tokens to be configured (closes #108) #222

Allow multiple JWT tokens to be configured (closes #108)

Allow multiple JWT tokens to be configured (closes #108) #222

Workflow file for this run

name: PR Build
on:
pull_request: {}
workflow_dispatch: {}
env:
GO_VERSION: 1.21.5
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: ${{ env.GO_VERSION }}
- name: Setup dep cache
uses: actions/cache@v3
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: ${{ env.GO_VERSION }}
- name: Load cached deps
uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
- name: Setup build tool cache
uses: actions/cache@v3
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: ${{ env.GO_VERSION }}
- name: Load cached deps
uses: actions/cache@v3
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:
- uses: actions/checkout@v4
- 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: ${{ env.GO_VERSION }}
- name: Load cached deps
uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
- name: Setup build tool cache
uses: actions/cache@v3
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