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