improve import scheme #4
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: Build | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
release: | |
types: | |
- published | |
jobs: | |
build: | |
# Set the job to run on the platform specified by the matrix below | |
runs-on: ${{ matrix.runner }} | |
# Define the build matrix for cross-compilation | |
strategy: | |
matrix: | |
include: | |
- name: linux-amd64 | |
runner: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
- name: win-amd64 | |
runner: windows-latest | |
target: x86_64-pc-windows-msvc | |
- name: macos-amd64 | |
runner: macos-latest | |
target: x86_64-apple-darwin | |
- name: macos-arm64 | |
runner: macos-latest | |
target: aarch64-apple-darwin | |
# The steps to run for each matrix item | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: "${{ matrix.target }}" | |
- name: Setup Cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Build Binary for Python | |
run: cargo build --release --target ${{ matrix.target }} | |
working-directory: ./python | |
npm_tarball: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodule: true | |
- run: rustup update | |
- uses: Swatinem/rust-cache@v2 | |
- name: Install wasm-pack for JS | |
run: cargo install wasm-pack || true | |
- name: Setup node for JS | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
cache: npm | |
cache-dependency-path: "./js/package.json" | |
#- name: Build for JS | |
# run: wasm-pack build --target bundler | |
# working-directory: ./js | |
- name: NPM packing | |
run: npm run pack | |
working-directory: ./js | |
- name: NPM upload | |
uses: actions/upload-artifact@v3 | |
with: | |
name: nanopub_rs_npm | |
path: ./js/pkg/*.tgz | |
# - run: npm run release | |
# working-directory: ./js/pkg | |
# env: | |
# NODE_AUTH_TOKE: ${{ secrets.NPM_TOKEN }} | |
# if: github.event_name == 'release' |