name: Tests on: - 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'] 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@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - name: Setup ruby uses: ruby/setup-ruby@efbf473cab83af4468e8606cc33eca9281bb213f # v1.256.0 with: ruby-version: ${{ matrix.ruby }} rubygems: 3.4.10 bundler-cache: true - name: Cache node modules uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.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@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 if: failure() with: name: screenshots path: tmp/screenshots if-no-files-found: ignore - name: Report completion to Coveralls uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b # v2.3.6 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@648a8eb78e6d50909eff900e4ec85cab4524a45b # v2.3.6 with: github-token: ${{ secrets.github_token }} parallel-finished: true