-
-
Notifications
You must be signed in to change notification settings - Fork 3
193 lines (193 loc) · 7.02 KB
/
package.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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
on: [push, pull_request]
name: Build & publish
jobs:
build:
if: ${{ !contains(github.event.head_commit.message, 'skip ci') }}
runs-on: ubuntu-latest
env:
RELEASE_BRANCH: ${{ startsWith(github.event.ref, 'refs/heads/develop-') || startsWith(github.event.ref, 'refs/heads/release-') }}
steps:
- name: Check out source code
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Set up Rust
uses: dtolnay/rust-toolchain@nightly
with:
targets: wasm32-wasip1
- name: Install dependencies
run: |
python -m pip install --upgrade pip build
sudo apt-get update
sudo apt-get install flex bison ccache cmake libboost-program-options-dev libboost-filesystem-dev libboost-system-dev libboost-thread-dev libboost-python-dev
- name: Set up caching
uses: actions/cache@v4
with:
path: ~/.cache/ccache
key: nextpnr-${{ hashFiles('nextpnr-src', 'icestorm-src', 'prjtrellis-src', 'prjoxide-src', 'apycula-meta', 'build.sh') }}
restore-keys: |
nextpnr-${{ hashFiles('nextpnr-src', 'icestorm-src', 'prjtrellis-src', 'prjoxide-src', 'apycula-meta', 'build.sh') }}
nextpnr-
- name: Set up ccache
run: |
ccache --max-size=2G -z
- name: Build WASM binaries
run: |
MAKEFLAGS=-j$(nproc) ./build.sh
- name: Build Python artifacts
run: |
./package-pypi-ice40.sh
./package-pypi-ecp5.sh
./package-pypi-machxo2.sh
./package-pypi-nexus.sh
./package-pypi-gowin.sh
- name: Upload Python artifact
uses: actions/upload-artifact@v4
with:
name: dist-pypi
path: pypi-*/dist/
- name: Build JavaScript artifacts
run: |
./package-npmjs-ice40.sh
./package-npmjs-ecp5.sh
./package-npmjs-machxo2.sh
./package-npmjs-nexus.sh
- name: Upload JavaScript artifact
uses: actions/upload-artifact@v4
with:
name: dist-npmjs
path: npmjs-*/dist/
- name: Print ccache statistics
run: |
ccache -s
test-python:
needs: build
runs-on: ubuntu-latest
steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Download Python artifacts
uses: actions/download-artifact@v4
with:
name: dist-pypi
- name: Test iCE40 Python artifact
run: |
pip install pypi-ice40/dist/*.whl
yowasp-icepll -h || true
yowasp-icebram -h || true
yowasp-icemulti -h || true
yowasp-icepack -h || true
yowasp-iceunpack -h || true
yowasp-nextpnr-ice40 --help
yowasp-nextpnr-ice40 --hx8k --package ct256 --test
yowasp-nextpnr-ice40 --up5k --package sg48 --test
- name: Test ECP5 Python artifact
run: |
pip install pypi-ecp5/dist/*.whl
yowasp-ecppll --help || true
yowasp-ecpbram --help
yowasp-ecpmulti --help || true
yowasp-ecppack --help || true
yowasp-ecpunpack --help || true
yowasp-nextpnr-ecp5 --help
yowasp-nextpnr-ecp5 --um5g-25k --package CABGA381 --test
- name: Test MachXO2 Python artifact
run: |
pip install pypi-machxo2/dist/*.whl
yowasp-xo2pll --help || true
yowasp-xo2bram --help
yowasp-xo2multi --help || true
yowasp-xo2pack --help || true
yowasp-xo2unpack --help || true
yowasp-nextpnr-machxo2 --help
yowasp-nextpnr-machxo2 --device LCMXO2-1200HC-4SG32C --test
- name: Test Nexus Python artifact
run: |
pip install pypi-nexus/dist/*.whl
yowasp-prjoxide --help
yowasp-nextpnr-nexus --help
yowasp-nextpnr-nexus --device LIFCL-40-9BG400CES --test
- name: Test Gowin Python artifact
run: |
pip install pypi-gowin/dist/*.whl
yowasp-nextpnr-gowin --help
yowasp-nextpnr-gowin --device GW1N-LV1QN48C6/I5 --test
check: # group all `test (*)` workflows into one for the required status check
needs: [test-python]
if: ${{ always() && !contains(needs.*.result, 'cancelled') }}
runs-on: ubuntu-latest
steps:
- run: ${{ contains(needs.*.result, 'failure') && 'false' || 'true' }}
publish-python:
needs: check
runs-on: ubuntu-latest
environment: publish
permissions:
id-token: write
if: ${{ !contains(github.event.head_commit.message, 'skip py') }}
steps:
- name: Download Python artifacts
uses: actions/download-artifact@v4
with:
name: dist-pypi
path: dist-tree/
- name: Prepare artifacts for publishing
run: |
mkdir dist
find dist-tree -name '*.whl' -exec mv {} dist/ \;
- name: Publish wheels to Test PyPI
if: ${{ github.event_name == 'push' && startsWith(github.event.ref, 'refs/heads/develop') }}
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
- name: Publish wheels to PyPI
if: ${{ github.event_name == 'push' && startsWith(github.event.ref, 'refs/heads/release') }}
uses: pypa/gh-action-pypi-publish@release/v1
publish-javascript:
needs: check
runs-on: ubuntu-latest
environment: publish
permissions:
id-token: write
if: ${{ !contains(github.event.head_commit.message, 'skip js') }}
steps:
- name: Set up Node.js
uses: actions/setup-node@v4
with:
registry-url: 'https://registry.npmjs.org'
- name: Download JavaScript artifacts
uses: actions/download-artifact@v4
with:
name: dist-npmjs
path: dist/
- name: Publish package to NPM (dry run)
if: ${{ github.event_name == 'push' && startsWith(github.event.ref, 'refs/heads/develop') }}
run: for pkg in $(find dist -name '*.tgz'); do npm publish --access public file:$pkg --dry-run; done
- name: Publish package to NPM
if: ${{ github.event_name == 'push' && startsWith(github.event.ref, 'refs/heads/release') }}
run: for pkg in $(find dist -name '*.tgz'); do npm publish --access public file:$pkg ${{ github.event.ref == 'refs/heads/release' && '--tag latest' || '--tag release' }}; done
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_CONFIG_PROVENANCE: true
release:
needs: check
runs-on: ubuntu-latest
if: ${{ contains(github.event.head_commit.message, 'autorelease') && github.event_name == 'push' && startsWith(github.event.ref, 'refs/heads/develop') }}
steps:
- name: Check out source code
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.PUSH_TOKEN }}
- name: Update release branch
run: |
release_branch=${{ github.event.ref }}
release_branch=${release_branch/develop/release}
git push origin HEAD:${release_branch}