feat: integrate playwright in pipeline #4
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: ["master", "rc/**"] | |
pull_request: | |
branches: ["master", "rc/**"] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
backend-build-test: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: 1.65.0 | |
components: clippy, rustfmt | |
- uses: Swatinem/rust-cache@v2 | |
- name: Toolchain info | |
run: | | |
cargo --version --verbose | |
rustc --version | |
cargo clippy --version | |
- name: Lint | |
run: | | |
cd dcapal-backend | |
cargo fmt -- --check | |
cargo clippy -- -D warnings | |
- name: Build and Test | |
run: | | |
cd dcapal-backend | |
RUST_LOG=dcapal-backend=debug cargo test -- --nocapture | |
optimizer-build-test: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
components: clippy, rustfmt | |
- uses: Swatinem/rust-cache@v2 | |
- name: Install wasm-pack | |
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh | |
- name: Toolchain info | |
run: | | |
cargo --version --verbose | |
rustc --version | |
cargo clippy --version | |
- name: Lint | |
run: | | |
cd dcapal-optimizer-wasm | |
cargo fmt -- --check | |
cargo clippy -- -D warnings | |
- name: Test | |
run: | | |
cd dcapal-optimizer-wasm | |
RUST_LOG=info cargo test -- --nocapture | |
wasm-pack test --headless --chrome | |
- name: Build | |
run: | | |
cd dcapal-optimizer-wasm | |
wasm-pack build | |
- name: Archive dcapal-optimizer-wasm pkg | |
uses: actions/upload-artifact@v3 | |
with: | |
name: dcapal-optimizer-wasm-pkg | |
path: dcapal-optimizer-wasm/pkg | |
frontend-check: | |
runs-on: ubuntu-22.04 | |
needs: optimizer-build-test | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
cache: "npm" | |
cache-dependency-path: dcapal-frontend/package-lock.json | |
- name: Check formatting | |
run: | | |
cd dcapal-frontend | |
npm ci | |
npm run check | |
frontend-build-test: | |
runs-on: ubuntu-22.04 | |
needs: [frontend-check, optimizer-build-test] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
cache: "npm" | |
cache-dependency-path: dcapal-frontend/package-lock.json | |
- name: Download dcapal-optimizer-wasm pkg | |
uses: actions/download-artifact@v3 | |
with: | |
name: dcapal-optimizer-wasm-pkg | |
path: dcapal-optimizer-wasm/pkg | |
- name: Install dependencies | |
run: | | |
cd dcapal-frontend | |
npm ci | |
- name: Build | |
run: | | |
cd dcapal-frontend | |
npm run build | |
frontend-e2e-tests: | |
timeout-minutes: 60 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 19 | |
- name: Install dependencies | |
run: npm ci | |
- name: Install Playwright Browsers | |
run: npx playwright install --with-deps | |
- name: Run Playwright tests | |
run: npx playwright test | |
- uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: playwright-report | |
path: playwright-report/ | |
retention-days: 30 |