Update dependencies. #721
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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} |