Update dependencies. #665
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@v3 | |
with: | |
fetch-depth: 0 | |
submodules: true | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip build | |
sudo apt-get install flex bison ccache | |
- name: Set up caching | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/ccache | |
key: ${{ runner.os }}- | |
- name: Set up ccache | |
run: | | |
ccache --max-size=2G -z | |
- name: Build WASM binaries | |
run: | | |
./build.sh | |
- name: Build binary wheels | |
run: | | |
./package-pypi.sh | |
- name: Upload binary wheel artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheel | |
path: pypi/dist/ | |
- name: Print ccache statistics | |
run: | | |
ccache -s | |
test: | |
needs: build | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: | |
- '3.7' | |
- '3.8' | |
- '3.9' | |
- '3.10' | |
- '3.11' | |
- '3.12-dev' | |
steps: | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '${{ matrix.python-version }}' | |
- name: Download binary wheel artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: wheel | |
path: dist/ | |
- name: Test binary wheels | |
run: | | |
pip install dist/*.whl | |
yowasp-yosys --help | |
yowasp-sby --help | |
yowasp-yosys-smtbmc --help | |
yowasp-yosys-witness --help | |
check: # group all `test (*)` workflows into one for the required status check | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- run: | | |
true | |
publish: | |
needs: check | |
runs-on: ubuntu-latest | |
environment: publish | |
permissions: | |
id-token: write | |
steps: | |
- name: Download binary wheel artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: wheel | |
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 | |
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@v3 | |
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} |