-
Notifications
You must be signed in to change notification settings - Fork 5
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 #353 from NCEAS/bugfix-#327-rabbitmq-connections
- Loading branch information
Showing
38 changed files
with
1,948 additions
and
839 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,135 @@ | ||
name: Java Maven Build, Test, and Publish | ||
|
||
on: | ||
push: | ||
branches: | ||
- feature* | ||
- bugfix* | ||
- develop | ||
tags: [ 'v*.*.*' ] | ||
|
||
env: | ||
# Use docker.io for Docker Hub if empty | ||
REGISTRY: ghcr.io | ||
# github.repository as <account>/<repo> | ||
#IMAGE_NAME: ${{ github.repository }} | ||
IMAGE_NAME: ${{ github.repository_owner }}/metadig-engine | ||
GITHUB_PAT: ${{ secrets.TOKEN }} | ||
|
||
jobs: | ||
maven-build: | ||
name: Maven Build and Test | ||
runs-on: ubuntu-latest | ||
outputs: | ||
version: ${{ steps.get_version.outputs.version }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up JDK | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '8' | ||
distribution: 'temurin' | ||
cache: 'maven' | ||
|
||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '2.7' # Version range or exact version of a Python version to use, using SemVer's version range syntax | ||
|
||
- name: Setup R | ||
uses: r-lib/actions/setup-r@v2 | ||
|
||
- name: Install linux deps | ||
run: sudo apt-get install -y libcurl4-openssl-dev | ||
|
||
- name: Install deps | ||
run: Rscript -e 'install.packages(c("httr", "jsonlite", "remotes"))' | ||
|
||
- name: Install metadig | ||
run: Rscript -e 'remotes::install_github("nceas/metadig-r")' | ||
|
||
- name: Extract Maven project version | ||
run: echo "version="$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec) >> $GITHUB_OUTPUT | ||
id: get_version | ||
#- name: Show extracted Maven project version | ||
#run: echo "Version from pom: " ${{ steps.get_version.outputs.version }} | ||
|
||
- name: Build and Test | ||
run: mvn --batch-mode --update-snapshots test | ||
- name: Package | ||
run: mvn --batch-mode --update-snapshots -DskipTests=true package | ||
- uses: actions/cache@v3 | ||
with: | ||
path: . | ||
key: builddir-${{ github.run_id }} | ||
|
||
docker-publish: | ||
name: Docker Build and Publish | ||
if: github.ref_name == 'develop' || github.ref_name == 'v*.*.*' | ||
needs: maven-build | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- uses: actions/cache@v3 | ||
with: | ||
path: . | ||
key: builddir-${{ github.run_id }} | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
# Login against a Docker registry except on PR | ||
# https://github.com/docker/login-action | ||
- name: Log into registry ${{ env.REGISTRY }} | ||
if: github.event_name != 'pull_request' | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.TOKEN }} | ||
|
||
# Extract metadata (tags, labels) for Docker | ||
# https://github.com/docker/metadata-action | ||
- name: Extract Docker metadata | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
|
||
# Build and push Docker image with Buildx (don't push on PR) | ||
# https://github.com/docker/build-push-action | ||
- name: Build and push scheduler image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: . | ||
file: Docker/metadig-scheduler/Dockerfile | ||
build-args: TAG=${{needs.maven-build.outputs.version}} | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
||
# Build and push Docker image with Buildx (don't push on PR) | ||
# https://github.com/docker/build-push-action | ||
- name: Build and push scorer image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: . | ||
file: Docker/metadig-scorer/Dockerfile | ||
build-args: TAG=${{needs.maven-build.outputs.version}} | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
||
# Build and push Docker image with Buildx (don't push on PR) | ||
# https://github.com/docker/build-push-action | ||
- name: Build and push worker image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: . | ||
file: Docker/metadig-worker/Dockerfile | ||
build-args: TAG=${{needs.maven-build.outputs.version}} | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
Oops, something went wrong.