Release 2.1.0 #296
Workflow file for this run
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
name: CI | |
on: | |
release: | |
types: [published] | |
push: | |
pull_request: | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
jobs: | |
build-javascript: | |
runs-on: ubuntu-latest | |
env: | |
working-directory: bindings/javascript | |
strategy: | |
matrix: | |
browser: ["firefox", "chrome", "electron"] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
- name: Install wasm-pack | |
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh | |
- uses: actions/setup-node@v1 | |
- name: Install dependencies | |
run: npm install | |
working-directory: ${{env.working-directory}} | |
- name: Build module | |
run: npm run build | |
working-directory: ${{env.working-directory}} | |
- name: Run Cypress tests | |
uses: cypress-io/github-action@v1 | |
with: | |
working-directory: ${{env.working-directory}} | |
start: npm run start_test_server | |
wait-on: "http://localhost:8080" | |
browser: ${{ matrix.browser }} | |
build-rust: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Cache cargo registry | |
uses: actions/cache@v1 | |
with: | |
path: ~/.cargo/registry | |
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} | |
- name: Cache cargo index | |
uses: actions/cache@v1 | |
with: | |
path: ~/.cargo/git | |
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} | |
- name: Cache cargo build | |
uses: actions/cache@v1 | |
with: | |
path: target | |
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }} | |
- uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --verbose | |
- run: rustup component add clippy | |
- uses: actions-rs/clippy-check@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
args: --all-features | |
- uses: actions-rs/cargo@v1 | |
with: | |
command: test | |
args: --verbose --all-features | |
build-python: | |
runs-on: ${{ matrix.os }} | |
env: | |
working-directory: bindings/python | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
python-version: [3.6, 3.7, 3.8] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v1 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install GSED (if needed) # needed by update_version.sh | |
if: github.event_name == 'release' && matrix.os == 'macos-latest' | |
run: | | |
brew install gnu-sed | |
- name: Update version (if release) # only needed for python since we store artifacts, others are rebuilt | |
if: github.event_name == 'release' | |
run: | | |
bash update_version.sh ${{ github.event.release.tag_name }} | |
- name: Install | |
run: | | |
python -m pip install --upgrade pip | |
make install | |
working-directory: ${{env.working-directory}} | |
- name: Build | |
run: | | |
make build | |
working-directory: ${{env.working-directory}} | |
- name: Test | |
run: | | |
make test | |
working-directory: ${{env.working-directory}} | |
- name: Upload wheel as artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: python-wheel | |
path: bindings/python/target/wheels/* | |
nightly-release: | |
runs-on: ubuntu-latest | |
needs: [build-javascript, build-rust, build-python] | |
if: github.ref == 'refs/heads/master' | |
steps: | |
- uses: actions/download-artifact@v2 | |
with: | |
name: python-wheel | |
path: python-wheel | |
- uses: "marvinpinto/action-automatic-releases@latest" | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
automatic_release_tag: "latest" | |
prerelease: true | |
title: "Nightly Build" | |
files: | | |
python-wheel/*.whl | |
publish: | |
runs-on: ubuntu-latest | |
needs: [build-javascript, build-rust, build-python] | |
if: github.event_name == 'release' | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install wasm-pack | |
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v1 | |
with: | |
python-version: 3.8 | |
- run: | | |
pip install twine==3.2 | |
- uses: actions/download-artifact@v2 | |
with: | |
name: python-wheel | |
path: python-wheel | |
- name: Update version | |
run: | | |
bash update_version.sh ${{ github.event.release.tag_name }} | |
- name: Run release script | |
run: | | |
bash release.sh | |
env: | |
CARGO_KEY: ${{ secrets.CARGO_KEY }} | |
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} | |
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }} | |
WHEEL_DIR: python-wheel | |
- uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: v${{ github.event.release.tag_name }} | |
branch: master |