Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Combine e2e tests into a single multi stage workflow #1968

Merged
merged 3 commits into from
Aug 14, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
169 changes: 169 additions & 0 deletions .github/workflows/test-e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
name: Test Zarf Across Clusters
on:
pull_request:
paths-ignore:
- "**.md"
- "**.jpg"
- "**.png"
- "**.gif"
- "**.svg"
- "adr/**"
- "docs/**"
- "package.json"
- "package-lock.json"
- "CODEOWNERS"

permissions:
contents: read

# Abort prior jobs in the same workflow / PR
concurrency:
group: e2e-${{ github.ref }}
cancel-in-progress: true

jobs:
# Build the binary and init package
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3

- name: Setup golang
uses: ./.github/actions/golang

- name: Setup NodeJS
uses: ./.github/actions/node

- name: Build binary and zarf packages
uses: ./.github/actions/packages
with:
build-examples: 'false'
Racer159 marked this conversation as resolved.
Show resolved Hide resolved

# Upload the contents of the build directory for later stages to use
- name: Upload build artifacts
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: build-artifacts
path: build/
retention-days: 1

# Run the tests on k3d
validate-k3d:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3

- name: Download build artifacts
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: build-artifacts
path: build/

- name: Setup golang
uses: ./.github/actions/golang

- name: Setup K3d
uses: ./.github/actions/k3d

- name: Run tests
run: |
chmod +x build/zarf
make test-e2e ARCH=amd64

- name: Save logs
if: always()
uses: ./.github/actions/save-logs

# Run the tests on k3s
validate-k3s:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3

- name: Download build artifacts
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: build-artifacts
path: build/

- name: Setup golang
uses: ./.github/actions/golang

- name: "Run Tests"
Racer159 marked this conversation as resolved.
Show resolved Hide resolved
# NOTE: "PATH=$PATH" preserves the default user $PATH. This is needed to maintain the version of go installed
# in a previous step. This test run will use Zarf to create a K3s cluster, and a brand new cluster will be
# used for each test
# chown the logs since they were originally created as root
run: |
chmod +x build/zarf
sudo env "PATH=$PATH" CI=true APPLIANCE_MODE=true make test-e2e ARCH=amd64
sudo chown $USER /tmp/zarf-*.log

- name: Save logs
if: always()
uses: ./.github/actions/save-logs

# Run the tests on kind
validate-kind:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3

- name: Download build artifacts
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: build-artifacts
path: build/

- name: Setup golang
uses: ./.github/actions/golang

- name: Setup Kind
run: |
kind delete cluster && kind create cluster
kubectl scale deploy -n kube-system coredns --replicas=1

- name: Run tests
run: |
chmod +x build/zarf
make test-e2e ARCH=amd64

- name: Save logs
if: always()
uses: ./.github/actions/save-logs

# Run the tests on minikube
validate-minikube:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3

- name: Download build artifacts
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: build-artifacts
path: build/

- name: Setup golang
uses: ./.github/actions/golang

- name: Setup Minikube
run: minikube start --driver=docker

- name: Run tests
run: |
chmod +x build/zarf
make test-e2e ARCH=amd64

- name: Save logs
if: always()
uses: ./.github/actions/save-logs
48 changes: 0 additions & 48 deletions .github/workflows/test-k3d.yml

This file was deleted.

51 changes: 0 additions & 51 deletions .github/workflows/test-k3s.yml

This file was deleted.

50 changes: 0 additions & 50 deletions .github/workflows/test-kind.yml

This file was deleted.

48 changes: 0 additions & 48 deletions .github/workflows/test-minikube.yml

This file was deleted.