From 8ebe9ba1fcff3e2ce0e3824d4d95290c0aa6156e Mon Sep 17 00:00:00 2001 From: Matias Garcia Isaia Date: Wed, 6 Mar 2024 13:22:23 -0300 Subject: [PATCH] WIP - Build on Github Actions --- .github/workflows/build.yml | 36 ++++++++++++++++++++++++++++++++++++ Dockerfile | 3 +++ build.sh | 13 +++++++++++++ 3 files changed, 52 insertions(+) create mode 100644 .github/workflows/build.yml create mode 100755 build.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..b4567939 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,36 @@ +name: CI + +on: [push, pull_request] + +jobs: + test: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + + - name: Set environment up + run: | + docker compose pull + docker compose build + docker compose run --rm client npm install + + - name: Run specs + env: + JVM_OPTS: -Xmx3200m + TEST_DATABASE_URL: jdbc:postgresql://db/planwise?user=planwise&password=planwise + run: | + docker compose run --rm -e JVM_OPTS -e TEST_DATABASE_URL app lein test + docker compose run --rm client npm run test + docker compose run --rm app lein check-format + + build: + needs: test + runs-on: ubuntu-22.04 + env: + DOCKER_REPOSITORY: 'instedd/planwise' + DOCKER_USER: ${{ secrets.DOCKER_USER }} + DOCKER_PASS: ${{ secrets.DOCKER_PASS }} + steps: + - uses: actions/checkout@v4 + - name: Build image & push to Docker Hub + run: ./build.sh diff --git a/Dockerfile b/Dockerfile index 49488adb..8d4131d9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -48,6 +48,9 @@ ENV BIN_PATH /app/bin/ COPY --from=build /app/target/uberjar/planwise-standalone.jar /app/lib/ ENV JAR_PATH /app/lib/planwise-standalone.jar +# Add app version file +COPY --from=build /app/resources/planwise/version /app/VERSION + # Expose JNI libs to app ENV LD_LIBRARY_PATH=/usr/lib/jni diff --git a/build.sh b/build.sh new file mode 100755 index 00000000..b652acf7 --- /dev/null +++ b/build.sh @@ -0,0 +1,13 @@ +#!/bin/bash +set -eo pipefail + +source <(curl -s https://raw.githubusercontent.com/manastech/ci-docker-builder/d3406587def914918666ef41c0637d6b739fdf7d/build.sh) + +dockerSetup +echo $VERSION > VERSION +echo $VERSION > resources/planwise/version + +dockerBuildAndPush +# FIXME: build & push mapcache +# FIXME: build & push mapserver +# FIXME: build & push tools