hub-site/.forgejo/workflows/test.yml
mrrpnya 256a5a684a
Some checks failed
Run Tests / Prepare environment (push) Successful in 4m52s
Run Tests / Run unit tests (push) Successful in 2m50s
Run Tests / Run E2E tests (chrome) (push) Failing after 5m58s
Run Tests / Run E2E tests (firefox) (push) Failing after 5m2s
Run Tests / Run E2E tests (edge) (push) Failing after 11m16s
Run Tests / Run unit tests (pull_request) Has been cancelled
Run Tests / Run E2E tests (chrome) (pull_request) Has been cancelled
Run Tests / Run E2E tests (edge) (pull_request) Has been cancelled
Run Tests / Run E2E tests (firefox) (pull_request) Has been cancelled
Run Tests / Prepare environment (pull_request) Has been cancelled
.
2025-03-06 12:44:07 -08:00

128 lines
3.3 KiB
YAML

name: Run Tests
on:
push:
branches:
- '*'
pull_request:
branches:
- '*'
env:
NODE_VERSION: 23
APT_PACKAGES: "xvfb libnss3 libatk-bridge2.0-0 libxkbcommon-x11-0 libgtk-3-0 libgbm1 libasound2 libxss1"
jobs:
install:
name: Prepare environment
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Cache APT dependencies
id: cache-apt
uses: actions/cache@v4
with:
path: /var/cache/apt/archives
key: apt-${{ runner.os }}-${{ env.APT_PACKAGES }}
- name: Install APT dependencies (if cache miss)
if: steps.cache-apt.outputs.cache-hit != 'true'
run: sudo apt-get update && sudo apt-get install -y ${{ env.APT_PACKAGES }}
- name: Install NPM dependencies
run: npm ci
- name: Cache Cypress binary
uses: actions/cache@v4
with:
path: ~/.cache/Cypress
key: cypress-${{ runner.os }}-${{ env.NODE_VERSION }}-${{ hashFiles('package-lock.json') }}
- name: Cache Node modules
uses: actions/cache@v4
with:
path: node_modules
key: node-modules-${{ runner.os }}-${{ env.NODE_VERSION }}-${{ hashFiles('package-lock.json') }}
- name: Install Cypress
run: npx cypress install
- name: Build project
run: npm run build
- name: Save build artifact
uses: actions/upload-artifact@v3
with:
name: build
path: dist
unit-tests:
name: Run unit tests
runs-on: ubuntu-latest
needs: install
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Download build artifact
uses: actions/download-artifact@v3
with:
name: build
path: dist
- name: Restore Node modules cache
uses: actions/cache@v4
with:
name: node-modules
key: node-modules-${{ runner.os }}-${{ env.NODE_VERSION }}-${{ hashFiles('package-lock.json') }}
path: node_modules
- name: Run unit tests
run: npm run test:unit
cypress-tests:
name: Run E2E tests (${{ matrix.browser }})
runs-on: ubuntu-latest
needs: install
strategy:
fail-fast: false
matrix:
browser: [chrome, firefox, edge]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Download build artifact
uses: actions/download-artifact@v3
with:
name: build
path: dist
- name: Install APT dependencies
run: sudo apt-get update && sudo apt-get install -y ${{ env.APT_PACKAGES }}
- name: Cypress run (${{ matrix.browser }})
uses: https://github.com/cypress-io/github-action@v6
with:
start: npm start
browser: ${{ matrix.browser }}