Scone svidstore plugin v1 #140
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: {} | |
env: | |
GO_VERSION: 1.17.7 | |
jobs: | |
cache-deps: | |
name: cache-deps (linux) | |
runs-on: ubuntu-18.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Setup dep cache | |
uses: actions/cache@v2 | |
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-18.04 | |
needs: cache-deps | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Load cached deps | |
uses: actions/cache@v2 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
- name: Setup build tool cache | |
uses: actions/cache@v2 | |
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 | |
- name: Generate check | |
run: make generate-check | |
- name: Shell check | |
run: shellcheck .github/workflows/scripts/*.sh | |
unit-test: | |
strategy: | |
matrix: | |
OS: [ubuntu-18.04, macos-latest] | |
runs-on: ${{ matrix.OS }} | |
needs: cache-deps | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Load cached deps | |
uses: actions/cache@v2 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
- name: Run unit tests | |
run: ./.github/workflows/scripts/run_unit_tests.sh | |
artifacts: | |
name: artifacts (linux) | |
runs-on: ubuntu-18.04 | |
needs: [cache-deps] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Load cached deps | |
uses: actions/cache@v2 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
- name: Load cached build tools | |
uses: actions/cache@v2 | |
with: | |
path: .build | |
key: ${{ runner.os }}-tools-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-tools- | |
- name: Build artifacts | |
run: ./.github/workflows/scripts/build_artifacts.sh | |
- name: Archive artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: binaries | |
path: ./artifacts/ | |
images: | |
runs-on: ubuntu-18.04 | |
needs: [cache-deps] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Load cached deps | |
uses: actions/cache@v2 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
- name: Load cached build tools | |
uses: actions/cache@v2 | |
with: | |
path: .build | |
key: ${{ runner.os }}-tools-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-tools- | |
- name: Build images | |
run: make images | |
- name: Export images | |
run: docker save spire-server:latest-local spire-agent:latest-local k8s-workload-registrar:latest-local oidc-discovery-provider:latest-local | gzip > images.tar.gz | |
- name: Archive images | |
uses: actions/upload-artifact@v2 | |
with: | |
name: images | |
path: images.tar.gz | |
scratch-images: | |
runs-on: ubuntu-18.04 | |
needs: [cache-deps] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Load cached deps | |
uses: actions/cache@v2 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
- name: Load cached build tools | |
uses: actions/cache@v2 | |
with: | |
path: .build | |
key: ${{ runner.os }}-tools-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-tools- | |
- name: Build scratch images | |
run: make scratch-images | |
- name: Export scratch images | |
run: docker save spire-server-scratch:latest-local spire-agent-scratch:latest-local k8s-workload-registrar-scratch:latest-local oidc-discovery-provider-scratch:latest-local | gzip > scratch-images.tar.gz | |
- name: Archive scratch images | |
uses: actions/upload-artifact@v2 | |
with: | |
name: scratch-images | |
path: scratch-images.tar.gz | |
integration: | |
runs-on: ubuntu-18.04 | |
needs: [cache-deps, images, scratch-images] | |
strategy: | |
fail-fast: false | |
matrix: | |
num_runners: [5] | |
runner_id: [1, 2, 3, 4, 5] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
# The "upgrade" integration test needs the history to ensure | |
# that the version number in the source code has been bumped as | |
# expected. This action does not fetch tags unless we supply a | |
# fetch depth of zero. | |
fetch-depth: 0 | |
- name: Setup go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Load cached deps | |
uses: actions/cache@v2 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
- name: Load cached build tools | |
uses: actions/cache@v2 | |
with: | |
path: .build | |
key: ${{ runner.os }}-tools-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-tools- | |
- name: Download archived images | |
uses: actions/download-artifact@v2 | |
with: | |
name: images | |
path: . | |
- name: Download archived scratch images | |
uses: actions/download-artifact@v2 | |
with: | |
name: scratch-images | |
path: . | |
- name: Load archived images | |
run: zcat images.tar.gz | docker load | |
- name: Load archived scratch images | |
run: zcat scratch-images.tar.gz | docker load | |
- name: Run integration tests | |
env: | |
NUM_RUNNERS: ${{ matrix.num_runners }} | |
THIS_RUNNER: ${{ matrix.runner_id }} | |
TERM: dumb | |
CICD_TARGET_BRANCH: ${{ github.event.pull_request.base.ref }} | |
run: ./.github/workflows/scripts/split.sh | xargs ./test/integration/test.sh | |
cache-deps-windows: | |
name: cache-deps (windows) | |
runs-on: windows-2022 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Setup dep cache | |
uses: actions/cache@v2 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
- name: Pull go deps | |
run: go mod download | |
lint-windows: | |
name: lint (windows) | |
runs-on: windows-2022 | |
needs: cache-deps-windows | |
defaults: | |
run: | |
shell: msys2 {0} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Load cached deps | |
uses: actions/cache@v2 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
- name: Setup build tool cache | |
uses: actions/cache@v2 | |
with: | |
path: .build | |
key: ${{ runner.os }}-tools-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-tools- | |
- name: Install msys2 | |
uses: msys2/setup-msys2@v2 | |
with: | |
msystem: MINGW64 | |
update: true | |
install: >- | |
git | |
base-devel | |
mingw-w64-x86_64-toolchain | |
unzip | |
- name: Lint | |
run: make lint | |
- name: Tidy check | |
run: make tidy-check | |
- name: Generate check | |
run: make generate-check | |
unit-test-windows: | |
name: unit-test (windows) | |
runs-on: windows-2022 | |
needs: cache-deps-windows | |
defaults: | |
run: | |
shell: msys2 {0} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Load cached deps | |
uses: actions/cache@v2 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
- name: Install msys2 | |
uses: msys2/setup-msys2@v2 | |
with: | |
msystem: MINGW64 | |
update: true | |
install: >- | |
git | |
base-devel | |
mingw-w64-x86_64-toolchain | |
unzip | |
- name: Run unit tests | |
run: ./.github/workflows/scripts/run_unit_tests.sh | |
artifact-windows: | |
name: artifact (windows) | |
runs-on: windows-2022 | |
needs: cache-deps-windows | |
defaults: | |
run: | |
shell: msys2 {0} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Load cached deps | |
uses: actions/cache@v2 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
- name: Load cached build tools | |
uses: actions/cache@v2 | |
with: | |
path: .build | |
key: ${{ runner.os }}-tools-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-tools- | |
- name: Install msys2 | |
uses: msys2/setup-msys2@v2 | |
with: | |
msystem: MINGW64 | |
update: true | |
install: >- | |
git | |
base-devel | |
mingw-w64-x86_64-toolchain | |
unzip | |
- name: Build artifacts | |
run: ./.github/workflows/scripts/build_artifacts.sh | |
- name: Archive artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: binaries | |
path: ./artifacts/ |