This repository has been archived by the owner on Oct 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #444 from spwoodcock/build/multi-stage-dockerfiles
Optimise dockerfiles, fix ci, release images
- Loading branch information
Showing
13 changed files
with
398 additions
and
101 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Ignore everything | ||
** | ||
|
||
# Allow files and directories | ||
|
||
# Underpass | ||
!src | ||
!config | ||
!setup | ||
!docker/bzip2.pc | ||
!autogen.sh | ||
!configure.ac | ||
!Makefile.am | ||
!m4 | ||
!dist | ||
!docs | ||
!ABOUT-NLS | ||
!config.rpath | ||
!docker/ci-entrypoint.sh | ||
|
||
# API | ||
!python |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: 🔧 Build Release Image | ||
|
||
on: | ||
release: | ||
types: [published] | ||
# Allow manual trigger | ||
workflow_dispatch: | ||
|
||
jobs: | ||
underpass-build: | ||
uses: hotosm/gh-workflows/.github/workflows/image_build.yml@1.4.1 | ||
with: | ||
dockerfile: docker/underpass.dockerfile | ||
build_target: prod | ||
image_name: ghcr.io/${{ github.repository }} | ||
|
||
api-build: | ||
uses: hotosm/gh-workflows/.github/workflows/image_build.yml@1.4.1 | ||
with: | ||
dockerfile: docker/underpass-api.dockerfile | ||
build_target: prod | ||
image_name: ghcr.io/${{ github.repository }}/api | ||
|
||
ui-build: | ||
uses: hotosm/gh-workflows/.github/workflows/image_build.yml@1.4.1 | ||
with: | ||
dockerfile: docker/underpass-ui.dockerfile | ||
build_target: prod | ||
image_name: ghcr.io/${{ github.repository }}/ui |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,27 @@ | ||
name: 🧪 Build and test | ||
name: 🧪 Build and Test | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
paths: | ||
- src/** | ||
- .github/workflows/** | ||
- docker/** | ||
# Allow manual trigger | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
# Relies on the master branch built docker image for build-deps | ||
- name: Start Docker Compose & build | ||
run: cd docker && docker-compose up -d underpass | ||
# Build and run tests | ||
- name: Build and run tests | ||
run: | | ||
docker-compose -f docker-compose.yml exec -T underpass sh -c "cd /code/build && make check -j `nproc`" | ||
exit_code=$? | ||
if [ $exit_code -ne 0 ]; then | ||
echo "Test failed with exit code $exit_code" | ||
exit $exit_code | ||
fi | ||
build-and-test: | ||
uses: hotosm/gh-workflows/.github/workflows/test_compose.yml@1.4.1 | ||
with: | ||
image_name: ghcr.io/${{ github.repository }} | ||
build_dockerfile: docker/underpass.dockerfile | ||
compose_service: underpass | ||
compose_command: echo "Tests complete." | ||
# TODO update postgis image to use github repo var ${{ vars.POSTGIS_TAG }} | ||
cache_extra_imgs: | | ||
"docker.io/postgis/postgis:15-3.3-alpine" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"pull_request": { | ||
"head": { | ||
"ref": "feat/some-new-thing" | ||
}, | ||
"base": { | ||
"ref": "master" | ||
} | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"base_ref ": "master", | ||
"ref": "refs/heads/master" | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
######################################## | ||
# Note: run this from the repo root. | ||
######################################## | ||
|
||
# Tests | ||
act pull_request -W .github/workflows/tests.yml \ | ||
-e .github/workflows/tests/pr_payload.json | ||
|
||
# Docs | ||
act push -W .github/workflows/docs.yml \ | ||
-e .github/workflows/tests/pr_payload.json | ||
|
||
# Release | ||
act release -W .github/workflows/release_img.yml \ | ||
-e .github/workflows/tests/push_payload.json |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
yellow_echo() { | ||
local message="$1" | ||
local separator="--------------------------------------------------------" | ||
local sep_length=${#separator} | ||
local pad_length=$(( (sep_length - ${#message}) / 2 )) | ||
local pad="" | ||
|
||
for ((i=0; i<pad_length; i++)); do | ||
pad="$pad " | ||
done | ||
|
||
echo "" | ||
echo -e "\e[0;33m$separator\e[0m" | ||
echo -e "\e[0;33m$pad$message$pad\e[0m" | ||
echo -e "\e[0;33m$separator\e[0m" | ||
echo "" | ||
} | ||
|
||
# Generate makefiles | ||
yellow_echo "Generating Makefiles" | ||
./autogen.sh | ||
|
||
echo | ||
echo "Entering 'build' directory" | ||
cd build | ||
|
||
# Test build works | ||
yellow_echo "Building Underpass" | ||
../configure | ||
make -j $(nproc) | ||
make install | ||
|
||
# Run tests | ||
yellow_echo "Running Tests" | ||
cd /code/build/src/testsuite/libunderpass.all | ||
make check -j `nproc` |
Oops, something went wrong.