chore(CI): add rust-toolchain file, use better CI actions for rust (#214)

This commit is contained in:
Valery Antopol 2022-09-16 16:10:02 +03:00 committed by GitHub
parent 684bf7cb38
commit 068dab124c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 50 additions and 100 deletions

View File

@ -10,66 +10,61 @@ concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
jobs:
air:
name: "Run marine tests"
runs-on: builder
env:
RUST_BACKTRACE: 1
CARGO_TERM_COLOR: always
env:
RUST_BACKTRACE: 1
CARGO_TERM_COLOR: always
jobs:
marine:
name: "Run tests"
runs-on: builder
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2022-06-29
target: wasm32-wasi
components: rustfmt, clippy
- name: Setup rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: actions/setup-node@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 16
- name: "Cache rust"
uses: Swatinem/rust-cache@v1
- name: "Install wasm-pack"
- name: Install wasm-pack
run: cargo install wasm-pack
- name: "Install marine cli"
- name: Install marine cli
run: cargo install --path tools/cli
- name: "cargo fmt"
- name: Run cargo fmt
run: cargo fmt --all -- --check
- name: "Build marine-js"
- name: Build marine-js wasm
run: ./build.sh
working-directory: marine-js
- name: "Install marine-js npm dependencies"
- name: Install marine-js npm dependencies
uses: bahmutov/npm-install@v1
with:
working-directory: marine-js/npm-package
- name: "Build marine-js npm package"
- name: Build marine-js npm package
run: npm run build
working-directory: marine-js/npm-package
- name: "Build exampes"
- name: Build examples
run: ./build.sh
working-directory: examples
- name: "Build marine wasm-tests"
- name: Build marine-runtime wasm-tests
run: ./build.sh
working-directory: marine/tests/wasm_tests
- name: "Build core wasm-tests"
- name: Build marine-core wasm-tests
run: ./build.sh
working-directory: core/tests/wasm_tests
- name: "cargo check"
- name: Run cargo check
run: |
cargo check -v --all-features \
-p marine-core \
@ -78,7 +73,7 @@ jobs:
-p marine \
-p mrepl
- name: "cargo test"
- name: Run cargo test
run: |
cargo test --release -v --all-features \
-p marine-core \
@ -87,9 +82,9 @@ jobs:
-p marine \
-p mrepl \
- name: "cargo clippy"
- name: Run cargo clippy
run: cargo clippy -v
- name: "npm test marine-js"
- name: Run marine-js Node tests
run: npm run test
working-directory: marine-js/npm-package

View File

@ -30,26 +30,10 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v2
### Prepare cargo & toolchains
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
~/.cargo/bin
key: ${{ runner.os }}-cargo-v2-${{ hashFiles('**/Cargo.lock') }}
- name: Install Rust toolchain with wasm32-unknown-unknown
uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2022-03-20
target: wasm32-unknown-unknown
profile: minimal
override: true
- uses: actions-rs/cargo@v1
with:
toolchain: nightly-2022-03-20
command: update
args: --aggressive
- name: Setup rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
- run: cargo update --aggressive
### Calculate FINAL_VERSION
- name: Install jq & sponge
@ -128,17 +112,18 @@ jobs:
npm i
npm run build
### Set version to FINAL_VERSION
- run: yarn version --new-version ${{ env.FINAL_VERSION }} --no-git-tag-version || true
- name: Set version to FINAL_VERSION
run: yarn version --new-version ${{ env.FINAL_VERSION }} --no-git-tag-version || true
working-directory: marine-js/npm-package
### Publish to NPM registry
- uses: actions/setup-node@v1
- name: Setup node
uses: actions/setup-node@v1
with:
node-version: "16"
registry-url: "https://registry.npmjs.org"
- run: npm publish --access public --tag=beta
- name: Publish to NPM registry
run: npm publish --access public --tag=beta
working-directory: marine-js/npm-package
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

View File

@ -20,27 +20,10 @@ jobs:
- 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-v2-${{ hashFiles('**/Cargo.lock') }}
- name: Install Rust toolchain with wasm32-unknown-unknown
uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2022-03-20
target: wasm32-unknown-unknown
profile: minimal
override: true
- uses: actions-rs/cargo@v1
with:
toolchain: nightly-2022-03-20
command: update
args: --aggressive
- name: Setup rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
- run: cargo update --aggressive
### Calculate FINAL_VERSION
- name: Install jq & sponge
@ -103,18 +86,18 @@ jobs:
npm i
npm run build
### Set version
- name: Set version to ${{ env.FINAL_VERSION }}
run: yarn version --new-version ${{ env.FINAL_VERSION }} --no-git-tag-version
working-directory: marine-js/npm-package
### Publish to NPM registry
- uses: actions/setup-node@v1
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: "16"
registry-url: "https://registry.npmjs.org"
- run: npm publish --access public
- name: Publish to NPM registry
run: npm publish --access public
working-directory: marine-js/npm-package
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

View File

@ -17,29 +17,13 @@ jobs:
- 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 cargo-workspaces
run: cargo install cargo-workspaces || true
run: cargo install cargo-workspaces
### === Rust package release ===
- name: Login to crates.io

3
rust-toolchain.toml Normal file
View File

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