]> git.lizzy.rs Git - rust.git/blobdiff - .github/workflows/ci.yaml
Merge #7163
[rust.git] / .github / workflows / ci.yaml
index 2acd440122b670e57905c12ef15401b92ee22d2c..1850068a340cdb7492bb4960f5b386e3cabc7505 100644 (file)
@@ -12,24 +12,10 @@ env:
   CARGO_NET_RETRY: 10
   CI: 1
   RUST_BACKTRACE: short
-  RUSTFLAGS: -D warnings
+  RUSTFLAGS: "-D warnings -W unreachable-pub"
   RUSTUP_MAX_RETRIES: 10
 
 jobs:
-  # rust-audit:
-  #   name: Audit Rust vulnerabilities
-  #   runs-on: ubuntu-latest
-  #   steps:
-  #   - name: Checkout repository
-  #     uses: actions/checkout@v2
-
-  #   - uses: actions-rs/install@v0.1
-  #     with:
-  #       crate: cargo-audit
-  #       use-tool-cache: true
-
-  #   - run: cargo audit
-
   rust:
     name: Rust
     runs-on: ${{ matrix.os }}
@@ -44,6 +30,9 @@ jobs:
     steps:
     - name: Checkout repository
       uses: actions/checkout@v2
+      with:
+        ref: ${{ github.event.pull_request.head.sha }}
+        fetch-depth: 20
 
     # We need to disable the existing toolchain to avoid updating rust-docs
     # which takes a long time. The fastest way to do this is to rename the
@@ -53,6 +42,14 @@ jobs:
       if: matrix.os == 'windows-latest'
       run: Rename-Item C:\Users\runneradmin\.rustup\toolchains\stable-x86_64-pc-windows-msvc C:\Users\runneradmin\.rustup\toolchains\stable-x86_64-pc-windows-msvc.old
 
+    # Work around https://github.com/actions/cache/issues/403 by using GNU tar
+    # instead of BSD tar.
+    - name: Install GNU tar
+      if: matrix.os == 'macos-latest'
+      run: |
+        brew install gnu-tar
+        echo PATH="/usr/local/opt/gnu-tar/libexec/gnubin:$PATH" >> $GITHUB_ENV
+
     - name: Install Rust toolchain
       uses: actions-rs/toolchain@v1
       with:
@@ -84,15 +81,14 @@ jobs:
     - name: Prepare cache
       run: cargo xtask pre-cache
 
-    - name: Prepare cache 2
-      if: matrix.os == 'windows-latest'
-      run: Remove-Item ./target/debug/xtask.exe, ./target/debug/deps/xtask.exe
-
-  # Weird target to catch non-portable code
-  rust-power:
-    name: Rust Power
+  # Weird targets to catch non-portable code
+  rust-cross:
+    name: Rust Cross
     runs-on: ubuntu-latest
 
+    env:
+      targets: "powerpc-unknown-linux-gnu x86_64-unknown-linux-musl"
+
     steps:
     - name: Checkout repository
       uses: actions/checkout@v2
@@ -103,7 +99,9 @@ jobs:
         toolchain: stable
         profile: minimal
         override: true
-        target: 'powerpc-unknown-linux-gnu'
+
+    - name: Install Rust targets
+      run: rustup target add ${{ env.targets }}
 
     - name: Cache cargo directories
       uses: actions/cache@v2
@@ -114,14 +112,17 @@ jobs:
         key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
 
     - name: Check
-      run: cargo check --target=powerpc-unknown-linux-gnu --all-targets
+      run: |
+        for target in ${{ env.targets }}; do
+          cargo check --target=$target --all-targets
+        done
 
   typescript:
     name: TypeScript
     strategy:
       fail-fast: false
       matrix:
-        os: [ubuntu-latest, windows-latest, macos-latest]
+        os: [ubuntu-latest, windows-latest]
 
     runs-on: ${{ matrix.os }}