Add rust-toolchain file and use new setup rust action (#20)

This commit is contained in:
Anatoly Laskaris 2022-09-09 16:35:48 +03:00 committed by GitHub
parent a406e626d6
commit b44a48b877
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 47 deletions

View File

@ -10,43 +10,36 @@ concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
jobs:
build:
name: "Build and test"
runs-on: builder
env:
RUST_TEST_THREADS: 1
CARGO_HOME: "${{ github.workspace }}/cargo"
env:
RUST_BACKTRACE: 1
RUST_TEST_THREADS: 1
CARGO_TERM_COLOR: always
jobs:
marine-rs-sdk-test:
name: "Run tests"
runs-on: builder
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
default: true
components: rustfmt, clippy
- name: Setup rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: "Cache rust"
uses: Swatinem/rust-cache@v1
- name: "cargo fmt"
- name: Run cargo fmt
run: cargo fmt --all -- --check
- name: "cargo build"
- name: Run cargo build
run: cargo build
- name: "cargo check"
- name: Run cargo check
run: cargo check -v --all-features
- name: "Run marine-test-macro-impl"
- name: Run cargo test in marine-test-macro-impl
run: cargo test
working-directory: crates/marine-test-macro-impl
- name: "cargo test"
- name: Run cargo test
run: cargo test --release --all-features --no-fail-fast
- name: "cargo clippy"
- name: Run cargo clippy
run: cargo clippy -Z unstable-options --all

View File

@ -7,34 +7,15 @@ jobs:
npm-publish:
name: "Publish release"
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Checkout repository
uses: actions/checkout@v2
### Prepare cargo & toolchains
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
~/.cargo/bin
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
profile: minimal
override: true
- uses: actions-rs/cargo@v1
with:
toolchain: nightly
command: update
args: --aggressive
- name: Setup rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
- run: cargo update --aggressive
- name: Install jq
run: sudo apt-get update && sudo apt-get --yes --force-yes install jq
@ -42,7 +23,6 @@ jobs:
- name: Install cargo-workspaces
run: cargo install cargo-workspaces || true
### === Rust package release ===
- name: Login to crates.io
run: cargo login ${{ secrets.CRATES_IO_TOKEN }}
@ -57,7 +37,6 @@ jobs:
- name: Publish to crates.io
run: cargo ws publish --no-git-commit --from-git --skip-published --yes
### Create a release
- name: Create Release
id: create_release
uses: actions/create-release@v1

3
rust-toolchain.toml Normal file
View File

@ -0,0 +1,3 @@
[toolchain]
channel = "nightly-2022-08-30"
targets = [ "x86_64-unknown-linux-gnu", "x86_64-apple-darwin", "wasm32-wasi" ]