-
Notifications
You must be signed in to change notification settings - Fork 9
144 lines (134 loc) · 4.1 KB
/
build.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
name: Build Quasar
on:
pull_request:
branches:
- main
- fix/*
push:
branches:
- main
- fix/*
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true
# This workflow makes x86_64 binaries for linux.
# TODO: add darwin later
jobs:
build-go:
name: quasar-${{ matrix.targetos }}-${{ matrix.arch }}
runs-on: ubuntu-latest
strategy:
matrix:
arch: [ amd64, arm64 ]
targetos: [ linux ]
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Get git diff
uses: technote-space/get-diff-action@v6.1.2
with:
PATTERNS: |
**/**.go
go.mod
go.sum
Makefile
.github/workflows/build.yml
- name: Setup Golang
uses: actions/setup-go@v4
with:
go-version: 1.20.7
env:
GOOS: ${{ matrix.targetos }}
GOARCH: ${{ matrix.arch }}
- name: Display go version
if: env.GIT_DIFF
run: go version
- name: Build quasarnoded
if: env.GIT_DIFF
run: make build-reproducible-${{ matrix.arch }}
- uses: actions/upload-artifact@v3
if: env.GIT_DIFF
with:
name: quasarnoded-${{ matrix.targetos }}-${{ matrix.arch }}
path: build/quasarnoded-${{ matrix.targetos }}-${{ matrix.arch }}
build-rust:
name: quasar-contracts-${{ matrix.targetos }}-${{ matrix.arch }}
runs-on: ubuntu-latest
strategy:
matrix:
arch: [ amd64, arm64 ]
targetos: [ linux ]
permissions:
contents: write
actions: write
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Get git diff
uses: technote-space/get-diff-action@v6.1.2
with:
PATTERNS: |
**/**.rs
Makefile
.github/workflows/build.yml
- name: Install just via cargo
run: cargo install just
- name: Download smart contracts dependencies
if: env.GIT_DIFF
run: |
cd smart-contracts
just download-deps
- name: Build smart contracts
if: env.GIT_DIFF
run: |
cd smart-contracts
just workspace-optimize
- uses: actions/upload-artifact@v3
if: env.GIT_DIFF
with:
name: smart-contracts
path: |
smart-contracts/artifacts/basic_vault.wasm
smart-contracts/artifacts/lp_strategy.wasm
smart-contracts/artifacts/cl_vault.wasm
smart-contracts/artifacts/merkle_incentives.wasm
test-test-tube:
runs-on: ubuntu-latest
needs: build-rust
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Get git diff
uses: technote-space/get-diff-action@v6.1.2
with:
PATTERNS: |
**/**.rs
Makefile
.github/workflows/build.yml
- name: Download contracts
if: env.GIT_DIFF
uses: actions/download-artifact@v3
with:
name:
smart-contracts
- name: Install Rust
if: env.GIT_DIFF
uses: dtolnay/rust-toolchain@stable
- name: Install just via cargo
run: cargo install just
# This is the new one
- name: Move smart contracts
if: env.GIT_DIFF
run: |
find . -name "*.wasm" -exec bash -c 'file="{}"; contract_name=$(basename "$file" .wasm); dir_name=$(echo "$contract_name" | sed "s/_/-/g"); mkdir -p "smart-contracts/contracts/$dir_name/test-tube-build/wasm32-unknown-unknown/release"; mv "$file" "smart-contracts/contracts/$dir_name/test-tube-build/wasm32-unknown-unknown/release/$contract_name.wasm"' \;
- name: Download smart contracts dependencies
if: env.GIT_DIFF
run: |
cd smart-contracts
just download-deps
- name: Run test-tube tests
if: env.GIT_DIFF
run: cd smart-contracts && cargo test -- --include-ignored --test-threads=1
env:
PROPTEST_CASES: 10