diff --git a/.dockerignore b/.dockerignore index 3d3202d..29c586b 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,2 +1,4 @@ +.git Dockerfile -**/README.md \ No newline at end of file +README.md +/target/ \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1c3f88d..d217dbf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,28 +28,17 @@ jobs: export DEBIAN_FRONTEND=noninteractive sudo apt-get clean && sudo apt-get update sudo apt-get install -y pkg-config libudev-dev - - name: Cache cargo registry - uses: actions/cache@v1 + - name: Cargo cache + uses: actions/cache@v2 with: - path: ~/.cargo/registry - key: ${{ runner.os }}-cargo-registry-toolchain.outputs.rustc_hash }}-${{ hashFiles('**/Cargo.lock') }} + path: | + ~/.cargo/git + ~/.cargo/registry + ./target + key: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc_hash }}-${{ hashFiles('**/Cargo.lock') }} restore-keys: | - ${{ runner.os }}-cargo-registry- - - name: Cache cargo index - uses: actions/cache@v1 - with: - path: ~/.cargo/git - key: ${{ runner.os }}-cargo-index-toolchain.outputs.rustc_hash }}-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-cargo-index- - - name: Cache cargo build - uses: actions/cache@v1 - with: - path: target - key: ${{ runner.os }}-cargo-build-target-${{ steps.rust-toolchain.outputs.rustc_hash }}-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-cargo-build-target-${{ steps.rust-toolchain.outputs.rustc_hash }}- - ${{ runner.os }}-cargo-build-target- + ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc_hash }}- + ${{ runner.os }}-cargo - name: Run tests uses: actions-rs/cargo@v1 with: @@ -73,30 +62,17 @@ jobs: export DEBIAN_FRONTEND=noninteractive sudo apt-get clean && sudo apt-get update sudo apt-get install -y pkg-config libudev-dev - - name: Cache cargo registry - uses: actions/cache@v1 + - name: Cargo cache + uses: actions/cache@v2 with: - path: ~/.cargo/registry - key: ${{ runner.os }}-cargo-registry-${{ steps.rust-toolchain.outputs.rustc_hash }}-${{ hashFiles('**/Cargo.lock') }} + path: | + ~/.cargo/git + ~/.cargo/registry + ./target + key: ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc_hash }}-${{ hashFiles('**/Cargo.lock') }} restore-keys: | - ${{ runner.os }}-cargo-registry-${{ steps.rust-toolchain.outputs.rustc_hash }}- - ${{ runner.os }}-cargo-registry- - - name: Cache cargo index - uses: actions/cache@v1 - with: - path: ~/.cargo/git - key: ${{ runner.os }}-cargo-index-${{ steps.rust-toolchain.outputs.rustc_hash }}-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-cargo-index-${{ steps.rust-toolchain.outputs.rustc_hash }}- - ${{ runner.os }}-cargo-index- - - name: Cache cargo build - uses: actions/cache@v1 - with: - path: target - key: ${{ runner.os }}-cargo-build-target-${{ steps.rust-toolchain.outputs.rustc_hash }}-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-cargo-build-target-${{ steps.rust-toolchain.outputs.rustc_hash }}- - ${{ runner.os }}-cargo-build-target- + ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc_hash }}- + ${{ runner.os }}-cargo - name: Check rustfmt uses: actions-rs/cargo@v1 with: @@ -150,9 +126,16 @@ jobs: uses: actions/cache@v2 with: path: | + ~/.cargo/git ~/.cargo/registry ./target - key: build-cargo-registry-${{matrix.TARGET}} + key: ${{ runner.os }}-cargo-${{matrix.TARGET}}-${{ steps.rust-toolchain.outputs.rustc_hash }}-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo-${{matrix.TARGET}}-${{ steps.rust-toolchain.outputs.rustc_hash }} + ${{ runner.os }}-cargo-${{matrix.TARGET}}- + ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc_hash }}-${{ hashFiles('**/Cargo.lock') }} + ${{ runner.os }}-cargo-${{ steps.rust-toolchain.outputs.rustc_hash }}- + ${{ runner.os }}-cargo - name: Setup cross linux toolchain if: contains(matrix.TARGET, '-linux-') && !startsWith(matrix.TARGET, 'x86_64-') run: | @@ -387,6 +370,8 @@ jobs: file: Dockerfile.alpine tags: ${{ steps.meta-alpine.outputs.tags }} labels: ${{ steps.meta-alpine.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max - name: Build and push uses: docker/build-push-action@v3 with: @@ -397,4 +382,6 @@ jobs: linux/amd64 push: true tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max \ No newline at end of file