-
-
Notifications
You must be signed in to change notification settings - Fork 2
177 lines (177 loc) · 5.69 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
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.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip build
sudo apt update
sudo apt-get install flex bison ccache
- name: Set up caching
uses: actions/cache@v4
with:
path: ~/.cache/ccache
key: yosys-${{ hashFiles('yosys-src', 'SymbiYosys-src', 'build.sh') }}
restore-keys: |
yosys-${{ hashFiles('yosys-src', 'SymbiYosys-src', 'build.sh') }}
yosys-
- name: Set up ccache
run: |
ccache --max-size=2G -z
- name: Build WASM binaries
run: |
MAKEFLAGS=-j$(nproc) ./build.sh
- name: Build Python artifact
run: |
./package-pypi.sh
- name: Upload Python artifact
uses: actions/upload-artifact@v4
with:
name: dist-pypi
path: pypi/dist/
- name: Build JavaScript artifact
run: |
./package-npmjs.sh
cp npmjs/test/test_api.mjs npmjs/dist/
- 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
strategy:
matrix:
python-version:
- '3.8'
- '3.9'
- '3.10'
- '3.11'
- '3.12'
- '3.13'
- '3.14-dev'
steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Download Python artifact
uses: actions/download-artifact@v4
with:
name: dist-pypi
path: dist/
- name: Test Python artifact
run: |
pip install dist/*.whl
yowasp-yosys --help
yowasp-sby --help
yowasp-yosys-smtbmc --help
yowasp-yosys-witness --help
test-javascript:
needs: build
runs-on: ubuntu-latest
strategy:
matrix:
node-version:
- 'v18.x'
- 'v20.x'
steps:
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Download JavaScript artifact
uses: actions/download-artifact@v4
with:
name: dist-npmjs
path: dist/
- name: Test JavaScript artifact
run: |
npm install ./dist/*.tgz
node dist/test_api.mjs
check: # group all `test (*)` workflows into one for the required status check
needs: [test-python, test-javascript]
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 artifact
uses: actions/download-artifact@v4
with:
name: dist-pypi
path: 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 artifact
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: npm publish --access public $(find dist -name *.tgz -printf 'file:%p ') --dry-run
- name: Publish package to NPM
if: ${{ github.event_name == 'push' && startsWith(github.event.ref, 'refs/heads/release') }}
run: npm publish --access public $(find dist -name *.tgz -printf 'file:%p ') ${{ github.event.ref == 'refs/heads/release' && '--tag latest' || '--tag release' }}
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}