Skip to content

Rust

Rust #373

Workflow file for this run

name: Rust
env:
CARGO_TERM_COLOR: always
on:
pull_request:
branches: [ main, master ]
push:
branches-ignore: [ "beta*", "dev*", "next*" ]
tags: [ "nightly*", "v*.*.*" ]
release:
types: [created]
schedule:
- cron: "30 9 * * *" # 9:30am UTC
workflow_dispatch:
inputs:
publish:
default: true
description: 'Publish'
required: true
type: boolean
jobs:
build:
name: Build and Test
strategy:
matrix:
platform: [ macos-latest, ubuntu-latest, windows-latest ]
toolchain: [ stable, nightly ]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v3
- name: setup (langspace)
run: |
rustup update
rustup default ${{ matrix.toolchain }}
- name: Build
run: cargo build -F full --release -v --workspace
- name: Cache build
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target/release
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Test
run: cargo test --all -F full --release -v
- name: Bench
if: matrix.toolchain == 'nightly'
run: cargo bench --all -v
features:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && github.event_name == 'release' && github.event.action == 'created' || github.event.inputs.publish == 'true'
name: Publish (features)
needs: build
runs-on: ubuntu-latest
strategy:
matrix:
features: [ core, music, net, turing ]
env:
PACKAGE_NAME: ${{ github.event.repository.name }}-${{ matrix.features }}
steps:
- uses: actions/checkout@v3
- name: Publish (${{env.PACKAGE_NAME}})
run: cargo publish --all-features -v -p ${{env.PACKAGE_NAME}} --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
publish:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && github.event_name == 'release' && github.event.action == 'created' || github.event.inputs.publish == 'true'
name: Publish (sdk)
needs: features
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Publish (${{ github.event.repository.name }})
run: cargo publish --all-features -v -p ${{ github.event.repository.name }} --token ${{ secrets.CARGO_REGISTRY_TOKEN }}