Skip to content

Commit f9b8cd9

Browse files
authored
Merge pull request #272 from jacomago/split-up-push-and-test
Split up test and push github actions
2 parents 5e8e765 + dc62ad7 commit f9b8cd9

File tree

2 files changed

+113
-64
lines changed

2 files changed

+113
-64
lines changed
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support
4+
# documentation.
5+
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
6+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle
7+
8+
name: Build and Push
9+
10+
on:
11+
push:
12+
branches: [ "master" ]
13+
tags:
14+
- '**'
15+
16+
permissions:
17+
contents: read
18+
checks: write
19+
20+
env:
21+
REGISTRY: ghcr.io
22+
IMAGE_NAME: ${{ github.repository }}
23+
24+
jobs:
25+
build-jar-release:
26+
name: Build Default site version
27+
runs-on: ubuntu-latest
28+
29+
steps:
30+
- uses: actions/checkout@v4
31+
with:
32+
submodules: true
33+
fetch-depth: 0
34+
- name: Set up JDK 17
35+
uses: actions/setup-java@v4
36+
with:
37+
java-version: '17'
38+
distribution: 'temurin'
39+
- name: Setup Gradle
40+
uses: gradle/actions/setup-gradle@v4
41+
- name: Build with Gradle
42+
run: ./gradlew assemble
43+
env:
44+
ARCHAPPL_SITEID: "default"
45+
- name: Upload package
46+
if: always()
47+
uses: actions/upload-artifact@v4
48+
with:
49+
name: default-package
50+
path: build/distributions/*.tar.gz
51+
52+
build-and-push-image:
53+
permissions:
54+
contents: read
55+
packages: write
56+
runs-on: ubuntu-latest
57+
strategy:
58+
matrix:
59+
imagetag:
60+
- singletomcat
61+
- mgmt
62+
- etl
63+
- engine
64+
- retrieval
65+
steps:
66+
- uses: actions/checkout@v4
67+
with:
68+
submodules: true
69+
fetch-depth: 0
70+
- name: Set up JDK 17
71+
uses: actions/setup-java@v4
72+
with:
73+
java-version: '17'
74+
distribution: 'temurin'
75+
- name: Setup Gradle
76+
uses: gradle/actions/setup-gradle@v4
77+
- name: Build with Gradle
78+
run: ./gradlew assemble
79+
env:
80+
ARCHAPPL_SITEID: "default"
81+
- name: Log in to the Container registry
82+
uses: docker/login-action@v3
83+
with:
84+
registry: ${{ env.REGISTRY }}
85+
username: ${{ github.actor }}
86+
password: ${{ secrets.GITHUB_TOKEN }}
87+
- name: Extract metadata (tags, labels) for Docker
88+
id: meta
89+
uses: docker/metadata-action@v5
90+
with:
91+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
92+
flavor: |
93+
latest=false
94+
prefix=${{matrix.imagetag}}-
95+
tags: |
96+
type=ref,event=pr,prefix=${{ matrix.imagetag }}-pr-
97+
type=sha,prefix=${{ matrix.imagetag }}-
98+
- name: Set up Docker Buildx
99+
uses: docker/setup-buildx-action@v3
100+
- name: Build and push Docker image
101+
uses: docker/build-push-action@v5
102+
with:
103+
context: .
104+
file: Dockerfile
105+
push: true
106+
platforms: linux/amd64,linux/arm64
107+
target: ${{matrix.imagetag}}
108+
tags: ${{ steps.meta.outputs.tags }}
109+
labels: ${{ steps.meta.outputs.labels }}
110+
cache-from: type=gha
111+
cache-to: type=gha,mode=max

.github/workflows/ci.yml renamed to .github/workflows/test-and-build.yml

Lines changed: 2 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
66
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle
77

8-
name: Test and Build
8+
name: Test and Build Test Versions
99

1010
on:
1111
push:
@@ -101,7 +101,7 @@ jobs:
101101
runs-on: ubuntu-latest
102102
strategy:
103103
matrix:
104-
siteid: ["slacdev", "default"]
104+
siteid: ["slacdev", "default", "tests"]
105105

106106
steps:
107107
- uses: actions/checkout@v4
@@ -125,65 +125,3 @@ jobs:
125125
with:
126126
name: ${{ matrix.siteid }}-package
127127
path: build/distributions/*.tar.gz
128-
129-
build-and-push-image:
130-
needs: [unittests, epicstests]
131-
permissions:
132-
contents: read
133-
packages: write
134-
runs-on: ubuntu-latest
135-
strategy:
136-
matrix:
137-
imagetag:
138-
- singletomcat
139-
- mgmt
140-
- etl
141-
- engine
142-
- retrieval
143-
steps:
144-
- uses: actions/checkout@v4
145-
with:
146-
submodules: true
147-
fetch-depth: 0
148-
- name: Set up JDK 17
149-
uses: actions/setup-java@v4
150-
with:
151-
java-version: '17'
152-
distribution: 'temurin'
153-
- name: Setup Gradle
154-
uses: gradle/actions/setup-gradle@v4
155-
- name: Build with Gradle
156-
run: ./gradlew assemble
157-
env:
158-
ARCHAPPL_SITEID: "default"
159-
- name: Log in to the Container registry
160-
uses: docker/login-action@v3
161-
with:
162-
registry: ${{ env.REGISTRY }}
163-
username: ${{ github.actor }}
164-
password: ${{ secrets.GITHUB_TOKEN }}
165-
- name: Extract metadata (tags, labels) for Docker
166-
id: meta
167-
uses: docker/metadata-action@v5
168-
with:
169-
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
170-
flavor: |
171-
latest=false
172-
prefix=${{matrix.imagetag}}-
173-
tags: |
174-
type=ref,event=pr,prefix=${{ matrix.imagetag }}-pr-
175-
type=sha,prefix=${{ matrix.imagetag }}-
176-
- name: Set up Docker Buildx
177-
uses: docker/setup-buildx-action@v3
178-
- name: Build and push Docker image
179-
uses: docker/build-push-action@v5
180-
with:
181-
context: .
182-
file: Dockerfile
183-
push: true
184-
platforms: linux/amd64,linux/arm64
185-
target: ${{matrix.imagetag}}
186-
tags: ${{ steps.meta.outputs.tags }}
187-
labels: ${{ steps.meta.outputs.labels }}
188-
cache-from: type=gha
189-
cache-to: type=gha,mode=max

0 commit comments

Comments
 (0)