Repository navigation
125 lines (108 loc) · 3.83 KB
/
Copy pathci.yml
File metadata and controls
125 lines (108 loc) · 3.83 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
name: CI
on:
push:
branches:
- main
tags:
- "v*"
pull_request:
workflow_dispatch:
permissions:
contents: write
jobs:
build:
name: ${{ matrix.name }}
runs-on: ${{ matrix.runner }}
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
include:
- name: Windows x86_64
runner: windows-latest
package: softsdf-windows-x86_64
- name: Linux x86_64
runner: ubuntu-latest
package: softsdf-linux-x86_64
- name: macOS ARM64
runner: macos-14
package: softsdf-macos-arm64
steps:
- name: Checkout SoftSDF
uses: actions/checkout@v4
- name: Checkout latest GmSSL
run: git clone --depth 1 --branch v3.2.0 https://github.com/guanzhi/GmSSL.git "$RUNNER_TEMP/gmssl-src"
- name: Configure GmSSL static library
run: |
gmssl_link_flags=()
if [[ "$RUNNER_OS" == "Windows" ]]; then
gmssl_link_flags+=("-DCMAKE_EXE_LINKER_FLAGS=Advapi32.lib")
gmssl_link_flags+=("-DCMAKE_SHARED_LINKER_FLAGS=Advapi32.lib")
fi
cmake -S "$RUNNER_TEMP/gmssl-src" -B "$RUNNER_TEMP/gmssl-build" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="$RUNNER_TEMP/gmssl-install" \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-DENABLE_SDF=ON \
-DENABLE_SM4_ECB=ON \
-DENABLE_SM4_CFB=ON \
-DENABLE_SM4_OFB=ON \
-DENABLE_SM4_CBC_MAC=ON \
"${gmssl_link_flags[@]}"
- name: Build GmSSL
run: cmake --build "$RUNNER_TEMP/gmssl-build" --config Release --parallel 4
- name: Install GmSSL
run: cmake --install "$RUNNER_TEMP/gmssl-build" --config Release
- name: Configure SoftSDF
run: |
softsdf_gmssl_args=("-DGmSSL_ROOT_DIR=$RUNNER_TEMP/gmssl-install")
if [[ "$RUNNER_OS" == "Windows" ]]; then
softsdf_gmssl_args=(
"-DGmSSL_INCLUDE_DIR=$RUNNER_TEMP/gmssl-src/include"
"-DGmSSL_LIBRARY=$RUNNER_TEMP/gmssl-build/bin/Release/gmssl.lib"
"-DGmSSL_GMSSL_EXECUTABLE=$RUNNER_TEMP/gmssl-build/bin/Release/gmssl.exe"
)
fi
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="$RUNNER_TEMP/${{ matrix.package }}" \
"${softsdf_gmssl_args[@]}"
- name: Build SoftSDF
run: cmake --build build --config Release --parallel 4
- name: Test SoftSDF with GmSSL
run: ctest --test-dir build -C Release --output-on-failure
- name: Install SoftSDF package
run: cmake --install build --config Release
- name: Add licenses
run: |
mkdir -p "$RUNNER_TEMP/${{ matrix.package }}/licenses"
cp LICENSE "$RUNNER_TEMP/${{ matrix.package }}/licenses/SoftSDF-LICENSE"
cp "$RUNNER_TEMP/gmssl-src/LICENSE" "$RUNNER_TEMP/${{ matrix.package }}/licenses/GmSSL-LICENSE"
- name: Create archive
run: |
cmake -E chdir "$RUNNER_TEMP" cmake -E tar cf "${{ matrix.package }}.zip" --format=zip \
"${{ matrix.package }}"
- name: Upload binary artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.package }}
path: ${{ runner.temp }}/${{ matrix.package }}.zip
if-no-files-found: error
release:
name: Release
needs: build
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- name: Download binary artifacts
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: Publish GitHub Release
uses: softprops/action-gh-release@v2
with:
files: dist/*.zip