Skip to content

Commit

Permalink
fix: ci cache dependencies (apache#193)
Browse files Browse the repository at this point in the history
* cache dependencies

* hash Carogo lock, not toml
  • Loading branch information
jiacai2050 authored Aug 15, 2022
1 parent 8cccedd commit 9e00342
Showing 1 changed file with 40 additions and 124 deletions.
164 changes: 40 additions & 124 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
name: CI

on:
workflow_dispatch:
push:
branches:
- main
Expand All @@ -22,168 +23,83 @@ on:
- '**.md'
- '**.yml'

# Common environment variables
env:
RUSTFLAGS: "-C debuginfo=1"
CARGO_TERM_COLOR: always

jobs:
# build the library, a compilation step used by multiple steps below
linux-build-lib:
name: Build Libraries with Rust ${{ matrix.rust }}
fmt:
name: fmt-clippy
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
matrix:
rust: [1.59.0]
container:
image: rust:${{ matrix.rust }}-slim-bullseye
env:
# Disable full debug symbol generation to speed up CI build and keep memory down
# "1" means line tables only, which is useful for panic tracebacks.
RUSTFLAGS: "-C debuginfo=1"
rust: [nightly-2022-08-08]
steps:
- uses: actions/checkout@v3
# with:
# submodules: true
- name: Cache Cargo
- run: |
rustup set auto-self-update disable
rustup toolchain install ${{ matrix.rust }} --profile minimal
- name: Cache Rust Dependencies
uses: actions/cache@v3
with:
path: /github/home/.cargo
key: cargo-cache-
- name: Cache Rust dependencies
uses: actions/cache@v3
with:
path: /github/home/target
key: ${{ runner.os }}-target-cache-${{ matrix.rust }}-
- name: Cache Build Dependencies
uses: actions/cache@v3
with:
path: /github/home
key: ${{ runner.os }}-toolchain-cache-
- name: Setup Build Environment
run: |
apt update
apt install --yes gcc g++ libssl-dev pkg-config cmake
rm -rf /var/lib/apt/lists/*
- name: Build workspace in debug mode
run: |
make build-ut
env:
CARGO_HOME: "/github/home/.cargo"
CARGO_TARGET_DIR: "/github/home/target/debug"

style-check:
name: Libraries Style Check
needs: [linux-build-lib]
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
matrix:
rust: [1.59.0]
container:
image: rust:${{ matrix.rust }}-slim-bullseye
steps:
- uses: actions/checkout@v3
path: |
~/.cargo
./target
key: rust-debug-${{ runner.os }}-${{ hashFiles('rust-toolchain') }}-${{ hashFiles('Cargo.lock') }}
restore-keys: |
rust-debug-${{ runner.os }}-${{ hashFiles('rust-toolchain') }}-
rust-debug-${{ runner.os }}-
rust-
- name: Setup Build Environment
run: |
apt update
apt install --yes cmake
rm -rf /var/lib/apt/lists/*
- name: Setup Toolchain
sudo apt update
sudo apt install --yes gcc g++ libssl-dev pkg-config cmake
sudo rm -rf /var/lib/apt/lists/*
- name: Install clippy rustfmt
run: |
rustup component add clippy
rustup component add rustfmt
- name: Run
run: |
make fmt
env:
CARGO_HOME: "/github/home/.cargo"
CARGO_TARGET_DIR: "/github/home/target/debug"

clippy:
name: Clippy
needs: [linux-build-lib]
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
matrix:
rust: [1.59.0]
container:
image: rust:${{ matrix.rust }}-slim-bullseye
env:
RUSTFLAGS: "-C debuginfo=1"
steps:
- uses: actions/checkout@v3
# with:
# submodules: true
- name: Cache Cargo
uses: actions/cache@v3
with:
path: /github/home/.cargo
key: cargo-cache-
- name: Cache Rust dependencies
uses: actions/cache@v3
with:
path: /github/home/target
key: ${{ runner.os }}-target-cache-${{ matrix.rust }}-
- name: Cache Build Dependencies
uses: actions/cache@v3
with:
path: /github/home
key: ${{ runner.os }}-toolchain-cache-
- name: Setup Build Environment
run: |
apt update
apt install --yes gcc g++ libssl-dev pkg-config cmake
rm -rf /var/lib/apt/lists/*
- name: Install Clippy
run: |
rustup component add clippy
- name: Run Clippy
run: |
make clippy
env:
CARGO_HOME: "/github/home/.cargo"
CARGO_TARGET_DIR: "/github/home/target/debug"
make fmt
linux-test:
name: Test Workspace with Rust ${{ matrix.rust }}
needs: [linux-build-lib]
name: unit-test
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
matrix:
rust: [1.59.0]
container:
image: rust:${{ matrix.rust }}-slim-bullseye
env:
RUSTFLAGS: "-C debuginfo=1"
rust: [nightly-2022-08-08]
steps:
- uses: actions/checkout@v3
# with:
# submodule: true
- name: Cache Cargo
uses: actions/cache@v3
with:
path: /github/home/.cargo
key: cargo-cache-
- name: Cache Rust dependencies
uses: actions/cache@v3
with:
path: /github/home/target
key: ${{ runner.os }}-target-cache-${{ matrix.rust }}-
- name: Cache Build Dependencies
- run: |
rustup set auto-self-update disable
rustup toolchain install ${{ matrix.rust }} --profile minimal
- name: Cache Rust Dependencies
uses: actions/cache@v3
with:
path: /github/home
key: ${{ runner.os }}-toolchain-cache-
path: |
~/.cargo
./target
key: rust-debug-${{ runner.os }}-${{ hashFiles('rust-toolchain') }}-${{ hashFiles('Cargo.lock') }}
restore-keys: |
rust-debug-${{ runner.os }}-${{ hashFiles('rust-toolchain') }}-
rust-debug-${{ runner.os }}-
rust-
- name: Setup Build Environment
run: |
apt update
apt install --yes gcc g++ libssl-dev pkg-config cmake git
sudo apt update
sudo apt install --yes gcc g++ libssl-dev pkg-config cmake git
- name: Run Tests
run: |
git clone https://github.com/apache/parquet-testing.git components/parquet-testing
make test-ut
env:
CARGO_HOME: "/github/home/.cargo"
CARGO_TARGET_DIR: "/github/home/target/debug"
RUST_BACKTRACE: "1"

0 comments on commit 9e00342

Please sign in to comment.