-
Notifications
You must be signed in to change notification settings - Fork 67
143 lines (125 loc) · 4.32 KB
/
build-c-libraries.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
143
name: Build C Libraries
on:
push:
branches:
- main
release:
types: [published]
pull_request:
branches:
- '**'
concurrency:
# SHA is added to the end if on `main` to let all main workflows run
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/heads/long_lived/')) && github.sha || '' }}
cancel-in-progress: true
permissions:
contents: write
id-token: write
jobs:
build-c-libraries:
name: C Libraries - ${{ matrix.os.name }} ${{ matrix.arch.name }}
runs-on: ${{ matrix.os.runs-on[matrix.arch.matrix] }}
strategy:
fail-fast: false
matrix:
os:
- name: macOS
matrix: macos
runs-on:
arm: [macOS, ARM64]
intel: [macos-11]
- name: Ubuntu
matrix: ubuntu
runs-on:
arm: [Linux, ARM64]
intel: [ubuntu-latest]
- name: Windows
matrix: windows
runs-on:
intel: [windows-latest]
arch:
- name: ARM
matrix: arm
- name: Intel
matrix: intel
exclude:
# Only partial entries are required here by GitHub Actions so generally I
# only specify the `matrix:` entry. The super linter complains so for now
# all entries are included to avoid that. Reported at
# https://github.com/github/super-linter/issues/3016
- os:
name: Windows
matrix: windows
runs-on:
intel: [windows-latest]
arch:
name: ARM
matrix: arm
steps:
- name: Clean workspace
uses: Chia-Network/actions/clean-workspace@main
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set Env
uses: Chia-Network/actions/setjobenv@main
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout mpir for windows
if: matrix.os.matrix == 'windows'
uses: actions/checkout@v4
with:
repository: Chia-Network/mpir_gc_x64
fetch-depth: 1
path: mpir_gc_x64
- name: Build
working-directory: src
env:
BUILD_VDF_CLIENT: "N"
run: |
cmake . -DBUILD_CHIAVDFC=ON -DBUILD_PYTHON=OFF
cmake --build .
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: c-libraries-${{ matrix.os.matrix }}-${{ matrix.arch.matrix }}
path: ./src/lib
- name: Assemble directory of headers and libraries for distribution
shell: bash
run: |
DIST_DIR="chiavdfc-${{ matrix.os.matrix }}-${{ matrix.arch.matrix }}"
echo "DIST_DIR=$DIST_DIR" >> "$GITHUB_ENV"
mkdir -p ${DIST_DIR}/static ${DIST_DIR}/shared
cp src/c_bindings/c_wrapper.h ${DIST_DIR}/
find src/lib/static -type f -exec cp {} ${DIST_DIR}/static/ \;
find src/lib/shared -type f -exec cp {} ${DIST_DIR}/shared/ \;
- name: Zip (linux/mac)
if: runner.os != 'Windows'
run: |
zip -r chiavdfc-${{ matrix.os.matrix }}-${{ matrix.arch.matrix }}.zip ${{ env.DIST_DIR }}
- name: Zip (windows)
if: runner.os == 'Windows'
run: |
Compress-Archive -Path ${{ env.DIST_DIR }}/* -Destination chiavdfc-${{ matrix.os.matrix }}-${{ matrix.arch.matrix }}.zip
- name: Upload zip as artifact
uses: actions/upload-artifact@v4
with:
name: chiavdfc-${{ matrix.os.matrix }}-${{ matrix.arch.matrix }}
path: |
${{ github.workspace }}/chiavdfc-${{ matrix.os.matrix }}-${{ matrix.arch.matrix }}.zip
- name: Upload release artifacts
if: env.RELEASE == 'true'
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload \
$RELEASE_TAG \
chiavdfc-${{ matrix.os.matrix }}-${{ matrix.arch.matrix }}.zip
- uses: Chia-Network/actions/github/jwt@main
if: env.RELEASE == 'true'
- name: Notify new build
if: env.RELEASE == 'true'
run: |
curl -s -XPOST -H "Authorization: Bearer ${{ env.JWT_TOKEN }}" --data '{"release_version":"${{ env.RELEASE_TAG }}"}' ${{ secrets.GLUE_API_URL }}/api/v1/chiavdfc/trigger