diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2858c003..22b4148c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,51 +5,56 @@ name: CI on: push: - branches: ["**"] + branches: ["main", "release/*", "!release/dry-run/*"] pull_request: branches: ["**"] - schedule: - - cron: "0 6 * * 1-5" workflow_dispatch: +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: check: runs-on: ubuntu-latest + env: + CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse steps: - name: Clone this repository - uses: actions/checkout@v4 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: submodules: true - name: Run isort - uses: isort/isort-action@v1 + uses: isort/isort-action@24d8a7a51d33ca7f36c3f23598dafa33f7071326 # v1.1.1 - name: Run black - uses: psf/black@stable + uses: psf/black@87928e6d6761a4a6d22250e1fee5601b3998086e # v26.5.1 with: options: "--check --diff -C" - - name: Update Stable Rust toolchain - run: rustup update stable - - - name: Install rust components - run: | - rustup +stable component add clippy rustfmt + - name: Cache Rust dependencies and build artifacts + uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2 + with: + workspaces: ". -> target" + shared-key: linux-zenoh-python - name: Run rustfmt - run: cargo +stable fmt --check -- --config "unstable_features=true,imports_granularity=Crate,group_imports=StdExternalCrate" + run: cargo fmt --check -- --config "unstable_features=true,imports_granularity=Crate,group_imports=StdExternalCrate" - name: Clippy no-default-features - run: cargo +stable clippy --no-default-features --all-targets -- --deny warnings + run: cargo clippy --no-default-features --all-targets -- --deny warnings - name: Clippy with all features and without Cargo.lock run: | rm Cargo.lock - cargo +stable clippy --all-features --all-targets -- --deny warnings + cargo clippy --all-features --all-targets -- --deny warnings build: needs: check runs-on: ubuntu-latest + env: + CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse strategy: fail-fast: false matrix: @@ -61,17 +66,23 @@ jobs: - "3.13-dev" steps: - name: Clone this repository - uses: actions/checkout@v4 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: submodules: true - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 + uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 with: python-version: ${{ matrix.python-version }} + - name: Cache Rust dependencies and build artifacts + uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2 + with: + workspaces: ". -> target" + shared-key: linux-zenoh-python + - name: Build zenoh-python - uses: messense/maturin-action@v1 + uses: messense/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0 - name: Install zenoh-python run: pip3 install ./target/wheels/*.whl @@ -91,8 +102,8 @@ jobs: markdown_lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: DavidAnson/markdownlint-cli2-action@v18 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - uses: DavidAnson/markdownlint-cli2-action@21c1be1b93ad9ed58fa840aacc3f279cde2a72ff # v24.2.0 with: config: '.markdownlint.yaml' globs: '**/README.md' diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 72436043..8565ca6b 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,2 +1,3 @@ [toolchain] channel = "1.97.1" +components = ["rustfmt", "clippy"]