-
Notifications
You must be signed in to change notification settings - Fork 3
115 lines (102 loc) · 3.79 KB
/
build_maven_artefact.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
name: Build the QuantLib maven artefact
on:
push: { }
pull_request: { }
workflow_dispatch: { }
env:
QUANTLIB_VERSION: 1.37.0-SNAPSHOT
JAVA_PATH: java
JAVA_TARGET_PATH: java/target
JAVA_RESOURCES_NATIVE_LIBS_PATH: java/src/main/resources/native
jobs:
build-for-deploy:
name: Build for deployment (jdk${{ matrix.java-version }} on ${{ matrix.os }})
strategy:
fail-fast: false
matrix:
java-version:
- 17
os:
- macos-13
- windows-2019
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: "true"
- name: Build native library for ${{ runner.os }}
uses: ./.github/actions/build_native_library
with:
runner-name: ${{ matrix.os }}
java-version: ${{ matrix.java-version }}
gpg-secret-key: ${{ secrets.GPG_SECRET_KEY }}
gpg-secret-key-password: ${{ secrets.GPG_SECRET_KEY_PASSWORD }}
upload-path: ${{ env.JAVA_RESOURCES_NATIVE_LIBS_PATH }}
deploy-quantlib-snapshot:
name: Build for deployment (jdk${{ matrix.java-version }} on ${{ matrix.os }})
needs: [ build-for-deploy ]
permissions:
contents: read
packages: write
strategy:
fail-fast: true
matrix:
java-version:
- 17
os:
- ubuntu-20.04
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: "true"
- name: Download macOS native library
uses: actions/download-artifact@v4
with:
name: native-library-macOS
path: ${{ env.JAVA_RESOURCES_NATIVE_LIBS_PATH }}
- name: Download Windows native library
uses: actions/download-artifact@v4
with:
name: native-library-Windows
path: ${{ env.JAVA_RESOURCES_NATIVE_LIBS_PATH }}
- name: Delete native library artifacts
uses: geekyeggo/delete-artifact@v5
with:
name: native-library-*
failOnError: true
- name: Set up JDK ${{ matrix.java-version }}
uses: ./.github/actions/build_native_library/setup/jdk
with:
java-version: ${{ matrix.java-version }}
gpg-secret-key: ${{ secrets.GPG_SECRET_KEY }}
- name: Set the maven module version
working-directory: ${{ env.JAVA_PATH }}
run: |
./mvnw --batch-mode --show-version versions:set -DnewVersion=${{ env.QUANTLIB_VERSION }}
- name: Build native library for ${{ runner.os }} and jdk ${{ matrix.java-version }}
uses: ./.github/actions/build_native_library
with:
runner-name: ${{ matrix.os }}
java-version: ${{ matrix.java-version }}
gpg-secret-key: ${{ secrets.GPG_SECRET_KEY }}
gpg-secret-key-password: ${{ secrets.GPG_SECRET_KEY_PASSWORD }}
- name: Deploy the maven module
if: github.ref == 'refs/heads/master'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_SECRET_KEY_PASSWORD }}
MAVEN_CENTRAL_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_CENTRAL_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
working-directory: ${{ env.JAVA_PATH }}
run: |
./mvnw --batch-mode --show-version clean deploy -P enable-gpg-plugin
- name: Upload quantlib-${{ env.QUANTLIB_VERSION }}
uses: actions/upload-artifact@v4
with:
name: quantlib-${{ env.QUANTLIB_VERSION }}
if-no-files-found: error
path: |
${{ env.JAVA_TARGET_PATH }}/*.pom
${{ env.JAVA_TARGET_PATH }}/*.jar
${{ env.JAVA_TARGET_PATH }}/*.asc