-
Notifications
You must be signed in to change notification settings - Fork 11
155 lines (144 loc) · 5.01 KB
/
ci.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
144
145
146
147
148
149
150
151
152
153
154
155
name: ci
on: [push, pull_request]
env:
RUSTFLAGS: "-Dwarnings"
RUST_BACKTRACE: 1
jobs:
build-rust:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
workspaces: "expander_compiler -> expander_compiler/target"
# The prefix cache key, this can be changed to start a new cache manually.
prefix-key: "mpi-v5.0.5" # update me if brew formula changes to a new version
- if: matrix.os == 'macos-latest'
run: brew install openmpi
- if: matrix.os == 'ubuntu-latest'
run: sudo apt-get update && sudo apt-get install libopenmpi-dev -y
- name: Build
run: cargo build --release
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: build-${{ matrix.os }}
path: target/release/libec_go_lib.*
upload-rust:
needs: [build-rust, test-rust, test-rust-avx512, lint]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: ./artifacts
pattern: build-*
merge-multiple: true
- name: Push built libs to another branch
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git checkout --orphan rust-built-libs
cp artifacts/libec_go_lib.* ./
rm ./libec_go_lib.d
git rm --cached -r .
git add ./libec_go_lib.* -f
git commit -m "Add built libs"
git push -f --set-upstream origin rust-built-libs
test-rust:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: styfle/[email protected]
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
workspaces: "expander_compiler -> expander_compiler/target"
# The prefix cache key, this can be changed to start a new cache manually.
prefix-key: "mpi-v5.0.5" # update me if brew formula changes to a new version
- if: matrix.os == 'macos-latest'
run: brew install openmpi
- if: matrix.os == 'ubuntu-latest'
run: sudo apt-get update && sudo apt-get install libopenmpi-dev -y
- run: cargo test
test-rust-avx512:
runs-on: 7950x3d
steps:
- uses: styfle/[email protected]
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
workspaces: "expander_compiler -> expander_compiler/target"
# The prefix cache key, this can be changed to start a new cache manually.
prefix-key: "mpi-v5.0.5" # update me if brew formula changes to a new version
- run: RUSTFLAGS="-C target-cpu=native -C target-feature=+avx512f" cargo test
test-go:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
needs: build-rust
steps:
- uses: styfle/[email protected]
- uses: actions/checkout@v4
- name: Setup Go 1.21.x
uses: actions/setup-go@v5
with:
go-version: '1.21.x'
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: ./artifacts
pattern: build-${{ matrix.os }}
merge-multiple: true
- if: matrix.os == 'macos-latest'
run: brew install openmpi
- if: matrix.os == 'ubuntu-latest'
run: sudo apt-get update && sudo apt-get install libopenmpi-dev -y
- run: |
mkdir -p ~/.cache/ExpanderCompilerCollection
cp artifacts/libec_go_lib.* ~/.cache/ExpanderCompilerCollection
cd ecgo
go test ./test/
test-go-keccak-full:
runs-on: ubuntu-latest
needs: build-rust
steps:
- uses: styfle/[email protected]
- uses: actions/checkout@v4
- name: Setup Go 1.21.x
uses: actions/setup-go@v5
with:
go-version: '1.21.x'
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: ./artifacts
pattern: build-ubuntu-latest
merge-multiple: true
- run: |
sudo apt-get update && sudo apt-get install libopenmpi-dev -y
mkdir -p ~/.cache/ExpanderCompilerCollection
cp artifacts/libec_go_lib.* ~/.cache/ExpanderCompilerCollection
cd ecgo
go run examples/keccak_full/main.go
lint:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- run: brew install openmpi
- run: cargo fmt --all -- --check
- run: cargo clippy