Skip to content

Commit

Permalink
Update github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
liurenjie1024 committed Jul 7, 2024
1 parent a0ab8e6 commit dc430da
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 13 deletions.
40 changes: 39 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: true

env:
rust_nightly: "nightly-2024-06-10"
rust_min: "1.77.1"

jobs:
check:
runs-on: ubuntu-latest
Expand All @@ -38,6 +42,25 @@ jobs:
- name: Check License Header
uses: apache/skywalking-eyes/header@v0.6.0

- name: Install Rust ${{ env.rust_nightly }}
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.rust_nightly }}

- name: Install cargo-sort
uses: baptiste0928/cargo-install@v3
with:
crate: cargo-sort
version: '1.0.9'

- name: Install taplo-cli
uses: baptiste0928/cargo-install@v3
with:
crate: taplo-cli
version: '0.9.0'

- uses: Swatinem/rust-cache@v2

- name: Cargo format
run: make check-fmt

Expand All @@ -61,14 +84,29 @@ jobs:
- windows-latest
steps:
- uses: actions/checkout@v4

- name: Install Rust ${{ env.rust_min }}
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.rust_min }}

- uses: Swatinem/rust-cache@v2

- name: Build
run: cargo build
run: make build

unit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install Rust ${{ env.rust_min }}
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.rust_min }}

- uses: Swatinem/rust-cache@v2

- name: Test
run: cargo test --no-fail-fast --all-targets --all-features --workspace

Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ on:
- ".github/workflows/publish.yml"
workflow_dispatch:


env:
rust_min: "1.77.1"

jobs:
publish:
runs-on: ubuntu-latest
Expand All @@ -42,6 +46,14 @@ jobs:
- "crates/catalog/rest"
steps:
- uses: actions/checkout@v4

- name: Install Rust ${{ env.rust_min }}
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.rust_min }}

- uses: Swatinem/rust-cache@v2

- name: Dryrun ${{ matrix.package }}
working-directory: ${{ matrix.package }}
run: cargo publish --all-features --dry-run
Expand Down
19 changes: 8 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,23 @@

RUST_LOG = debug

RUST_NIGHTLY_CHANNEL = nightly-2024-06-10

build:
cargo build --all-targets --all-features --workspace

install-night-toolchain:
rustup toolchain install $(RUST_NIGHTLY_CHANNEL) -c rustfmt -c clippy
check-fmt:
cargo fmt --all -- --check

check-fmt: install-night-toolchain
cargo +$(RUST_NIGHTLY_CHANNEL) fmt --all -- --check
check-clippy:
cargo clippy --all-targets --all-features --workspace -- -D warnings

check-clippy: install-night-toolchain
cargo +$(RUST_NIGHTLY_CHANNEL) clippy --all-targets --all-features --workspace -- -D warnings
install-cargo-sort:
cargo install cargo-sort@1.0.9

cargo-sort:
cargo install cargo-sort
cargo-sort: install-cargo-sort
cargo sort -c -w

install-taplo-cli:
cargo install taplo-cli --locked
cargo install taplo-cli@0.9.0

fix-toml: install-taplo-cli
taplo fmt
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
# under the License.

[toolchain]
channel = "1.77.1"
channel = "nightly-2024-06-10"
components = ["rustfmt", "clippy"]

0 comments on commit dc430da

Please sign in to comment.