]> git.lizzy.rs Git - rust.git/blobdiff - .github/workflows/ci.yaml
Merge #8710
[rust.git] / .github / workflows / ci.yaml
index f46fb8fecc2b23a9ae4499b8982dcf63eb47b553..63518e67ff4ca716ccffca9e5717e4d97614b178 100644 (file)
@@ -12,7 +12,7 @@ env:
   CARGO_NET_RETRY: 10
   CI: 1
   RUST_BACKTRACE: short
-  RUSTFLAGS: -D warnings
+  RUSTFLAGS: "-D warnings -W unreachable-pub"
   RUSTUP_MAX_RETRIES: 10
 
 jobs:
@@ -30,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
@@ -47,32 +50,14 @@ jobs:
         override: true
         components: rustfmt, rust-src
 
-    - name: Cache cargo directories
-      uses: actions/cache@v2
-      with:
-        path: |
-          ~/.cargo/registry
-          ~/.cargo/git
-        key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
-
-    - name: Cache cargo target dir
-      uses: actions/cache@v2
-      with:
-        path: target
-        key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
+    - name: Cache Dependencies
+      uses: Swatinem/rust-cache@ce325b60658c1b38465c06cc965b79baf32c1e72
 
     - name: Compile
       run: cargo test --no-run --locked
 
     - name: Test
-      run: cargo test
-
-    - 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
+      run: cargo test -- --nocapture
 
   # Weird targets to catch non-portable code
   rust-cross:
@@ -96,13 +81,8 @@ jobs:
     - name: Install Rust targets
       run: rustup target add ${{ env.targets }}
 
-    - name: Cache cargo directories
-      uses: actions/cache@v2
-      with:
-        path: |
-          ~/.cargo/registry
-          ~/.cargo/git
-        key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
+    - name: Cache Dependencies
+      uses: Swatinem/rust-cache@ce325b60658c1b38465c06cc965b79baf32c1e72
 
     - name: Check
       run: |
@@ -115,7 +95,7 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        os: [ubuntu-latest, windows-latest, macos-latest]
+        os: [ubuntu-latest, windows-latest]
 
     runs-on: ${{ matrix.os }}