diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..4f11b7d --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,28 @@ +name: ci + +on: + push: + branches: [ develop ] + pull_request: + branches: [ develop ] + +env: + RWD_DATA: /tmp/rwd + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Setup Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Create empty folder for RWD_DATA + run: | + mkdir -p $RWD_DATA + + - name: Build image + run: | + ./scripts/update.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..29e0490 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,35 @@ +name: release + +on: + push: + tags: "*" + +jobs: + release: + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Set SHA_TAG + run: | + echo "SHA_TAG=`git rev-parse --short HEAD`" >> $GITHUB_ENV + + - name: Setup Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Quay + uses: docker/login-action@v3 + with: + registry: quay.io + username: ${{ secrets.QUAY_USERNAME }} + password: ${{ secrets.QUAY_PASSWORD }} + + - name: Build and push + uses: docker/build-push-action@v6 + with: + push: true + tags: | + quay.io/wikiwatershed/rwd:${SHA_TAG} + quay.io/wikiwatershed/rwd:${{ github.ref_name }} + quay.io/wikiwatershed/rwd:latest diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index ed4ca6b..0000000 --- a/.travis.yml +++ /dev/null @@ -1,27 +0,0 @@ -sudo: required - -language: bash - -services: - - docker - -install: - - docker build -t quay.io/wikiwatershed/rwd:${TRAVIS_COMMIT:0:7} . - -script: - - docker run -d --name rwd quay.io/wikiwatershed/rwd:${TRAVIS_COMMIT:0:7} /opt/taudem/gagewatershed - -before_deploy: - - docker login -e . -p "${QUAY_PASSWORD}" -u "${QUAY_USER}" quay.io - -deploy: - - provider: script - script: ".travis/deploy.sh" - on: - repo: WikiWatershed/rapid-watershed-delineation - branch: develop - - provider: script - script: ".travis/deploy.sh" - on: - repo: WikiWatershed/rapid-watershed-delineation - tags: true diff --git a/.travis/deploy.sh b/.travis/deploy.sh deleted file mode 100755 index 6ddbbc9..0000000 --- a/.travis/deploy.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env bash - -set -e - -if [ -z "${TRAVIS_TAG}" ]; then - QUAY_TAG="${TRAVIS_COMMIT:0:7}" -else - QUAY_TAG="${TRAVIS_TAG}" - - docker tag "quay.io/wikiwatershed/rwd:${TRAVIS_COMMIT:0:7}" "quay.io/wikiwatershed/rwd:${QUAY_TAG}" -fi - -docker push "quay.io/wikiwatershed/rwd:${QUAY_TAG}" -docker tag "quay.io/wikiwatershed/rwd:${QUAY_TAG}" "quay.io/wikiwatershed/rwd:latest" -docker push "quay.io/wikiwatershed/rwd:latest" diff --git a/scripts/console.sh b/scripts/console.sh index 7a45b26..b45d4cf 100755 --- a/scripts/console.sh +++ b/scripts/console.sh @@ -11,8 +11,7 @@ fi set -x -docker-compose run \ +docker compose run \ --rm \ - -e RWD_DATA=$RWD_DATA \ --entrypoint /bin/bash \ app diff --git a/scripts/server.sh b/scripts/server.sh index ddbb090..83f17b3 100755 --- a/scripts/server.sh +++ b/scripts/server.sh @@ -2,8 +2,13 @@ set -e +if [ -z "$RWD_DATA" ]; then + echo "Environment variable RWD_DATA not defined." + exit 1 +fi + echo "Run the RWD Docker container." set -x -docker-compose up +docker compose up diff --git a/scripts/update.sh b/scripts/update.sh index 81cb161..1d3789d 100755 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -2,8 +2,13 @@ set -e +if [ -z "$RWD_DATA" ]; then + echo "Environment variable RWD_DATA not defined." + exit 1 +fi + echo "Build the RWD Docker container." set -x -docker-compose build +docker compose build