Skip to content

Commit 756bc2c

Browse files
Merge pull request #353 from NCEAS/bugfix-#327-rabbitmq-connections
#327 rabbitmq connections and #350 track run status
2 parents 835be9a + 554f917 commit 756bc2c

38 files changed

+1948
-839
lines changed

.github/workflows/build.yml

+135
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
name: Java Maven Build, Test, and Publish
2+
3+
on:
4+
push:
5+
branches:
6+
- feature*
7+
- bugfix*
8+
- develop
9+
tags: [ 'v*.*.*' ]
10+
11+
env:
12+
# Use docker.io for Docker Hub if empty
13+
REGISTRY: ghcr.io
14+
# github.repository as <account>/<repo>
15+
#IMAGE_NAME: ${{ github.repository }}
16+
IMAGE_NAME: ${{ github.repository_owner }}/metadig-engine
17+
GITHUB_PAT: ${{ secrets.TOKEN }}
18+
19+
jobs:
20+
maven-build:
21+
name: Maven Build and Test
22+
runs-on: ubuntu-latest
23+
outputs:
24+
version: ${{ steps.get_version.outputs.version }}
25+
steps:
26+
- uses: actions/checkout@v3
27+
- name: Set up JDK
28+
uses: actions/setup-java@v3
29+
with:
30+
java-version: '8'
31+
distribution: 'temurin'
32+
cache: 'maven'
33+
34+
- uses: actions/setup-python@v4
35+
with:
36+
python-version: '2.7' # Version range or exact version of a Python version to use, using SemVer's version range syntax
37+
38+
- name: Setup R
39+
uses: r-lib/actions/setup-r@v2
40+
41+
- name: Install linux deps
42+
run: sudo apt-get install -y libcurl4-openssl-dev
43+
44+
- name: Install deps
45+
run: Rscript -e 'install.packages(c("httr", "jsonlite", "remotes"))'
46+
47+
- name: Install metadig
48+
run: Rscript -e 'remotes::install_github("nceas/metadig-r")'
49+
50+
- name: Extract Maven project version
51+
run: echo "version="$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec) >> $GITHUB_OUTPUT
52+
id: get_version
53+
#- name: Show extracted Maven project version
54+
#run: echo "Version from pom: " ${{ steps.get_version.outputs.version }}
55+
56+
- name: Build and Test
57+
run: mvn --batch-mode --update-snapshots test
58+
- name: Package
59+
run: mvn --batch-mode --update-snapshots -DskipTests=true package
60+
- uses: actions/cache@v3
61+
with:
62+
path: .
63+
key: builddir-${{ github.run_id }}
64+
65+
docker-publish:
66+
name: Docker Build and Publish
67+
if: github.ref_name == 'develop' || github.ref_name == 'v*.*.*'
68+
needs: maven-build
69+
runs-on: ubuntu-latest
70+
permissions:
71+
contents: read
72+
packages: write
73+
74+
steps:
75+
- uses: actions/cache@v3
76+
with:
77+
path: .
78+
key: builddir-${{ github.run_id }}
79+
80+
- name: Set up Docker Buildx
81+
uses: docker/setup-buildx-action@v2
82+
83+
# Login against a Docker registry except on PR
84+
# https://github.com/docker/login-action
85+
- name: Log into registry ${{ env.REGISTRY }}
86+
if: github.event_name != 'pull_request'
87+
uses: docker/login-action@v2
88+
with:
89+
registry: ${{ env.REGISTRY }}
90+
username: ${{ github.actor }}
91+
password: ${{ secrets.TOKEN }}
92+
93+
# Extract metadata (tags, labels) for Docker
94+
# https://github.com/docker/metadata-action
95+
- name: Extract Docker metadata
96+
id: meta
97+
uses: docker/metadata-action@v4
98+
with:
99+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
100+
101+
# Build and push Docker image with Buildx (don't push on PR)
102+
# https://github.com/docker/build-push-action
103+
- name: Build and push scheduler image
104+
uses: docker/build-push-action@v3
105+
with:
106+
context: .
107+
file: Docker/metadig-scheduler/Dockerfile
108+
build-args: TAG=${{needs.maven-build.outputs.version}}
109+
push: ${{ github.event_name != 'pull_request' }}
110+
tags: ${{ steps.meta.outputs.tags }}
111+
labels: ${{ steps.meta.outputs.labels }}
112+
113+
# Build and push Docker image with Buildx (don't push on PR)
114+
# https://github.com/docker/build-push-action
115+
- name: Build and push scorer image
116+
uses: docker/build-push-action@v3
117+
with:
118+
context: .
119+
file: Docker/metadig-scorer/Dockerfile
120+
build-args: TAG=${{needs.maven-build.outputs.version}}
121+
push: ${{ github.event_name != 'pull_request' }}
122+
tags: ${{ steps.meta.outputs.tags }}
123+
labels: ${{ steps.meta.outputs.labels }}
124+
125+
# Build and push Docker image with Buildx (don't push on PR)
126+
# https://github.com/docker/build-push-action
127+
- name: Build and push worker image
128+
uses: docker/build-push-action@v3
129+
with:
130+
context: .
131+
file: Docker/metadig-worker/Dockerfile
132+
build-args: TAG=${{needs.maven-build.outputs.version}}
133+
push: ${{ github.event_name != 'pull_request' }}
134+
tags: ${{ steps.meta.outputs.tags }}
135+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)