-
Notifications
You must be signed in to change notification settings - Fork 49
253 lines (215 loc) · 6.63 KB
/
java-ci.yml
File metadata and controls
253 lines (215 loc) · 6.63 KB
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
name: Build & Draft release
on:
push:
branches: [ master ]
workflow_dispatch:
permissions:
contents: write
actions: read
jobs:
build-java:
runs-on: ubuntu-latest
outputs:
sdmx_version: ${{ steps.read-version.outputs.sdmx_version }}
steps:
- name: Set up JDK 11 for x64
uses: actions/setup-java@v5.2.0
with:
java-version: '11'
distribution: 'temurin'
architecture: x64
- name: Setup Ant
uses: cedx/setup-ant@v6.1.0
with:
version: '1.10.9'
- name: Repository checkout
uses: actions/checkout@v6.0.2
- name: Build
run: |
cd JAVA && ant clean dist
- name: Read VERSION
id: read-version
run: |
echo "sdmx_version=$(tr -d '\r\n' < JAVA/VERSION)" >> "$GITHUB_OUTPUT"
- name: Create STATA / EXCEL tarballs
run: |
mkdir -p JAVA/dist
tar -C STATA -czf JAVA/dist/statasdmx.tar.gz .
tar -C EXCEL -czf JAVA/dist/excelsdmx.tar.gz .
- name: Upload SDMX JAR
uses: actions/upload-artifact@v7.0.0
with:
name: sdmx-jar
path: JAVA/dist/lib/SDMX.jar
archive: false
overwrite: true
if-no-files-found: error
- name: Upload STATA package
uses: actions/upload-artifact@v7.0.0
with:
name: statasdmx
path: JAVA/dist/statasdmx.tar.gz
archive: false
overwrite: true
if-no-files-found: error
- name: Upload EXCEL package
uses: actions/upload-artifact@v7.0.0
with:
name: excelsdmx
path: JAVA/dist/excelsdmx.tar.gz
archive: false
overwrite: true
if-no-files-found: error
test-r:
needs: build-java
runs-on: ubuntu-latest
steps:
- name: Set up JDK 11 for x64
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
architecture: x64
- name: Install R
uses: r-lib/actions/setup-r@v2
with:
r-version: '4.3.2'
- name: Checkout repository
uses: actions/checkout@v4
- name: Download SDMX JAR
uses: actions/download-artifact@v8.0.1
with:
name: SDMX.jar
path: RJSDMX/inst/java
- name: Apply VERSION
run: |
sed "s/%%VERSION%%/${{ needs.build-java.outputs.sdmx_version }}/" DESCRIPTION.template > RJSDMX/DESCRIPTION
- name: Setup tinytex for R manuals
uses: r-lib/actions/setup-tinytex@v2
- name: Setup R dependencies
uses: r-lib/actions/setup-r-dependencies@v2
with:
packages: deps::./RJSDMX
extra-packages: any::RUnit
- name: Build R package
run: |
R CMD build ./RJSDMX
TARBALL="$(find . -maxdepth 1 -type f -name 'RJSDMX*.tar.gz' -print -quit)"
if [ -z "${TARBALL}" ]; then exit 1; fi
R CMD check --as-cran --no-tests "${TARBALL}"
echo "TARBALL=${TARBALL}" >> "$GITHUB_ENV"
- name: Run R Tests
run: |
R CMD INSTALL "${TARBALL}"
Rscript -e "library(RUnit); library(RJSDMX); runTestFile('RJSDMX/R/test_automation/test.sdmx.r')"
- name: Upload R package artifact
uses: actions/upload-artifact@v7.0.0
with:
name: cran-package
path: ${{ env.TARBALL }}
archive: false
if-no-files-found: error
test-matlab:
needs: build-java
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6.0.2
with:
ref: ${{ github.sha }}
- name: Download SDMX JAR
uses: actions/download-artifact@v8.0.1
with:
name: SDMX.jar
path: MATLAB/files/lib
- name: Apply VERSION
run: |
echo "SDMX_VERSION=${{ needs.build-java.outputs.sdmx_version }}" >> "$GITHUB_ENV"
- name: Set up JDK 11 for x64
uses: actions/setup-java@v5.2.0
with:
java-version: '11'
distribution: 'temurin'
architecture: x64
- name: Set up MATLAB
uses: matlab-actions/setup-matlab@v3.0.1
with:
release: R2024a
cache: true
- name: Build and install toolbox
uses: matlab-actions/run-command@v3
with:
command: >
cd("MATLAB");
sdmx_ver = getenv("SDMX_VERSION");
fprintf("SDMX VERSION = %s", sdmx_ver);
build(sdmx_ver);
matlab.addons.toolbox.installToolbox("MatSDMX.mltbx");
- name: Run MATLAB tests
uses: matlab-actions/run-tests@v3
with:
source-folder: MATLAB/files
select-by-folder: MATLAB/files/test
test-results-junit: test-results/matlab-results.xml
- name: Upload MATLAB toolbox artifact
uses: actions/upload-artifact@v7.0.0
with:
name: matlab-toolbox
path: MATLAB/MatSDMX.mltbx
archive: false
if-no-files-found: error
draft-release:
needs: [build-java, test-r, test-matlab]
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v8.0.1
with:
path: release-assets
merge-multiple: true
- name: Update latest tag
uses: actions/github-script@v9
with:
script: |
const owner = context.repo.owner;
const repo = context.repo.repo;
const sha = context.sha;
try {
await github.rest.git.getRef({
owner,
repo,
ref: "tags/latest"
});
await github.rest.git.updateRef({
owner,
repo,
ref: "tags/latest",
sha,
force: true
});
} catch (error) {
if (error.status === 404) {
await github.rest.git.createRef({
owner,
repo,
ref: "refs/tags/latest",
sha
});
} else {
throw error;
}
}
- name: Create or update latest draft release
uses: ncipollo/release-action@v1.21.0
with:
tag: latest
name: latest
commit: ${{ github.sha }}
draft: true
allowUpdates: true
updateOnlyUnreleased: true
removeArtifacts: true
replacesArtifacts: true
makeLatest: false
artifacts: "release-assets/*"