-
Notifications
You must be signed in to change notification settings - Fork 26
139 lines (136 loc) · 4.24 KB
/
on_pull_request.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
name: "Check PR is ready for merge"
on:
pull_request:
branches:
- main
jobs:
changes:
runs-on: ubuntu-latest
permissions:
pull-requests: read
steps:
# For pull requests it's not necessary to checkout the code
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
rust:
- '.github/**'
- '/**/*.rs'
- '/**/Cargo.toml'
- '/**/Cargo.lock'
- '/**/rust-toolchain**'
- 'flake.nix'
- 'flake.lock'
go:
- '.github/**'
- '/**/*.go'
- '/**/go.mod'
- '/**/go.sum'
- '/**/gopkg.lock'
eth:
- '.github/**'
- '/**/*.sol'
- 'eth/foundry.toml'
- 'eth/justfile'
- 'eth/package.json'
outputs:
rust: ${{ steps.filter.outputs.rust }}
go: ${{ steps.filter.outputs.go }}
eth: ${{ steps.filter.outputs.eth }}
rust:
needs: changes
if: ${{ needs.changes.outputs.rust == 'true' }}
runs-on:
group: ubuntu-22.04-16core
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: "recursive"
- uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: Swatinem/rust-cache@v2
- name: "Install cargo-nextest"
uses: taiki-e/install-action@v2
with:
tool: nextest
- name: 📜 Lint code format
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
- name: "Build contracts"
run: make build-contracts
- name: "Ensure target dir exists"
run: mkdir -p target/near/near_da_blob_store
- name: "Run tests"
run: TEST_NEAR_ACCOUNT=${{ secrets.TEST_NEAR_ACCOUNT }} TEST_NEAR_SECRET=${{ secrets.TEST_NEAR_SECRET }} cargo nextest run --workspace --locked
# Nice to have, turned off for now
# - name: "Check for bloat"
# uses: orf/cargo-bloat-action@v1
# with:
# token: ${{ secrets.CEJAS_PERSONAL_ACCESS_TOKEN }}
go:
needs: changes
if: ${{ needs.changes.outputs.go == 'true' }}
runs-on:
group: ubuntu-22.04-8core
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: "recursive"
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: "Ubuntu is missing libm :<"
run: sudo apt-get update && sudo apt-get install -y build-essential
- name: "Install FFI library"
run: make da-rpc-sys
- run: sudo cp ./gopkg/da-rpc/lib/* /usr/local/lib
- name: "Test gopkg"
working-directory: ./gopkg/da-rpc
run: go test -v
eth-contracts:
needs: changes
if: ${{ needs.changes.outputs.eth == 'true' }}
runs-on:
group: ubuntu-22.04-8core
defaults:
run:
working-directory: ./eth
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
token: ${{ secrets.GITHUB_TOKEN }}
- name: "Install Foundry"
uses: "foundry-rs/foundry-toolchain@v1"
- name: "Install Bun"
uses: "oven-sh/setup-bun@v1"
- name: "Install the Node.js dependencies"
run: "bun install"
- name: "Lint the code"
run: "bun run lint"
- name: "Add lint summary"
run: |
echo "## Lint result" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY
- name: "Build the contracts and print their size"
run: "forge build --sizes"
- name: "Add build summary"
run: |
echo "## Build result" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY
- name: "Show the Foundry config"
run: "forge config"
- name: "Generate a fuzz seed that changes weekly to avoid burning through RPC allowance"
run: >
echo "FOUNDRY_FUZZ_SEED=$(
echo $(($EPOCHSECONDS - $EPOCHSECONDS % 604800))
)" >> $GITHUB_ENV
- name: "Run the tests"
run: "forge test --gas-report"
- name: "Add test summary"
run: |
echo "## Tests result" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY