Files
grecia/.github/workflows/tests.yml
Javi Martín a3844dcab5 Run apt update to install ImageMagick in CI workflow
We've been getting an error in our CI because some the Ubuntu 24.04
image in GitHub Actions doesn't have an updated package database:

```
E: Failed to fetch mirror+file:
   pool/main/g/ghostscript/libgs-common_10.02.1%7edfsg1-0ubuntu7.4_all.deb
   404  Not Found
E: Failed to fetch mirror+file:
   pool/main/g/ghostscript/libgs10-common_10.02.1%7edfsg1-0ubuntu7.4_all.deb
   404  Not Found
E: Failed to fetch mirror+file:
   pool/main/g/ghostscript/libgs10_10.02.1%7edfsg1-0ubuntu7.4_amd64.deb
   404  Not Found
E: Failed to fetch mirror+file:
   pool/main/g/ghostscript/ghostscript_10.02.1%7edfsg1-0ubuntu7.4_amd64.deb
   404  Not Found
E: Unable to fetch some archives, maybe run apt-get update
   or try with --fix-missing?
```

Running `sudo apt-get update` before trying to install a package solves
the issue.
2025-04-01 14:38:04 +02:00

98 lines
2.9 KiB
YAML

name: tests
on:
push:
branches:
- master
pull_request:
branches-ignore:
- i18n_master
permissions:
contents: read
env:
TEST_COVERAGE: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && 1 || '' }}
jobs:
tests:
runs-on: ubuntu-24.04
timeout-minutes: 60
services:
postgres:
image: postgres:13.16
ports: ["5432:5432"]
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
env:
POSTGRES_USER: consul
POSTGRES_PASSWORD: password
env:
PGUSER: consul
PGPASSWORD: password
RAILS_ENV: test
strategy:
fail-fast: false
matrix:
ci_node_total: [5]
ci_node_index: [0, 1, 2, 3, 4]
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Setup NPM
uses: actions/setup-node@v4
with:
cache: "npm"
node-version-file: ".node-version"
- name: Install node packages
run: npm clean-install
- name: Install ImageMagick
run: sudo apt-get update && sudo apt-get install imagemagick
- name: Remove image-bundled Chrome
run: sudo apt-get purge google-chrome-stable
- name: Setup Chrome/Chromium 128
uses: browser-actions/setup-chrome@v1
with:
chrome-version: 128
install-chromedriver: true
install-dependencies: true
- name: Copy secrets and database files
run: for i in config/*.example; do cp "$i" "${i/.example}"; done
- name: Setup database
run: bundle exec rake db:setup
- name: Compile assets
run: bundle exec rake assets:precompile > /dev/null 2>&1
- name: Run test suite
env:
KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC: ${{ secrets.KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC }}
KNAPSACK_PRO_CI_NODE_TOTAL: ${{ matrix.ci_node_total }}
KNAPSACK_PRO_CI_NODE_INDEX: ${{ matrix.ci_node_index }}
KNAPSACK_PRO_FIXED_QUEUE_SPLIT: true
KNAPSACK_PRO_LOG_LEVEL: info
run: bin/knapsack_pro_rspec
- name: Coveralls Parallel
if: ${{ env.TEST_COVERAGE == 1 }}
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
flag-name: run-${{ matrix.ci_node_index }}
parallel: true
- name: Upload screenshots
if: failure()
uses: actions/upload-artifact@v4
with:
name: screenshots-${{ matrix.ci_node_index }}
path: tmp/capybara/
coveralls:
permissions:
contents: none
runs-on: ubuntu-24.04
needs: tests
steps:
- name: Finish coveralls
if: ${{ env.TEST_COVERAGE == 1 }}
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true