Skip to content

Addresses https://github.com/OpenHistoricalMap/issues/issues/1180 by … #456

Addresses https://github.com/OpenHistoricalMap/issues/issues/1180 by …

Addresses https://github.com/OpenHistoricalMap/issues/issues/1180 by … #456

Workflow file for this run

name: Tests
on:
- workflow_dispatch
- push
- pull_request
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
test:
name: Ruby ${{ matrix.ruby }}
strategy:
matrix:
ruby: ['3.2', '3.3', '3.4']
fail-fast: false
runs-on: ubuntu-latest
env:
RAILS_ENV: test
OPENSTREETMAP_MEMCACHE_SERVERS: 127.0.0.1
timeout-minutes: 20
steps:
- name: Checkout source
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
- name: Setup ruby
uses: ruby/setup-ruby@8aeb6ff8030dd539317f8e1769a044873b56ea71 # v1.268.0
with:
ruby-version: ${{ matrix.ruby }}
rubygems: 3.4.10
bundler-cache: true
- name: Cache node modules
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
with:
cache: yarn
- name: Install packages
run: |
sudo apt-get -yqq update
sudo apt-get -yqq install memcached libvips-dev
- name: Create database
run: |
sudo systemctl start postgresql
sudo -u postgres createuser -s $(id -un)
createdb openstreetmap
- name: Configure rails
run: |
cp config/github.database.yml config/database.yml
cp config/example.storage.yml config/storage.yml
touch config/settings.local.yml
- name: Install node modules
run: bundle exec bin/yarn install
- name: Populate database
run: |
sed -f script/normalise-structure db/structure.sql > db/structure.expected
rm -f db/structure.sql
bundle exec rails db:migrate
sed -f script/normalise-structure db/structure.sql > db/structure.actual
diff -uw db/structure.expected db/structure.actual
- name: Export javascript strings
run: bundle exec i18n export
- name: Compile assets
run: bundle exec rails assets:precompile
timeout-minutes: 10
- name: Create tmp/pids directory
run: mkdir -p tmp/pids
- name: Run tests
run: bundle exec rails test:all
- name: Run javascript tests
run: bundle exec teaspoon
- name: Upload screenshots
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
if: failure()
with:
name: screenshots
path: tmp/screenshots
if-no-files-found: ignore
- name: Report completion to Coveralls
uses: coverallsapp/github-action@5cbfd81b66ca5d10c19b062c04de0199c215fb6e # v2.3.7
with:
github-token: ${{ secrets.github_token }}
flag-name: ruby-${{ matrix.ruby }}
format: lcov
parallel: true
finish:
name: Finalise
needs: test
runs-on: ubuntu-latest
timeout-minutes: 1
steps:
- name: Report completion to Coveralls
uses: coverallsapp/github-action@5cbfd81b66ca5d10c19b062c04de0199c215fb6e # v2.3.7
with:
github-token: ${{ secrets.github_token }}
parallel-finished: true