-
Notifications
You must be signed in to change notification settings - Fork 0
142 lines (119 loc) · 4.48 KB
/
main.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
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
name: Build
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
jobs:
build-and-test:
strategy:
matrix:
os-type: [Windows, Linux, macOS]
build-type: [Debug, Release]
arch-type: [x64, arm64]
include:
- os-type: Windows
runner-os: windows-2022
- os-type: Linux
runner-os: ubuntu-22.04
- os-type: macOS
runner-os: macos-12
runs-on: ${{ matrix.runner-os }}
steps:
- run: git config --global core.autocrlf false
- uses: actions/checkout@v4
- name: Run CMake and CTest
shell: bash
run: |
# ...
GENERATOR_FLAGS=""
CROSS_FLAGS=""
if [ "$RUNNER_OS" == "Windows" ]; then
choco install ninja
GENERATOR_FLAGS="-GNinja"
if [ "${{ matrix.arch-type }}" == "arm64" ]; then
CROSS_FLAGS="
-DCMAKE_SYSTEM_NAME=Windows
-DCMAKE_SYSTEM_PROCESSOR=arm64
-DCMAKE_C_COMPILER_TARGET=aarch64-windows-msvc
-DCMAKE_CXX_COMPILER_TARGET=aarch64-windows-msvc
"
fi
fi
if [ "$RUNNER_OS" == "Linux" ]; then
if [ "${{ matrix.arch-type }}" == "arm64" ]; then
sudo apt install gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu libstdc++-12-dev-arm64-cross
CROSS_FLAGS="
-DCMAKE_SYSTEM_NAME=Linux
-DCMAKE_SYSTEM_PROCESSOR=arm64
-DCMAKE_C_COMPILER_TARGET=aarch64-linux-gnu
-DCMAKE_CXX_COMPILER_TARGET=aarch64-linux-gnu
"
fi
fi
if [ "$RUNNER_OS" == "macOS" ]; then
if [ "${{ matrix.arch-type }}" == "arm64" ]; then
CROSS_FLAGS="
-DCMAKE_SYSTEM_NAME=Darwin
-DCMAKE_SYSTEM_PROCESSOR=arm64
-DCMAKE_C_COMPILER_TARGET=aarch64-apple-darwin
-DCMAKE_CXX_COMPILER_TARGET=aarch64-apple-darwin
"
fi
fi
cmake \
-S svf_tools \
-B .build \
${GENERATOR_FLAGS} \
${CROSS_FLAGS} \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }}
cmake --build .build
ctest --test-dir .build
- uses: actions/upload-artifact@v3
with:
name: svfc_${{ matrix.os-type }}_${{ matrix.arch-type }}_${{ matrix.build-type }}_r${{ github.run_id }}
path: .build/svfc*
if-no-files-found: error
- uses: actions/upload-artifact@v3
if: ${{ matrix.os-type == 'Linux' && matrix.arch-type == 'x64' && matrix.build-type == 'Release' }}
with:
name: svf_h_r${{ github.run_id }}
path: .build/custom/generated/svf.h
if-no-files-found: error
assemble-release-package:
runs-on: ubuntu-latest
needs: build-and-test
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
path: .artifacts
- name: Assemble package
shell: bash
run: |
# ...
mkdir -p .package/tools/Windows_x64/
mkdir -p .package/tools/Windows_arm64/
mkdir -p .package/tools/Linux_x64/
mkdir -p .package/tools/Linux_arm64/
mkdir -p .package/tools/macOS_x64/
mkdir -p .package/tools/macOS_arm64/
mkdir -p .package/runtime/src/
mkdir -p .package/runtime/single-file/
cp .artifacts/svfc_Windows_x64_Release_r*/svfc.exe .package/tools/Windows_x64/
cp .artifacts/svfc_Windows_arm64_Release_r*/svfc.exe .package/tools/Windows_arm64/
cp .artifacts/svfc_Linux_x64_Release_r*/svfc .package/tools/Linux_x64/
cp .artifacts/svfc_Linux_arm64_Release_r*/svfc .package/tools/Linux_arm64/
cp .artifacts/svfc_macOS_x64_Release_r*/svfc .package/tools/macOS_x64/
cp .artifacts/svfc_macOS_arm64_Release_r*/svfc .package/tools/macOS_arm64/
cp .artifacts/svf_h_r*/svf.h .package/runtime/single-file/
cp -r svf_runtime/src/* .package/runtime/src/
echo "Built at ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" >> .package/.build-info
- uses: actions/upload-artifact@v3
with:
name: svf_release-package_r${{ github.run_id }}
path: .package/**/*
if-no-files-found: error