-
Notifications
You must be signed in to change notification settings - Fork 1
91 lines (80 loc) · 2.51 KB
/
release.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
name: Release
on:
push:
tags:
- "*.*.*"
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true
jobs:
compile:
strategy:
fail-fast: false
matrix:
gcc: [ 12 ]
os: [ ubuntu, macos ]
version: [ '22.04', latest ]
exclude:
- os: ubuntu
version: latest
- os: windows
version: '22.04'
- os: macos
version: '22.04'
runs-on: ${{ matrix.os }}-${{ matrix.version }}
defaults:
run:
working-directory: native
steps:
- name: Setup repo
uses: actions/checkout@v4
- name: Setup GCC ${{ matrix.gcc }}
if: contains(matrix.os, 'ubuntu')
run: |
sudo apt update
sudo apt install gcc-${{ matrix.gcc }}
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${{ matrix.gcc }} 110
- name: Setup MSVC compiler
if: contains(matrix.os, 'windows')
uses: ilammy/msvc-dev-cmd@v1
- name: Compile to libsecretsharing
if: contains(matrix.os, 'ubuntu') || contains(matrix.os, 'macos')
run: |
gcc -c -fPIC -o bridge.o bridge.c
gcc -c -fPIC -o secret_sharing.o secret_sharing.c
gcc -shared -W -o libsecretsharing.so bridge.o secret_sharing.o
- name: Rename dynamic lib for macOS
if: contains(matrix.os, 'macos')
run: mv libsecretsharing.so libsecretsharing.dylib
- name: Compile to libsecretsharing.dll
if: contains(matrix.os, 'windows')
run: cl /LD bridge.c secret_sharing.c /link /EXPORT:secretsharing
- name: Upload build artifact
uses: actions/upload-artifact@v3
with:
name: release-${{ github.sha }}
path: |
./native/libsecretsharing.so
./native/libsecretsharing.dll
./native/libsecretsharing.dylib
if-no-files-found: error
retention-days: 1
publish:
needs: [ compile ]
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
environment: release
steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: release-${{ github.sha }}
- name: Publish release
uses: softprops/action-gh-release@v1
with:
files: |
libsecretsharing.so
libsecretsharing.dll
libsecretsharing.dylib