devops: fix k3s testing #856
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: CI | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
test: | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 60 | |
steps: | |
- name: Use Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- uses: actions/checkout@v3 | |
- name: Free Disk Space | |
uses: jlumbroso/free-disk-space@main | |
- name: Install k3s | |
run: | | |
curl -sfL https://get.k3s.io | K3S_KUBECONFIG_MODE=777 INSTALL_K3S_EXEC="server --docker --disable traefik --kubelet-arg=image-gc-high-threshold=85 --kubelet-arg=image-gc-low-threshold=80" sudo sh - | |
mkdir -p ~/.kube | |
sudo cp /etc/rancher/k3s/k3s.yaml ~/.kube/config | |
sudo chown $USER ~/.kube/config | |
- name: Install dependencies | |
run: npm ci | |
working-directory: e2e | |
# Do it before the browsers and dependencies get installed, because it takes long. | |
- name: Generate K8 files | |
run: | | |
version="$(bash .github/workflows/determine_docker_image_tag.sh)" | |
bash k8/generate.sh $version | |
env: | |
WORKER_COUNT: 1 | |
- name: Install Playwright browsers | |
run: npx playwright install --with-deps chromium | |
working-directory: e2e | |
- name: Setup tmate session | |
uses: mxschmitt/action-tmate@v3 | |
- name: Run e2e tests | |
working-directory: e2e | |
run: | | |
kubectl wait --timeout 10m --for=condition=ready pods --all | |
FRONTEND_PORT=$(kubectl get svc frontend -o=jsonpath='{.spec.ports[?(@.port==8080)].nodePort}') | |
FRONTEND_URL="http://127.0.0.1:$FRONTEND_PORT" | |
echo "Host: $FRONTEND_URL" | |
npx wait-on "$FRONTEND_URL/service/control/health" | |
kubectl wait --timeout 10m --for=condition=ready pod -l role=worker | |
ROOT_TEST_URL=$FRONTEND_URL npm run test | |
- name: Upload test-results | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: e2e-test-results | |
path: e2e/test-results/ |