chore: robust e2e test to run on prs #12
Workflow file for this run
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 Test | |
permissions: read-all | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
jobs: | |
e2e: | |
name: e2e | |
runs-on: ubuntu-latest | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 | |
with: | |
egress-policy: audit | |
- name: clone kfc | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
repository: defenseunicorns/kubernetes-fluent-client | |
path: kubernetes-fluent-client | |
- name: "set env: KFC" | |
run: echo "KFC=${GITHUB_WORKSPACE}/kubernetes-fluent-client" >> "$GITHUB_ENV" | |
- name: setup node | |
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 | |
with: | |
node-version: 20 | |
cache: "npm" | |
cache-dependency-path: kubernetes-fluent-client | |
- name: install kubernetes-fluent-client deps | |
run: | | |
cd "$KFC" | |
npm ci | |
shell: bash | |
- name: "install k3d" | |
run: "curl -s https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | bash" | |
shell: bash | |
- name: Set up Kubernetes | |
uses: azure/setup-kubectl@3e0aec4d80787158d308d7b364cb1b702e7feb7f # v4.0.0 | |
with: | |
version: "latest" | |
- name: "create k3d cluster" | |
run: "k3d cluster create kfc-dev --k3s-arg '--debug@server:0' --wait && kubectl rollout status deployment -n kube-system" | |
shell: bash | |
- name: Prepare CRDs and Generate Classes | |
run: | | |
cd "$KFC" | |
kubectl apply -f test/ && npx ts-node src/cli.ts crd ./test/datastore.crd.yaml e2e && npx ts-node src/cli.ts crd https://raw.githubusercontent.com/defenseunicorns/kubernetes-fluent-client/refs/heads/471/test/webapp.crd.yaml e2e | |
shell: bash | |
- name: Prepare Image | |
run: | | |
cd "$KFC" | |
npm pack && npm i kubernetes-fluent-client-0.0.0-development.tgz --no-save | |
shell: bash | |
- name: Run the e2es | |
run: | | |
cd "$KFC" | |
npm run test:e2e | |
shell: bash |