]> git.openstreetmap.org Git - rails.git/blob - .github/workflows/docker.yml
Merge remote-tracking branch 'upstream/pull/6798'
[rails.git] / .github / workflows / docker.yml
1 name: Docker
2 on:
3   push:
4     branches:
5       - master
6   pull_request:
7 concurrency:
8   group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
9   cancel-in-progress: true
10 jobs:
11   test:
12     name: Docker
13     runs-on: ubuntu-latest
14     timeout-minutes: 20
15     steps:
16     - name: Checkout source
17       uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
18     - name: Poke config
19       run: |
20         cp config/example.storage.yml config/storage.yml
21         cp config/docker.database.yml config/database.yml
22         touch config/settings.local.yml
23     - name: Build Docker Image
24       run: |
25         docker compose build
26     - name: Start Docker Compose
27       run: |
28         docker compose up -d
29         sleep 15 # let the DB warm up a little
30     - name: Prepare Database
31       run: |
32         docker compose run --rm web bundle exec rails db:migrate
33         docker compose run --rm web bundle exec i18n export
34         docker compose run --rm web bundle exec rails assets:precompile
35         docker compose run --rm web osmosis --rx docker/null-island.osm.xml --wd host=db database=openstreetmap user=openstreetmap password=openstreetmap validateSchemaVersion=no
36     - name: Test Basic Website
37       run: |
38         curl -siL http://127.0.0.1:3000 | egrep '^HTTP/1.1 200 OK'
39         curl -siL http://127.0.0.1:3000 | grep 'OpenStreetMap is a map of the world'
40         curl -siL http://127.0.0.1:3000/api/0.6/node/1 | grep 'Null Island'
41     - name: Test Complete Suite
42       run: |
43         docker compose run --rm web bundle exec rails db:test:prepare
44         docker compose run --rm web bundle exec rails test:all