-
Notifications
You must be signed in to change notification settings - Fork 10
134 lines (115 loc) · 3.56 KB
/
test.yml
File metadata and controls
134 lines (115 loc) · 3.56 KB
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
name: Lint and Test
on:
push:
branches: [main, release-v*]
pull_request:
branches: [main, release-v*]
# Cancel in-progress runs on new pushes to the same PR/branch
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
pull-requests: write
env:
SUI_VERSION: "1.72.2"
jobs:
setup:
name: Setup
runs-on: ubuntu-latest
timeout-minutes: 10
outputs:
packages: ${{ steps.set-matrix.outputs.packages }}
steps:
- name: Set package matrix
id: set-matrix
run: |
PACKAGES='["contracts/access", "math/core", "math/fixed_point"]'
echo "packages=$PACKAGES" >> $GITHUB_OUTPUT
- name: Cache Sui binary
id: cache-sui
uses: actions/cache@v4
with:
path: ~/.local/bin/sui
key: sui-${{ runner.os }}-${{ env.SUI_VERSION }}
- name: Install Sui CLI from binary
if: steps.cache-sui.outputs.cache-hit != 'true'
run: |
mkdir -p ~/.local/bin
curl -fLJ https://github.com/MystenLabs/sui/releases/download/mainnet-v${{ env.SUI_VERSION }}/sui-mainnet-v${{ env.SUI_VERSION }}-ubuntu-x86_64.tgz -o sui.tgz
tar -xzf sui.tgz
chmod +x sui
mv sui ~/.local/bin/
- name: Verify Sui installation
run: |
export PATH="$HOME/.local/bin:$PATH"
sui --version
check-move-formatting:
name: Move Formatter Check
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Check Move formatting
uses: MystenLabs/move-formatter-action@v1
with:
prettier-plugin-move-version: "latest"
working-directory: "."
pattern: "**/*.move"
write-changes: false
lint:
name: Lint ${{ matrix.package }}
needs: setup
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
fail-fast: true
matrix:
package: ${{ fromJson(needs.setup.outputs.packages) }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Restore Sui CLI
uses: ./.github/actions/restore-sui
with:
version: ${{ env.SUI_VERSION }}
- name: Lint
run: sui move build --lint --warnings-are-errors
working-directory: ./${{ matrix.package }}
- name: Lint tests
run: sui move build --test --lint --warnings-are-errors
working-directory: ./${{ matrix.package }}
test:
name: Test ${{ matrix.package }}
needs: [setup, lint]
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read
pull-requests: write
strategy:
fail-fast: true
matrix:
package: ${{ fromJson(needs.setup.outputs.packages) }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Restore Sui CLI
uses: ./.github/actions/restore-sui
with:
version: ${{ env.SUI_VERSION }}
- name: Run tests
run: sui move test --trace
working-directory: ./${{ matrix.package }}
- name: Generate Codecov report
run: sui move coverage lcov > lcov.info
working-directory: ./${{ matrix.package }}
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
file: ./${{ matrix.package }}/lcov.info
flags: ${{ matrix.package }}
name: ${{ matrix.package }}
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}