-
Notifications
You must be signed in to change notification settings - Fork 0
99 lines (85 loc) · 2.79 KB
/
ci.yml
File metadata and controls
99 lines (85 loc) · 2.79 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
name: CI
on:
push:
branches: [main]
tags: [v*]
pull_request:
branches: [main]
permissions:
attestations: write
contents: write
id-token: write
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, ubuntu-24.04-arm]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
- name: Set env
run: |
echo "QUANTLIB_VERSION=$(cat quantlib-version)" >> $GITHUB_ENV
if [ "${{ matrix.os }}" = 'ubuntu-24.04' ]; then
echo "DOCKER_ARCH=amd64" >> $GITHUB_ENV
echo "RELEASE_ARCH=x86_64" >> $GITHUB_ENV
elif [ "${{ matrix.os }}" = 'ubuntu-24.04-arm' ]; then
echo "DOCKER_ARCH=arm64" >> $GITHUB_ENV
echo "RELEASE_ARCH=aarch64" >> $GITHUB_ENV
fi
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: false
target: export
platforms: linux/${{ env.DOCKER_ARCH }}
outputs: type=local,dest=./output
- name: Copy artifacts
if: github.event_name == 'push'
run: |
mkdir -p artifacts
cp "output/build/quantlib-${{ env.QUANTLIB_VERSION }}.jar" "artifacts/${{ env.RELEASE_ARCH }}-quantlib-${{ env.QUANTLIB_VERSION }}.jar"
cp "output/build/quantlib-${{ env.QUANTLIB_VERSION }}.pom" "artifacts/${{ env.RELEASE_ARCH }}-quantlib-${{ env.QUANTLIB_VERSION }}.pom"
- name: Attest artifacts
if: github.event_name == 'push'
uses: actions/attest@v4
with:
subject-path: 'artifacts/*'
- name: Upload artifacts
if: github.event_name == 'push'
uses: actions/upload-artifact@v6
with:
name: ${{ env.RELEASE_ARCH }}-quantlib-${{ env.QUANTLIB_VERSION }}
path: artifacts/
if-no-files-found: error
retention-days: 2
release:
needs: [build]
if: startsWith(github.ref, 'refs/tags/v') && github.event_name == 'push'
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
- name: Set env
run: |
echo "QUANTLIB_VERSION=$(cat quantlib-version)" >> $GITHUB_ENV
- name: Download x86_64 artifacts
uses: actions/download-artifact@v8
with:
name: x86_64-quantlib-${{ env.QUANTLIB_VERSION }}
path: artifacts/
- name: Download aarch64 artifacts
uses: actions/download-artifact@v8
with:
name: aarch64-quantlib-${{ env.QUANTLIB_VERSION }}
path: artifacts/
- name: Create Release
uses: softprops/action-gh-release@v2
with:
draft: true
files: artifacts/*
fail_on_unmatched_files: true