chore(ci): enable rust conditional check (#790)
This commit is contained in:
parent
58e0165098
commit
3c4ef490a8
49
.github/workflows/ci.yaml
vendored
49
.github/workflows/ci.yaml
vendored
@ -1,4 +1,4 @@
|
|||||||
name: CI
|
name: Lua CI
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@ -13,8 +13,8 @@ jobs:
|
|||||||
name: Check Lua style
|
name: Check Lua style
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # ratchet:actions/checkout@v4
|
||||||
- uses: JohnnyMorganz/stylua-action@v4
|
- uses: JohnnyMorganz/stylua-action@b6661824b86c9c33121bed87a778b660ba90cf77 # ratchet:JohnnyMorganz/stylua-action@v4
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
version: latest
|
version: latest
|
||||||
@ -24,47 +24,8 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # ratchet:actions/checkout@v4
|
||||||
- name: Luacheck linter
|
- name: Luacheck linter
|
||||||
uses: lunarmodules/luacheck@v1
|
uses: lunarmodules/luacheck@cc089e3f65acdd1ef8716cc73a3eca24a6b845e4 # ratchet:lunarmodules/luacheck@v1
|
||||||
with:
|
with:
|
||||||
args: ./lua/
|
args: ./lua/
|
||||||
rust-tests:
|
|
||||||
name: Run Rust tests
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
if: github.event_name == 'push' || contains(github.event.pull_request.files.*.path, 'crates/') || contains(github.event.pull_request.files.*.path, '.cargo/')
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- uses: Swatinem/rust-cache@v2
|
|
||||||
- uses: dtolnay/rust-toolchain@master
|
|
||||||
with:
|
|
||||||
toolchain: stable
|
|
||||||
components: clippy, rustfmt
|
|
||||||
- name: Run rust tests
|
|
||||||
run: cargo test --features luajit
|
|
||||||
rust:
|
|
||||||
name: Check Rust style
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
if: github.event_name == 'push' || contains(github.event.pull_request.files.*.path, 'crates/') || contains(github.event.pull_request.files.*.path, '.cargo/')
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- uses: Swatinem/rust-cache@v2
|
|
||||||
- uses: dtolnay/rust-toolchain@master
|
|
||||||
with:
|
|
||||||
toolchain: stable
|
|
||||||
components: clippy, rustfmt
|
|
||||||
- name: Run rustfmt
|
|
||||||
run: make ruststylecheck
|
|
||||||
rustlint:
|
|
||||||
name: Lint Rust
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
if: github.event_name == 'push' || contains(github.event.pull_request.files.*.path, 'crates/') || contains(github.event.pull_request.files.*.path, '.cargo/')
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- uses: Swatinem/rust-cache@v2
|
|
||||||
- uses: dtolnay/rust-toolchain@master
|
|
||||||
with:
|
|
||||||
toolchain: "1.80.1"
|
|
||||||
components: clippy, rustfmt
|
|
||||||
- name: Run rustfmt
|
|
||||||
run: make rustlint
|
|
||||||
|
24
.github/workflows/release.yaml
vendored
24
.github/workflows/release.yaml
vendored
@ -2,11 +2,11 @@ name: Release
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags: [ v\d+\.\d+\.\d+ ]
|
tags: [v\d+\.\d+\.\d+]
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
packages: write
|
packages: write
|
||||||
|
|
||||||
env:
|
env:
|
||||||
CARGO_TERM_COLOR: always
|
CARGO_TERM_COLOR: always
|
||||||
@ -22,11 +22,11 @@ jobs:
|
|||||||
release_body: "${{ steps.tag.outputs.message }}"
|
release_body: "${{ steps.tag.outputs.message }}"
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # ratchet:actions/checkout@v4
|
||||||
|
|
||||||
- name: Get version
|
- name: Get version
|
||||||
id: get_version
|
id: get_version
|
||||||
uses: battila7/get-version-action@v2
|
uses: battila7/get-version-action@d97fbc34ceb64d1f5d95f4dfd6dce33521ccccf5 # ratchet:battila7/get-version-action@v2
|
||||||
|
|
||||||
- name: Get tag message
|
- name: Get tag message
|
||||||
id: tag
|
id: tag
|
||||||
@ -38,7 +38,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Create Release
|
- name: Create Release
|
||||||
id: create-release
|
id: create-release
|
||||||
uses: ncipollo/release-action@v1
|
uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # ratchet:ncipollo/release-action@v1
|
||||||
with:
|
with:
|
||||||
draft: true
|
draft: true
|
||||||
name: ${{ steps.get_version.outputs.version }}
|
name: ${{ steps.get_version.outputs.version }}
|
||||||
@ -82,11 +82,11 @@ jobs:
|
|||||||
runs-on: ${{ matrix.config.os }}
|
runs-on: ${{ matrix.config.os }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # ratchet:actions/checkout@v4
|
||||||
|
|
||||||
- uses: Swatinem/rust-cache@v2
|
- uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # ratchet:Swatinem/rust-cache@v2
|
||||||
if: ${{ matrix.config.container == null }}
|
if: ${{ matrix.config.container == null }}
|
||||||
- uses: dtolnay/rust-toolchain@master
|
- uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a # ratchet:dtolnay/rust-toolchain@master
|
||||||
if: ${{ matrix.config.container == null }}
|
if: ${{ matrix.config.container == null }}
|
||||||
with:
|
with:
|
||||||
targets: ${{ matrix.config.rust_target }}
|
targets: ${{ matrix.config.rust_target }}
|
||||||
@ -141,7 +141,7 @@ jobs:
|
|||||||
Compress-Archive -Path $dllFiles -DestinationPath "avante_lib-${{ matrix.config.os_name }}-${{ matrix.config.arch }}-${{ matrix.feature }}.zip"
|
Compress-Archive -Path $dllFiles -DestinationPath "avante_lib-${{ matrix.config.os_name }}-${{ matrix.config.arch }}-${{ matrix.feature }}.zip"
|
||||||
|
|
||||||
- name: Upload Release Asset
|
- name: Upload Release Asset
|
||||||
uses: shogo82148/actions-upload-release-asset@v1
|
uses: shogo82148/actions-upload-release-asset@8482bd769644976d847e96fb4b9354228885e7b4 # ratchet:shogo82148/actions-upload-release-asset@v1
|
||||||
if: ${{ matrix.config.os_name != 'windows' }}
|
if: ${{ matrix.config.os_name != 'windows' }}
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
@ -150,7 +150,7 @@ jobs:
|
|||||||
upload_url: ${{ needs.create-release.outputs.release_upload_url }}
|
upload_url: ${{ needs.create-release.outputs.release_upload_url }}
|
||||||
asset_path: ./results/avante_lib-${{ matrix.config.os_name }}-${{ matrix.config.arch }}-${{ matrix.feature }}.tar.gz
|
asset_path: ./results/avante_lib-${{ matrix.config.os_name }}-${{ matrix.config.arch }}-${{ matrix.feature }}.tar.gz
|
||||||
- name: Upload Release Asset (Windows)
|
- name: Upload Release Asset (Windows)
|
||||||
uses: shogo82148/actions-upload-release-asset@v1
|
uses: shogo82148/actions-upload-release-asset@8482bd769644976d847e96fb4b9354228885e7b4 # ratchet:shogo82148/actions-upload-release-asset@v1
|
||||||
if: ${{ matrix.config.os_name == 'windows' }}
|
if: ${{ matrix.config.os_name == 'windows' }}
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
@ -168,7 +168,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: publish release
|
- name: publish release
|
||||||
id: publish-release
|
id: publish-release
|
||||||
uses: actions/github-script@v6
|
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # ratchet:actions/github-script@v6
|
||||||
env:
|
env:
|
||||||
release_id: ${{ needs.create-release.outputs.release_id }}
|
release_id: ${{ needs.create-release.outputs.release_id }}
|
||||||
with:
|
with:
|
||||||
|
55
.github/workflows/rust.yaml
vendored
Normal file
55
.github/workflows/rust.yaml
vendored
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
name: Rust CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
paths:
|
||||||
|
- "crates/*"
|
||||||
|
- "Cargo.lock"
|
||||||
|
- "Cargo.toml"
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
paths:
|
||||||
|
- "crates/*"
|
||||||
|
- "Cargo.lock"
|
||||||
|
- "Cargo.toml"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
tests:
|
||||||
|
name: Run Rust tests
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # ratchet:actions/checkout@v4
|
||||||
|
- uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # ratchet:Swatinem/rust-cache@v2
|
||||||
|
- uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a # ratchet:dtolnay/rust-toolchain@master
|
||||||
|
with:
|
||||||
|
toolchain: stable
|
||||||
|
components: clippy, rustfmt
|
||||||
|
- name: Run rust tests
|
||||||
|
run: cargo test --features luajit
|
||||||
|
style:
|
||||||
|
name: Check Rust style
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # ratchet:actions/checkout@v4
|
||||||
|
- uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # ratchet:Swatinem/rust-cache@v2
|
||||||
|
- uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a # ratchet:dtolnay/rust-toolchain@master
|
||||||
|
with:
|
||||||
|
toolchain: stable
|
||||||
|
components: clippy, rustfmt
|
||||||
|
- name: Run rustfmt
|
||||||
|
run: make ruststylecheck
|
||||||
|
lint:
|
||||||
|
name: Lint Rust
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # ratchet:actions/checkout@v4
|
||||||
|
- uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # ratchet:Swatinem/rust-cache@v2
|
||||||
|
- uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a # ratchet:dtolnay/rust-toolchain@master
|
||||||
|
with:
|
||||||
|
toolchain: "1.80.1"
|
||||||
|
components: clippy, rustfmt
|
||||||
|
- name: Run rustfmt
|
||||||
|
run: make rustlint
|
Loading…
x
Reference in New Issue
Block a user