E2E - Pepr Excellent Examples #223
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: E2E - Pepr Excellent Examples | |
permissions: read-all | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 4 * * *' # 12AM EST/9PM PST | |
# refs | |
# https://frontside.com/blog/2022-12-12-dynamic-github-action-jobs/ | |
# https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ | |
jobs: | |
pepr-build: | |
name: controller image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 | |
with: | |
egress-policy: audit | |
- name: clone pepr | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
with: | |
repository: defenseunicorns/pepr | |
path: pepr | |
- name: "set env: PEPR" | |
run: echo "PEPR=${GITHUB_WORKSPACE}/pepr" >> "$GITHUB_ENV" | |
- name: setup node | |
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 | |
with: | |
node-version: 20 | |
cache: "npm" | |
cache-dependency-path: pepr | |
- name: install pepr deps | |
run: | | |
cd "$PEPR" | |
npm ci | |
- name: build pepr image | |
run: | | |
cd "$PEPR" | |
npm run build:image | |
- name: tar pepr image | |
run: | | |
PEPR_TAR="${GITHUB_WORKSPACE}/pepr-img.tar" | |
echo "PEPR_TAR=${PEPR_TAR}" >> "$GITHUB_ENV" | |
docker image save --output "$PEPR_TAR" pepr:dev | |
- name: upload image tar artifact | |
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 | |
with: | |
name: pepr-img.tar | |
path: pepr-img.tar | |
retention-days: 1 | |
examples-matrix: | |
name: job matrix | |
runs-on: ubuntu-latest | |
needs: | |
- pepr-build | |
outputs: | |
matrix: ${{ steps.create-matrix.outputs.matrix }} | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 | |
with: | |
egress-policy: audit | |
- name: clone pepr | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
with: | |
repository: defenseunicorns/pepr | |
path: pepr | |
- name: "set env: PEPR" | |
run: echo "PEPR=${GITHUB_WORKSPACE}/pepr" >> "$GITHUB_ENV" | |
- name: clone pepr-excellent-examples | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
with: | |
repository: defenseunicorns/pepr-excellent-examples | |
path: pepr-excellent-examples | |
- name: "set env: PEXEX" | |
run: echo "PEXEX=${GITHUB_WORKSPACE}/pepr-excellent-examples" >> "$GITHUB_ENV" | |
- name: setup node | |
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 | |
with: | |
node-version: 20 | |
cache: "npm" | |
cache-dependency-path: pepr | |
- name: create matrix | |
run: | | |
matrix=$( | |
node "$PEPR/.github/workflows/pepr-excellent-examples-matrix.js" "$PEXEX" | |
) | |
echo "matrix=${matrix}" >> "$GITHUB_OUTPUT" | |
id: create-matrix | |
excellent-examples: | |
name: ${{ matrix.name }} | |
runs-on: ubuntu-latest | |
needs: | |
- examples-matrix | |
if: needs.examples-matrix.outputs.matrix != '' | |
strategy: | |
fail-fast: false | |
max-parallel: 5 | |
matrix: ${{ fromJSON(needs.examples-matrix.outputs.matrix) }} | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 | |
with: | |
egress-policy: audit | |
- name: "install k3d" | |
run: "curl -s https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | bash" | |
shell: bash | |
- name: dowload image tar artifact | |
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | |
with: | |
name: pepr-img.tar | |
path: ${{ github.workspace }} | |
- name: import pepr image from tar | |
run: | | |
PEPR_TAR="${GITHUB_WORKSPACE}/pepr-img.tar" | |
echo "PEPR_TAR=${PEPR_TAR}" >> "$GITHUB_ENV" | |
docker image load --input "$PEPR_TAR" | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
with: | |
repository: defenseunicorns/pepr-excellent-examples | |
path: pepr-excellent-examples | |
- name: "set env: PEXEX" | |
run: echo "PEXEX=${GITHUB_WORKSPACE}/pepr-excellent-examples" >> "$GITHUB_ENV" | |
- name: setup node | |
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 | |
with: | |
node-version: 20 | |
cache: "npm" | |
cache-dependency-path: pepr-excellent-examples | |
- name: install pepr-excellent-examples deps | |
run: | | |
cd "$PEXEX" | |
npm ci | |
- name: run e2e tests | |
run: | | |
cd "$PEXEX" | |
npm run --workspace=${{ matrix.name }} test:e2e -- --image pepr:dev |