You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by mg...@apache.org on 2023/08/11 08:56:53 UTC

[avro] branch master updated: AVRO-3828: [Rust] Fix CI build warnings (#2434)

This is an automated email from the ASF dual-hosted git repository.

mgrigorov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/avro.git


The following commit(s) were added to refs/heads/master by this push:
     new e6d18045b AVRO-3828: [Rust] Fix CI build warnings (#2434)
e6d18045b is described below

commit e6d18045b89c56da866999ca6b208324b49184e5
Author: Martin Grigorov <ma...@users.noreply.github.com>
AuthorDate: Fri Aug 11 11:56:47 2023 +0300

    AVRO-3828: [Rust] Fix CI build warnings (#2434)
    
    * AVRO-3828: [Rust] Enable "RUSTFLAGS=-Dwarnings" for all Rust CI workflows
    
    Signed-off-by: Martin Tzvetanov Grigorov <mg...@apache.org>
    
    * AVRO-3828: [Rust] Replace Github Action actions-rs with dtolnay/toolchain
    
    Signed-off-by: Martin Tzvetanov Grigorov <mg...@apache.org>
    
    * AVRO-3828: [PHP] Replace usage of ::set-output with $GITHUB_OUTPUT
    
    See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
    
    Signed-off-by: Martin Tzvetanov Grigorov <mg...@apache.org>
    
    * AVRO-3828: [Rust] Quote the versions of Rust in the CI matrix
    
    Signed-off-by: Martin Tzvetanov Grigorov <mg...@apache.org>
    
    * AVRO-3828: [Rust] Use dtolnay/toolchain@nightly only
    
    Only '@nightly' is whitelisted by ASF Infra
    
    Signed-off-by: Martin Tzvetanov Grigorov <mg...@apache.org>
    
    * AVRO-3828: Remove '--manifest-path ...'.
    
    defaults:
      run:
        working-directory: lang/rust
    
    now is taken into account!
    
    Signed-off-by: Martin Tzvetanov Grigorov <mg...@apache.org>
    
    ---------
    
    Signed-off-by: Martin Tzvetanov Grigorov <mg...@apache.org>
---
 .github/workflows/test-lang-php.yml         |  2 +-
 .github/workflows/test-lang-rust-audit.yml  | 12 +++----
 .github/workflows/test-lang-rust-ci.yml     | 55 +++++++++++------------------
 .github/workflows/test-lang-rust-clippy.yml | 14 ++++----
 4 files changed, 35 insertions(+), 48 deletions(-)

diff --git a/.github/workflows/test-lang-php.yml b/.github/workflows/test-lang-php.yml
index 378691785..0f1087175 100644
--- a/.github/workflows/test-lang-php.yml
+++ b/.github/workflows/test-lang-php.yml
@@ -54,7 +54,7 @@ jobs:
 
       - name: Get Composer Cache Directory
         id: composer-cache
-        run: echo "::set-output name=dir::$(composer config cache-files-dir)"
+        run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
 
       - uses: actions/cache@v3
         with:
diff --git a/.github/workflows/test-lang-rust-audit.yml b/.github/workflows/test-lang-rust-audit.yml
index f8ec89c6e..27c47e485 100644
--- a/.github/workflows/test-lang-rust-audit.yml
+++ b/.github/workflows/test-lang-rust-audit.yml
@@ -27,6 +27,12 @@ on:
       - lang/rust/Cargo.toml
       - lang/rust/Cargo.lock
 
+permissions:
+  contents: read
+
+env:
+  RUSTFLAGS: -Dwarnings
+
 defaults:
   run:
     working-directory: lang/rust
@@ -41,12 +47,6 @@ jobs:
     steps:
       - name: Checkout
         uses: actions/checkout@v3
-      # Currently does not work. See https://github.com/actions-rs/audit-check/issues/194
-      #- name: Rust Audit
-      #  uses: actions-rs/audit-check@v1
-      #  with:
-      #    token: ${{ secrets.GITHUB_TOKEN }}
-      # Install it manually
       - name: Dependency Review
         if: github.event_name == 'pull_request'
         uses: actions/dependency-review-action@v3
diff --git a/.github/workflows/test-lang-rust-ci.yml b/.github/workflows/test-lang-rust-ci.yml
index 38e1d8664..79663182a 100644
--- a/.github/workflows/test-lang-rust-ci.yml
+++ b/.github/workflows/test-lang-rust-ci.yml
@@ -26,6 +26,12 @@ on:
       - .github/workflows/test-lang-rust-ci.yml
       - lang/rust/**
 
+permissions:
+  contents: read
+
+env:
+  RUSTFLAGS: -Dwarnings
+
 defaults:
   run:
     working-directory: lang/rust
@@ -40,10 +46,10 @@ jobs:
     strategy:
       matrix:
         rust:
-          - stable
-          - beta
-          - nightly
-          - 1.65.0  # MSRV
+          - 'stable'
+          - 'beta'
+          - 'nightly'
+          - '1.65.0'  # MSRV
         target:
           - x86_64-unknown-linux-gnu
           - wasm32-unknown-unknown
@@ -68,48 +74,31 @@ jobs:
           key: ${{ runner.os }}-target-cache1-${{ matrix.rust }}-
 
       - name: Rust Toolchain
-        uses: actions-rs/toolchain@v1
+        uses: dtolnay/rust-toolchain@nightly
         with:
-          profile: minimal
           toolchain: ${{ matrix.rust }}
-          override: true
           components: rustfmt
-          target: ${{ matrix.target }}
+          targets: ${{ matrix.target }}
 
       - name: Rust Format
         if: matrix.target != 'wasm32-unknown-unknown'
-        uses: actions-rs/cargo@v1
-        with:
-          command: fmt
-          args: --manifest-path lang/rust/Cargo.toml --all -- --check
+        run: cargo fmt --all -- --check
 
       - name: Rust Build
-        uses: actions-rs/cargo@v1
-        with:
-          command: build
-          args: --manifest-path lang/rust/Cargo.toml --all-features --all-targets
+        run: cargo build --all-features --all-targets
 
       - name: Rust Test
         if: matrix.target != 'wasm32-unknown-unknown'
-        uses: actions-rs/cargo@v1
-        with:
-          command: test
-          args: --manifest-path lang/rust/Cargo.toml --all-features --target ${{ matrix.target }}
+        run: cargo test --all-features --target ${{ matrix.target }}
 
       - name: Rust Test AVRO-3549
         if: matrix.target != 'wasm32-unknown-unknown'
-        uses: actions-rs/cargo@v1
-        with:
-          command: test
-          args: --manifest-path lang/rust/Cargo.toml --target ${{ matrix.target }} test_avro_3549_read_not_enabled_codec
+        run: cargo test --target ${{ matrix.target }} test_avro_3549_read_not_enabled_codec
 
       # because of https://github.com/rust-lang/cargo/issues/6669
       - name: Rust Test docs
         if: matrix.target != 'wasm32-unknown-unknown'
-        uses: actions-rs/cargo@v1
-        with:
-          command: test
-          args: --manifest-path lang/rust/Cargo.toml --doc
+        run: cargo test --doc
 
   interop:
     runs-on: ubuntu-latest
@@ -119,11 +108,9 @@ jobs:
         uses: actions/checkout@v3
 
       - name: Rust Toolchain
-        uses: actions-rs/toolchain@v1
+        uses: dtolnay/rust-toolchain@nightly
         with:
-          profile: minimal
           toolchain: stable
-          override: true
 
       - name: Cache Cargo
         uses: actions/cache@v3
@@ -205,12 +192,10 @@ jobs:
         uses: actions/checkout@v3
 
       - name: Rust Toolchain
-        uses: actions-rs/toolchain@v1
+        uses: dtolnay/rust-toolchain@nightly
         with:
-          profile: minimal
           toolchain: stable
-          override: true
-          target: wasm32-unknown-unknown
+          targets: wasm32-unknown-unknown
 
       - name: Cache Cargo
         uses: actions/cache@v3
diff --git a/.github/workflows/test-lang-rust-clippy.yml b/.github/workflows/test-lang-rust-clippy.yml
index adafafd3f..a6eb57ea4 100644
--- a/.github/workflows/test-lang-rust-clippy.yml
+++ b/.github/workflows/test-lang-rust-clippy.yml
@@ -26,6 +26,12 @@ on:
       - .github/workflows/test-lang-rust-clippy.yml
       - lang/rust/**
 
+permissions:
+  contents: read
+
+env:
+  RUSTFLAGS: -Dwarnings
+
 defaults:
   run:
     working-directory: lang/rust
@@ -39,12 +45,8 @@ jobs:
     runs-on: ubuntu-latest
     steps:
       - uses: actions/checkout@v3
-      - uses: actions-rs/toolchain@v1
+      - uses: dtolnay/rust-toolchain@nightly
         with:
           toolchain: stable
           components: clippy
-          override: true
-      - uses: actions-rs/clippy-check@v1
-        with:
-          token: ${{ secrets.GITHUB_TOKEN }}
-          args: --manifest-path lang/rust/Cargo.toml  --all-features --all-targets -- -Dclippy::all -Dunused_imports
+      - run: cargo clippy --all-features --all-targets -- -Dclippy::all -Dunused_imports