Skip to content

feat: Replace quickstart.sh with native Rust CLI (#24) #66

feat: Replace quickstart.sh with native Rust CLI (#24)

feat: Replace quickstart.sh with native Rust CLI (#24) #66

Workflow file for this run

name: ci
on:
push:
branches: [ main, refactoring ]
pull_request:
branches: [ main ]
workflow_dispatch:
inputs:
run_e2e:
description: 'Run end-to-end tests?'
required: false
default: 'true'
permissions:
contents: read
jobs:
test:
name: Test and Build cr8s-fe
runs-on: ubuntu-latest
timeout-minutes: 15
env:
CI: true
steps:
- name: ⬇️ Checkout repository
uses: actions/checkout@v4
- name: 🐳 Log in to GitHub Container Registry
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Build quickstart cli binary
env:
CR8S_SCRATCH_DIR: ${{ runner.temp }}/cr8s-scratch
run: |
docker run --rm -u root -v "$PWD:$PWD" \
-v "${CR8S_SCRATCH_DIR}/dev-target/dev-target:/app/target" \
-v "${CR8S_SCRATCH_DIR}/dev-cargo/dev-cargo:/usr/local/cargo/registry" \
-w "$PWD" ghcr.io/johnbasrai/cr8s/rust-dev:1.83.0-rev5 \
cargo build --release -p quickstart
- name: 🚀 Run quickstart with full lint checks
env:
CR8S_SCRATCH_DIR: ${{ runner.temp }}/cr8s-scratch
run: target/release/quickstart start --lint full
- name: 🧰 Set up Node.js for Playwright
if: github.event.inputs.run_e2e == 'true' || github.event_name != 'workflow_dispatch'
uses: actions/setup-node@v4
with:
node-version: '20'
- name: 📦 Install NPM dependencies
if: github.event.inputs.run_e2e == 'true' || github.event_name != 'workflow_dispatch'
run: npm install
- name: 🎭 Install Playwright browsers
if: github.event.inputs.run_e2e == 'true' || github.event_name != 'workflow_dispatch'
run: npx playwright install --with-deps
- name: 🚀 Run quickstart to wait for fronend ready before running tests
env:
CR8S_SCRATCH_DIR: ${{ runner.temp }}/cr8s-scratch
run: target/release/quickstart --wait
- name: ✅ Run login Playwright test
if: github.event.inputs.run_e2e == 'true' || github.event_name != 'workflow_dispatch'
run: npx playwright test tests/playwright/login.spec.ts
- name: 🧪 Run rustaceans Playwright test
run: npx playwright test tests/playwright/rustaceans.spec.ts
- name: "🧪 SKIPPED: crates Playwright test (see cr8s-fe issue 35)"
run: echo 'crates.spec.ts skipped due to known issue (cr8s-fe#35)'
- name: 🚀 Stop all containers and clean up
env:
CR8S_SCRATCH_DIR: ${{ runner.temp }}/cr8s-scratch
run: target/release/quickstart --shutdown
- name: 📋 Upload test results on failure
uses: actions/upload-artifact@v4
if: failure()
with:
name: playwright-report
path: playwright-report/
- name: 🛑 Cleanup services
if: always()
run: |
echo "🛑 Shutting down services..."
docker compose down -v || true