Skip to content

Commit 7e87bae

Browse files
committed
Merge branch '140-native-binaries' into 276-rename-omp-to-esmf
2 parents c2109c1 + e40dafa commit 7e87bae

File tree

4 files changed

+243
-60
lines changed

4 files changed

+243
-60
lines changed

.github/workflows/pull_request_check.yml renamed to .github/workflows/pull-request-check.yml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,31 +61,28 @@ jobs:
6161
shell: bash
6262

6363
- name: Upload executable jar
64-
# We only need one OS job to upload the jars
64+
# We only need one OS job to upload the jar
6565
if: matrix.os == 'ubuntu-20.04'
66-
uses: actions/upload-artifact@v2
66+
uses: actions/upload-artifact@v3
6767
with:
6868
name: samm-cli-jar
6969
path: tools/samm-cli/target/samm-cli-*.jar
7070

7171
- name: Upload binary (Windows)
7272
if: matrix.os == 'windows-latest'
73-
uses: actions/upload-artifact@v2
73+
uses: actions/upload-artifact@v3
7474
with:
75+
name: bamm-cli-binary-${{ matrix.os }}
7576
name: samm-cli-binary-${{ matrix.os }}
76-
# We put all the possible binary names in the path,
77-
# upload-artifact will upload the one(s) that are actually present
7877
path: |
7978
tools/samm-cli/target/samm.exe
8079
tools/samm-cli/target/*.dll
8180
tools/samm-cli/target/lib/
8281
8382
- name: Upload binary (Linux/Mac)
8483
if: matrix.os == 'ubuntu-20.04' || matrix.os == 'macos-latest'
85-
uses: actions/upload-artifact@v2
84+
uses: actions/upload-artifact@v3
8685
with:
8786
name: samm-cli-binary-${{ matrix.os }}
88-
# We put all the possible binary names in the path,
89-
# upload-artifact will upload the one(s) that are actually present
9087
path: |
9188
tools/samm-cli/target/samm

.github/workflows/release-workflow.yml

Lines changed: 219 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,26 @@ on:
66
description: 'Version number of the release'
77
required: true
88
jobs:
9-
build:
9+
check-preconditions:
10+
name: Check preconditions
1011
runs-on: ubuntu-20.04
1112
steps:
1213
- name: Checkout
13-
uses: actions/[email protected]
14-
with:
15-
ref: main
16-
fetch-depth: 0
14+
uses: actions/checkout@v3
15+
16+
# Required for Maven
1717
- name: Set up JDK 17
1818
uses: actions/setup-java@v2
1919
with:
2020
distribution: 'temurin'
2121
java-version: '17'
22-
server-id: ossrh
23-
server-username: OSSRH_USERNAME
24-
server-password: OSSRH_TOKEN
25-
gpg-private-key: ${{ secrets.PGP_KEY }}
26-
gpg-passphrase: PGP_KEY_PASSWORD
2722
overwrite-settings: false
23+
2824
- name: Setup Git
2925
run: |
3026
git config user.name github-actions
3127
git config user.email [email protected]
28+
3229
- name: Sanity check version
3330
if: ${{ !contains( github.event.inputs.release_version, '-M' ) }}
3431
run: |
@@ -42,75 +39,225 @@ jobs:
4239
echo release version $release_version is invalid
4340
exit 1
4441
fi
45-
- name: Create release branch if not exists
42+
43+
# The Linux build will upload the local Nexus deployment repository
44+
# (i.e., what will be deployed to OSSRH/Maven Central)
45+
# and the Linux-specific bamm-cli binary to the build artifacts
46+
build-linux:
47+
name: Linux build
48+
needs: [check-preconditions]
49+
runs-on: ubuntu-20.04
50+
steps:
51+
- name: Checkout
52+
uses: actions/checkout@v3
53+
54+
- name: Setup JDK
55+
uses: graalvm/setup-graalvm@v1
56+
with:
57+
version: '22.3.1'
58+
java-version: '17'
59+
components: 'native-image,js'
60+
github-token: ${{ secrets.GITHUB_TOKEN }}
61+
native-image-job-reports: 'true'
62+
63+
- name: Cache Maven packages
64+
uses: actions/cache@v3
65+
with:
66+
path: ~/.m2/repository
67+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
68+
restore-keys: |
69+
${{ runner.os }}-maven-
70+
71+
- name: Set Swap Space (Linux)
72+
uses: pierotofy/set-swap-space@master
73+
with:
74+
swap-size-gb: 12
75+
76+
# The Linux build will prepare a local Nexus staging repository
77+
# that includes all .jars except the CLI jar
78+
- name: Build and run tests
79+
run: |
80+
export MAVEN_OPTS="-Xmx4096m"
81+
# Required for reactor dependencies
82+
mvn clean install -DskipTests -Dmaven.javadoc.skip=true
83+
mvn versions:set -DnewVersion=${{ github.event.inputs.release_version }}
84+
mvn versions:commit
85+
86+
# Actual build of core SDK
87+
mvn -B -pl '!io.openmanufacturing:bamm-cli' clean deploy -Dmaven.wagon.httpconnectionManager.ttlSeconds=60 -DaltDeploymentRepository=local::default::file://nexus-staging -Psign
88+
# Build of CLI
89+
cd tools/bamm-cli
90+
mvn -B clean verify -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
91+
mvn -B verify -Pnative -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
92+
93+
# Create zip of bamm-cli
94+
cd tools/bamm-cli/target
95+
chmod a+x bamm
96+
tar cfvz bamm-cli-linux.tar.gz bamm
97+
98+
- name: Upload staging directory and Linux binary
99+
uses: actions/upload-artifact@v3
100+
with:
101+
name: linux-artifacts
102+
path: |
103+
nexus-staging/
104+
tools/bamm-cli/target/bamm-cli-linux.tar.gz
105+
tools/bamm-cli/target/bamm-cli-*.jar
106+
107+
# The Windows build will build the Windows-specific bamm-cli
108+
# and upload the binary binary to the build artifacts
109+
build-windows:
110+
name: Windows build
111+
needs: [check-preconditions]
112+
runs-on: windows-latest
113+
steps:
114+
- name: Checkout
115+
uses: actions/checkout@v3
116+
117+
- name: Setup JDK
118+
uses: graalvm/setup-graalvm@v1
119+
with:
120+
version: '22.3.1'
121+
java-version: '17'
122+
components: 'native-image,js'
123+
github-token: ${{ secrets.GITHUB_TOKEN }}
124+
native-image-job-reports: 'true'
125+
126+
- name: Cache Maven packages
127+
uses: actions/cache@v3
128+
with:
129+
path: ~/.m2/repository
130+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
131+
restore-keys: |
132+
${{ runner.os }}-maven-
133+
134+
- name: Configure Pagefile (Windows)
135+
# Fix for "LINK : fatal error LNK1171: unable to load mspdbcore.dll (error code: 1455)":
136+
# This seems to be caused by running out of memory; increasing page file
137+
# size suggested here:
138+
# https://github.com/actions/virtual-environments/issues/3420#issuecomment-861342418
139+
uses: al-cheb/[email protected]
140+
with:
141+
minimum-size: 16GB
142+
maximum-size: 16GB
143+
disk-root: "C:"
144+
145+
- name: Build and run tests
146+
run: |
147+
export MAVEN_OPTS="-Xmx4096m"
148+
# Required for reactor dependencies
149+
mvn clean install -DskipTests -Dmaven.javadoc.skip=true
150+
mvn versions:set -DnewVersion=${{ github.event.inputs.release_version }}
151+
mvn versions:commit
152+
153+
# Actual build of core SDK
154+
mvn -B -pl '!io.openmanufacturing:bamm-cli' clean install -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
155+
# Build of CLI
156+
cd tools/bamm-cli
157+
mvn -B clean verify -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
158+
mvn -B verify -Pnative -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
159+
shell: bash
160+
161+
- name: Upload Windows binary
162+
uses: actions/upload-artifact@v3
163+
with:
164+
name: windows-artifacts
165+
path: |
166+
tools/bamm-cli/target/bamm.exe
167+
tools/bamm-cli/target/*.dll
168+
tools/bamm-cli/target/lib/
169+
170+
release:
171+
needs: [build-linux, build-windows]
172+
runs-on: ubuntu-latest
173+
steps:
174+
# Need to checkout here too, so that we have the pom.xml
175+
# with the deployment info available
176+
- name: Checkout
177+
uses: actions/checkout@v3
178+
179+
- name: Set up JDK 17
180+
uses: actions/setup-java@v2
181+
with:
182+
distribution: 'temurin'
183+
java-version: '17'
184+
server-id: ossrh
185+
server-username: OSSRH_USERNAME
186+
server-password: OSSRH_TOKEN
187+
gpg-private-key: ${{ secrets.PGP_KEY }}
188+
gpg-passphrase: PGP_KEY_PASSWORD
189+
overwrite-settings: false
190+
191+
- name: Fetch Linux Artifacts
192+
uses: actions/download-artifact@v3
193+
with:
194+
name: linux-artifacts
195+
196+
- name: Fetch Windows Artifacts
197+
uses: actions/download-artifact@v3
198+
with:
199+
name: windows-artifacts
200+
201+
- name: Prepare release
202+
run: |
203+
# Create Windows CLI zip
204+
zip -9 -r bamm-cli-windows.zip bamm.exe *.dll lib/
205+
206+
# Full release: Maven Central
207+
- name: Release to OSSRH/Maven Central
208+
if: ${{ !contains( github.event.inputs.release_version, '-M' ) }}
209+
run: |
210+
mvn nexus-staging:deploy-staged-repository -DrepositoryDirectory=nexus-staging -Prelease-build
211+
env:
212+
# Workaround for https://issues.sonatype.org/browse/OSSRH-66257
213+
# as described in https://stackoverflow.com/a/70157413
214+
MAVEN_OPTS: --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.text=ALL-UNNAMED --add-opens=java.desktop/java.awt.font=ALL-UNNAMED
215+
216+
- name: Create release commit
46217
continue-on-error: true
47218
run: |
219+
git config user.name github-actions
220+
git config user.email [email protected]
221+
48222
release_version=${{ github.event.inputs.release_version }}
49223
release_branch_name=${release_version%.*}.x
50224
echo "release_branch_name=$release_branch_name" >> $GITHUB_ENV
51225
52226
git fetch
53227
git checkout -b $release_branch_name --track origin/$release_branch_name || true
54228
git checkout -b $release_branch_name
55-
- name: Set Maven version
56-
run: |
57-
mvn clean install -DskipTests -Dmaven.javadoc.skip=true -Dgpg.skip=true
229+
230+
# Set version in pom.xml files
231+
mvn clean install -DskipTests -Dmaven.javadoc.skip=true
58232
mvn versions:set -DnewVersion=${{ github.event.inputs.release_version }}
59233
mvn versions:commit
60-
- name: Set Antora version
61-
uses: mikefarah/yq@master
62-
with:
63-
cmd: yq eval -i '.version = "${{ github.event.inputs.release_version }}"' documentation/developer-guide/antora.yml
64-
- name: Commit version changes and push to upstream repository
65-
run: |
234+
# Set version in Antora module
235+
yq eval -i '.version = "${{ github.event.inputs.release_version }}"' documentation/developer-guide/antora.yml
236+
# Push changes
66237
git add .
67238
if git commit -m "Add version ${{ github.event.inputs.release_version}}"; then
68239
git push origin ${{ env.release_branch_name }}
69240
fi
70-
- name: Run tests and build
71-
run: mvn -B clean install
72241
73-
# release-build
74-
- name: Create GitHub release
242+
# Full release: Github
243+
- name: "Create Github release (full)"
75244
if: ${{ !contains( github.event.inputs.release_version, '-M' ) }}
76245
uses: softprops/action-gh-release@v1
77246
id: esmf_sdk_release
78-
with:
79-
body: "Release of ESMF SDK in version v${{ github.event.inputs.release_version }}."
247+
with:
248+
body: "Release version ${{ github.event.inputs.release_version }}."
80249
tag_name: v${{ github.event.inputs.release_version }}
81250
target_commitish: ${{ env.release_branch_name }}
82251
draft: false
83252
prerelease: false
84253
files: |
85-
**/target/*-${{ github.event.inputs.release_version }}.jar
254+
bamm-cli-windows.zip
255+
bamm-cli-linux.tar.gz
256+
bamm-cli-*.jar
86257
env:
87258
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
88-
- name: Publish to OSSRH
89-
if: ${{ !contains( github.event.inputs.release_version, '-M' ) }}
90-
run: mvn -B clean -pl '!esmf-sdk-test-report,!documentation,!tools/samm-cli' deploy -DskipTests -Prelease-build,sign
91-
env:
92-
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
93-
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
94-
PGP_KEY_PASSWORD: ${{ secrets.PGP_KEY_PASSWORD }}
95-
# Workaround for https://issues.sonatype.org/browse/OSSRH-66257
96-
# as described in https://stackoverflow.com/a/70157413
97-
MAVEN_OPTS: --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.text=ALL-UNNAMED --add-opens=java.desktop/java.awt.font=ALL-UNNAMED
98259

99-
# milestone-build
100-
- name: Create GitHub release
101-
if: contains( github.event.inputs.release_version, '-M' )
102-
uses: softprops/action-gh-release@v1
103-
id: esmf_sdk_milestone_release
104-
with:
105-
body: "Release of ESMF SDK in version v${{ github.event.inputs.release_version }}."
106-
tag_name: v${{ github.event.inputs.release_version }}
107-
target_commitish: ${{ env.release_branch_name }}
108-
draft: false
109-
prerelease: true
110-
files: |
111-
**/target/*-${{ github.event.inputs.release_version }}.jar
112-
env:
113-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
260+
# Milestone release: Write settings to deploy to Github repo
114261
- name: Write settings.xml
115262
if: contains( github.event.inputs.release_version, '-M' )
116263
uses: DamianReeves/[email protected]
@@ -140,9 +287,29 @@ jobs:
140287
</servers>
141288
</settings>
142289
write-mode: overwrite
290+
291+
# Milestone release: Maven deploy to Github
143292
- name: Publish to Github
144293
if: contains( github.event.inputs.release_version, '-M' )
145294
run: mvn -s ./settings.xml -B clean -pl '!esmf-sdk-test-report,!documentation,!tools/samm-cli' deploy -DskipTests -Pmilestone-build,sign
146295
env:
147296
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
148297
PGP_KEY_PASSWORD: ${{ secrets.PGP_KEY_PASSWORD }}
298+
299+
# Milestone release: Github
300+
- name: "Create Github release (milestone)"
301+
if: contains( github.event.inputs.release_version, '-M' )
302+
uses: softprops/action-gh-release@v1
303+
id: sds_sdk_release
304+
with:
305+
body: "Release version ${{ github.event.inputs.release_version }}."
306+
tag_name: v${{ github.event.inputs.release_version }}
307+
target_commitish: ${{ env.release_branch_name }}
308+
draft: false
309+
prerelease: true
310+
files: |
311+
bamm-cli-windows.zip
312+
bamm-cli-linux.tar.gz
313+
bamm-cli-*.jar
314+
env:
315+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

documentation/pom.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,18 @@
147147
</execution>
148148
</executions>
149149
</plugin>
150+
151+
<plugin>
152+
<groupId>org.apache.maven.plugins</groupId>
153+
<artifactId>maven-gpg-plugin</artifactId>
154+
<version>${maven-gpg-plugin-version}</version>
155+
<executions>
156+
<execution>
157+
<id>sign-artifacts</id>
158+
<phase>none</phase>
159+
</execution>
160+
</executions>
161+
</plugin>
150162
</plugins>
151163
</build>
152164
</project>

0 commit comments

Comments
 (0)