Docker Compose one command start #2045
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Test | |
| on: | |
| workflow_dispatch: ~ | |
| push: | |
| branches: | |
| - master | |
| pull_request: ~ | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: ${{ github.ref_name != 'master' }} | |
| jobs: | |
| test: | |
| name: Build and test | |
| strategy: | |
| matrix: | |
| runs-on: | |
| - ubuntu-24.04 | |
| - ubuntu-24.04-arm | |
| runs-on: ${{ matrix.runs-on }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Get Date | |
| id: get-date | |
| shell: bash | |
| run: | | |
| echo "date=$(/bin/date -u "+%Y%m")" >> $GITHUB_OUTPUT | |
| - name: Cache data | |
| uses: actions/cache@v4 | |
| id: cache-data | |
| with: | |
| path: | | |
| data/berlin.osm.pbf | |
| data/filtered/berlin.osm.pbf | |
| key: data-${{ steps.get-date.outputs.date }}-berlin | |
| enableCrossOsArchive: true | |
| - name: Download Berlin | |
| if: ${{ steps.cache-data.outputs.cache-hit != 'true' }} | |
| run: | | |
| curl --location --fail --output data/berlin.osm.pbf https://download.geofabrik.de/europe/germany/berlin-latest.osm.pbf | |
| - name: Build containers | |
| uses: docker/bake-action@v6 | |
| with: | |
| load: true | |
| targets: db,import,import-test,api,martin,martin-proxy | |
| set: | | |
| db.cache-from=type=gha,scope=db-${{ runner.arch }} | |
| ${{ github.ref_name == 'master' && format('db.cache-to=type=gha,mode=max,scope=db-{}', runner.arch) || '' }} | |
| import.cache-from=type=gha,scope=import-${{ runner.arch }} | |
| ${{ github.ref_name == 'master' && format('import.cache-to=type=gha,mode=max,scope=import-{}', runner.arch) || '' }} | |
| import-test.cache-from=type=gha,scope=import-test-${{ runner.arch }} | |
| ${{ github.ref_name == 'master' && format('import-test.cache-to=type=gha,mode=max,scope=import-test-{}', runner.arch) || '' }} | |
| api.cache-from=type=gha,scope=api-${{ runner.arch }} | |
| ${{ github.ref_name == 'master' && format('api.cache-to=type=gha,mode=max,scope=api-{}', runner.arch) || '' }} | |
| martin.cache-from=type=gha,scope=martin-${{ runner.arch }} | |
| ${{ github.ref_name == 'master' && format('martin.cache-to=type=gha,mode=max,scope=martin-{}', runner.arch) || '' }} | |
| martin-proxy.cache-from=type=gha,scope=martin-proxy-${{ runner.arch }} | |
| ${{ github.ref_name == 'master' && format('martin-proxy.cache-to=type=gha,mode=max,scope=martin-proxy-{}', runner.arch) || '' }} | |
| - name: Start database | |
| run: | | |
| docker compose up --no-build --wait db | |
| - name: Run import tests | |
| run: | | |
| docker compose run --rm import-test | |
| - name: Import data | |
| env: | |
| OSM2PGSQL_DATAFILE: berlin.osm.pbf | |
| run: | | |
| docker compose run --rm import import | |
| - name: Start API | |
| run: | | |
| docker compose up --wait --no-build --no-deps api | |
| - name: Run API tests | |
| working-directory: api | |
| run: | | |
| docker compose up --no-build --no-deps api-test | |
| - name: Start tile server | |
| run: | | |
| docker compose up --no-build --detach --no-deps martin | |
| - name: Start web server | |
| run: | | |
| docker compose up --no-build --wait --no-deps martin-proxy | |
| - name: Run proxy tests | |
| working-directory: proxy | |
| run: | | |
| docker compose run --no-build --no-deps martin-proxy-test | |
| - name: Download preset | |
| if: always() | |
| run: | | |
| curl -sSf -o preset.zip http://localhost:8000/preset.zip | |
| - name: Store preset | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: ${{ runner.arch }}-presets | |
| path: preset.zip | |
| if-no-files-found: warn | |
| - name: Run UI tests | |
| uses: cypress-io/github-action@v6 | |
| with: | |
| working-directory: proxy/test/ui | |
| browser: ${{ runner.arch == 'X64' && 'chrome' || 'firefox' }} | |
| - name: Store screenshots | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: ${{ runner.arch }}-screenshots | |
| path: proxy/test/ui/cypress/screenshots | |
| if-no-files-found: warn | |
| - name: Print logs | |
| if: always() | |
| run: | | |
| docker compose logs |