Skip to content

[autorelease] Build picosat with optimizations. #17

[autorelease] Build picosat with optimizations.

[autorelease] Build picosat with optimizations. #17

Workflow file for this run

on: [push, pull_request]
name: Build & publish
jobs:
build:
if: ${{ !contains(github.event.head_commit.message, 'skip ci') }}
runs-on: ubuntu-latest
steps:
- name: Check out source code
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip build
sudo apt-get install flex bison ccache cmake
- name: Set up caching
uses: actions/cache@v3
with:
path: ~/.cache/ccache
key: boolector-${{ hashFiles('boolector', 'btor2tools', 'picosat-version', 'boolector.patch', 'btor2tools.patch', 'build.sh') }}
restore-keys: |
boolector-${{ hashFiles('boolector', 'btor2tools', 'picosat-version', 'boolector.patch', 'btor2tools.patch', 'build.sh') }}
boolector-
- name: Set up ccache
run: |
ccache --max-size=2G -z
- name: Build WASM binaries
run: |
./build.sh
- name: Build Python artifacts
run: |
./package-pypi.sh
- name: Upload Python artifact
uses: actions/upload-artifact@v3
with:
name: dist-pypi
path: pypi/dist/
- name: Build JavaScript artifact
run: |
./package-npmjs.sh
- name: Upload JavaScript artifact
uses: actions/upload-artifact@v3
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@v4
with:
python-version: '3.11'
- name: Download Python artifacts
uses: actions/download-artifact@v3
with:
name: dist-pypi
path: dist/
- name: Test boolector Python artifact
run: |
pip install dist/*.whl
yowasp-boolector --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@v3
with:
node-version: '${{ matrix.node-version }}'
- name: Download JavaScript artifact
uses: actions/download-artifact@v3
with:
name: dist-npmjs
path: dist/
- name: Test JavaScript artifact
run: |
npm install ./dist/*.tgz
node -e 'import("@yowasp/boolector").then(pkg => pkg.runBoolector(["--help"]))'
check: # group all `test (*)` workflows into one for the required status check
# Right now, only Python supported.
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 artifacts
uses: actions/download-artifact@v3
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@v3
with:
registry-url: 'https://registry.npmjs.org'
- name: Download JavaScript artifact
uses: actions/download-artifact@v3
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 ')
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@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}