Repository navigation
2101 record dashboard #2403
This file contains hidden or 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: 'GADS Tests' | |
| on: | |
| push: | |
| branches: | |
| - master | |
| - dev | |
| - hotfix | |
| paths-ignore: | |
| - '*.md' | |
| - VERSION | |
| pull_request: | |
| branches: | |
| - master | |
| - dev | |
| - hotfix | |
| paths-ignore: | |
| - '*.md' | |
| - VERSION | |
| jobs: | |
| unit_tests: | |
| name: 'Unit Tests' | |
| runs-on: 'ubuntu-22.04' | |
| timeout-minutes: 30 | |
| # Bit quicker to download this - not an issue when running in CI, | |
| # but it helps in local testing. Also all test functionality was tested | |
| # with this image and it works correctly. | |
| container: debian:trixie-slim | |
| steps: | |
| - name: 'Check out the GADS repository' | |
| uses: 'actions/checkout@v4' | |
| - name: 'Install dependencies' | |
| run: ./.github/workflows/install.sh | |
| - name: 'Run the unit tests' | |
| run: prove -lrs -j4 t | |
| cypress_tests: | |
| name: 'Cypress Tests' | |
| runs-on: 'ubuntu-22.04' | |
| timeout-minutes: 30 | |
| container: debian:trixie-slim | |
| needs: js_tests | |
| strategy: | |
| fail-fast: false | |
| services: | |
| postgres: | |
| image: postgres | |
| env: | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: postgrespassword | |
| POSTGRES_DB: postgres | |
| ports: | |
| - 5432:5432 | |
| env: | |
| GADS_USERNAME: 'test@example.com' | |
| GADS_PASSWORD: 'xyz123' | |
| steps: | |
| - name: 'Check out the GADS code' | |
| uses: 'actions/checkout@v4' | |
| - name: 'Install Non-CPAN dependencies' | |
| run: ./.github/workflows/install.sh | |
| - name: 'Set up credentials for psql' | |
| # See https://wiki.postgresql.org/wiki/Pgpass | |
| run: | | |
| echo '*:*:*:postgres:postgrespassword' > ~/.pgpass | |
| chmod 600 ~/.pgpass | |
| - name: 'Install YARN dependencies' | |
| run: apt-get install -y libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libnss3 libxss1 libasound2 libxtst6 xauth xvfb | |
| - name: 'create uploads directory' | |
| run: | | |
| mkdir -p /tmp/uploads | |
| chmod 777 /tmp/uploads | |
| - name: 'Start the application' | |
| env: | |
| DANCER_CONFDIR: 'cypress' | |
| PGDATABASE: 'postgres' | |
| PGHOST: 'localhost' | |
| PGUSER: 'postgres' | |
| TEST: '1' | |
| run: | | |
| ./bin/setup_database | |
| perl bin/app.pl & | |
| - name: 'Set up node dependencies' | |
| # Build deletes fengari-web.js, so we need to check it out again below | |
| run: | | |
| apt-get install -y nodejs | |
| npm i -g yarn npm --force | |
| yarn --frozen-lockfile | |
| mv ./public/js/fengari-web.js ./fengari-web.js.bak | |
| yarn build --no-watch | |
| mv ./fengari-web.js.bak ./public/js/fengari-web.js | |
| - name: 'Run the Cypress tests' | |
| run: yarn cypress run --browser chromium | |
| js_tests: | |
| name: JS Tests | |
| runs-on: ubuntu-22.04 | |
| needs: lint | |
| strategy: | |
| matrix: | |
| node-version: [22.x] | |
| # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Use Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache: 'npm' | |
| - run: yarn | |
| - run: yarn jest --passWithNoTests | |
| lint: | |
| name: Lint JS Code | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Use Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22.x | |
| - run: yarn | |
| - run: yarn lint --max-warnings=0 |