diff --git a/.github/workflows/build-and-test.yaml b/.github/workflows/build-and-test.yaml index cdc9c83..6ea8ba4 100644 --- a/.github/workflows/build-and-test.yaml +++ b/.github/workflows/build-and-test.yaml @@ -21,49 +21,65 @@ env: jobs: - test: + build: + strategy: + matrix: + include: + - arch : amd64 + mode : build-and-test + - arch : arm64 + variant : v8 + mode : build-only runs-on: ubuntu-latest env: VOLUME : osm-db CONTAINER : osm-www MOUNT : /data/database/ + PLATFORM : linux/${{ matrix.arch }}${{ (matrix.variant != '' && format('/{0}', matrix.variant)) || '' }} steps: - name: Checkout uses: actions/checkout@v3 - name: Set up QEMU - uses: docker/setup-qemu-action@v1 + uses: docker/setup-qemu-action@v2 + with: + platforms: ${{ matrix.arch }} - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 + uses: docker/setup-buildx-action@v2 - name: Environment run : | echo IMAGE=$(echo ${{ env.IMAGE }} | tr '[:upper:]' '[:lower:]') >>$GITHUB_ENV - name: Docker build - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v3 with: pull : true - load : true + load : ${{ matrix.mode == 'build-and-test' }} + platforms : ${{ env.PLATFORM }} context : . file : ./Dockerfile - tags : ${{env.IMAGE}}:${{env.TAG}} - cache-from : type=gha,scope=${{ github.workflow }} - cache-to : type=gha,scope=${{ github.workflow }},mode=max + tags : ${{ env.IMAGE }}:${{ env.TAG }} + cache-from : type=gha,scope=${{ github.workflow }}:${{ env.PLATFORM }} + cache-to : type=gha,scope=${{ github.workflow }}:${{ env.PLATFORM }},mode=max - name: Import Luxembourg + if : ${{ matrix.mode == 'build-and-test' }} run : | docker volume create ${VOLUME} docker run --rm --shm-size=128M -v ${VOLUME}:${MOUNT} -e UPDATES=enabled ${IMAGE}:${TAG} import - name: Start server + if : ${{ matrix.mode == 'build-and-test' }} run : | - docker run --rm --shm-size=128M -v ${VOLUME}:${MOUNT} -e UPDATES=enabled -p 80:80 -d --name ${CONTAINER} ${IMAGE}:${TAG} run + docker run --shm-size=128M -v ${VOLUME}:${MOUNT} -e UPDATES=enabled -p 80:80 -d --name ${CONTAINER} ${IMAGE}:${TAG} run sleep 30 + docker logs ${CONTAINER} - name: Download tiles + if : ${{ matrix.mode == 'build-and-test' }} run : | curl http://localhost/tile/0/0/0.png --fail -o 000.png curl http://localhost/tile/1/0/0.png --fail -o 100.png @@ -74,12 +90,14 @@ jobs: curl http://localhost/tile/18/135536/89345.png --fail -o example.png - name: Upload tiles + if : ${{ matrix.mode == 'build-and-test' }} uses: actions/upload-artifact@v3 with: name: tiles path: '*.png' - name: Verify tiles + if : ${{ matrix.mode == 'build-and-test' }} run : | sha1sum *.png sha1sum --check <