-
Notifications
You must be signed in to change notification settings - Fork 2
136 lines (111 loc) · 4.69 KB
/
Copy pathci.yml
File metadata and controls
136 lines (111 loc) · 4.69 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
135
136
---
name: CI
"on":
pull_request:
push:
branches:
- main
jobs:
lint-type-test:
name: Lint, Type, Test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, ubuntu-24.04-arm, macos-14]
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-python@v5
with:
python-version: "3.11"
# Node is required to install and run the explicit Prettier check in CI.
- uses: actions/setup-node@v4
with:
node-version: "lts/*"
- name: Create venv and install dev dependencies
run: |
python -m venv .venv
echo "$GITHUB_WORKSPACE/.venv/bin" >> "$GITHUB_PATH"
.venv/bin/python -m pip install --upgrade pip
.venv/bin/python -m pip install -e ".[dev]"
- name: Install formatting tools
run: |
npm install --global prettier@4.0.0-alpha.8
.venv/bin/python -m pip install yamllint==1.35.1
- name: Install Rust toolchain
run: |
curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
"$HOME/.cargo/bin/rustc" --version
"$HOME/.cargo/bin/cargo" --version
- name: Restore greenfloor-native wheel cache
id: cache-native-wheel
uses: actions/cache/restore@v4
with:
path: ./.cache/wheelhouse/greenfloor-native
key: native-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('greenfloor-native/**') }}
- name: Build greenfloor-native wheel (cache miss)
if: steps.cache-native-wheel.outputs.cache-hit != 'true'
run: |
mkdir -p ./.cache/wheelhouse/greenfloor-native
.venv/bin/python -m pip install maturin
.venv/bin/python -m maturin build \
--manifest-path greenfloor-native/Cargo.toml \
--out ./.cache/wheelhouse/greenfloor-native
- name: Save greenfloor-native wheel cache
if: steps.cache-native-wheel.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: ./.cache/wheelhouse/greenfloor-native
key: native-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('greenfloor-native/**') }}
- name: Install greenfloor-native wheel
run: |
.venv/bin/python -m pip install ./.cache/wheelhouse/greenfloor-native/*.whl
- name: Ruff lint
run: ruff check .
- name: Ruff format check
run: ruff format --check .
- name: Prettier check
run: prettier --check "**/*.{md,json,yml,yaml}" --ignore-path .prettierignore
- name: Yamllint
run: yamllint .
- name: Pyright
run: pyright
- name: Pytest
run: pytest --ignore=tests/test_chia_wallet_sdk_simulator_harness.py
- name: Resolve chia-wallet-sdk pinned commit
if: matrix.os == 'ubuntu-latest'
id: sdk
run: |
echo "sha=$(git rev-parse HEAD:chia-wallet-sdk)" >> "$GITHUB_OUTPUT"
- name: Restore chia-wallet-sdk wheelhouse cache
if: matrix.os == 'ubuntu-latest'
id: cache-sdk-wheelhouse
uses: actions/cache/restore@v4
with:
path: ./.cache/wheelhouse/chia-wallet-sdk
key: sdk-wheelhouse-${{ runner.os }}-${{ runner.arch }}-${{ steps.sdk.outputs.sha }}
- name: Build chia-wallet-sdk wheel (cache miss)
if: matrix.os == 'ubuntu-latest' && steps.cache-sdk-wheelhouse.outputs.cache-hit != 'true'
run: |
mkdir -p ./.cache/wheelhouse/chia-wallet-sdk
.venv/bin/python -m pip wheel \
--wheel-dir ./.cache/wheelhouse/chia-wallet-sdk \
./chia-wallet-sdk/pyo3
- name: Save chia-wallet-sdk wheelhouse cache
if: matrix.os == 'ubuntu-latest' && steps.cache-sdk-wheelhouse.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: ./.cache/wheelhouse/chia-wallet-sdk
key: sdk-wheelhouse-${{ runner.os }}-${{ runner.arch }}-${{ steps.sdk.outputs.sha }}
- name: Install chia-wallet-sdk for native integration tests
if: matrix.os == 'ubuntu-latest'
run: .venv/bin/python -m pip install ./.cache/wheelhouse/chia-wallet-sdk/*.whl
- name: Pytest (greenfloor-native integration on Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: GREENFLOOR_RUN_NATIVE_INTEGRATION_TESTS=1 pytest -vv -s tests/test_greenfloor_native_integration.py
- name: Pytest (chia-wallet-sdk simulator harness on Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: GREENFLOOR_RUN_SDK_SIM_TESTS_FULL=1 pytest -vv -s tests/test_chia_wallet_sdk_simulator_harness.py