Skip to content

Commit

Permalink
Issue 437: Speed up github actions and uses new tool features. (#429)
Browse files Browse the repository at this point in the history
Speed up github actions by taking advantage of new tool features

Signed-off-by: SaiCharan <[email protected]>
  • Loading branch information
tkaitchuck authored May 25, 2023
1 parent b4e22d4 commit 73b46a6
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 119 deletions.
159 changes: 54 additions & 105 deletions .github/workflows/cibuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
tags:
- '*'
branches:
- master
- master
pull_request:
branches:
- master
Expand All @@ -25,33 +25,21 @@ jobs:

- name: Display Rust version
run: rustc --version
- name: Cache toolchain
uses: actions/cache@v3
with:
path: /usr/share/rust/.cargo
key: ${{ runner.os }}-rustup
- name: Cache cargo registry
uses: actions/cache@v3
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.toml') }}
- name: Cache cargo index
uses: actions/cache@v3
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.toml') }}
- name: Cache cargo build
uses: actions/cache@v3
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.toml') }}

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
default: true
components: rustfmt, clippy
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Run cargo check
uses: actions-rs/cargo@v1
Expand All @@ -69,44 +57,30 @@ jobs:
- name: Maximize disk space
uses: easimon/maximize-build-space@master
with:
remove-android: true
remove-haskell: true
remove-dotnet: true
remove-docker-images: true
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11

- name: Checkout sources
uses: actions/checkout@v2

- name: Cache toolchain
uses: actions/cache@v3
with:
path: /usr/share/rust/.cargo
key: ${{ runner.os }}-rustup
- name: Cache cargo registry
uses: actions/cache@v3
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.toml') }}
- name: Cache cargo index
uses: actions/cache@v3
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.toml') }}
- name: Cache cargo build
uses: actions/cache@v3
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.toml') }}

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
default: true
components: rustfmt, clippy
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Run cargo test
uses: actions-rs/cargo@v1
with:
Expand All @@ -125,34 +99,21 @@ jobs:
steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Cache toolchain
uses: actions/cache@v3
with:
path: /usr/share/rust/.cargo
key: ${{ runner.os }}-rustup
- name: Cache cargo registry
uses: actions/cache@v3
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.toml') }}
- name: Cache cargo index
uses: actions/cache@v3
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.toml') }}
- name: Cache cargo build
uses: actions/cache@v3
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.toml') }}

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
default: true
components: rustfmt, clippy
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Run cargo fmt
uses: actions-rs/cargo@v1
Expand All @@ -166,42 +127,23 @@ jobs:
name: Clippy
runs-on: ubuntu-latest
steps:
- name: Maximize disk space
uses: easimon/maximize-build-space@master
with:
remove-android: true
remove-haskell: true
remove-dotnet: true
- name: Checkout sources
uses: actions/checkout@v2

- name: Cache toolchain
uses: actions/cache@v3
with:
path: /usr/share/rust/.cargo
key: ${{ runner.os }}-rustup
- name: Cache cargo registry
uses: actions/cache@v3
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.toml') }}
- name: Cache cargo index
uses: actions/cache@v3
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.toml') }}
- name: Cache cargo build
uses: actions/cache@v3
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.toml') }}

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
default: true
components: rustfmt, clippy
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Run cargo clean
uses: actions-rs/cargo@v1
Expand All @@ -220,7 +162,7 @@ jobs:

build-release:
name: build-release
needs: ['clippy', 'fmt', 'check', 'test']
needs: ['fmt', 'check']
runs-on: ${{ matrix.os }}
env:
# For some builds, we use cross to test on 32-bit and big-endian
Expand Down Expand Up @@ -280,10 +222,17 @@ jobs:
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
override: true
default: true
target: ${{ matrix.target }}
components: rustfmt, clippy

- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: cross-${{ matrix.build }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Use Cross
shell: bash
# // Changed cargo version from latest to 0.2.4 for more information please refer https://github.com/cross-rs/cross/issues/1214
Expand Down
20 changes: 14 additions & 6 deletions .github/workflows/nodejs_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,20 @@ jobs:
- 20
steps:
- uses: actions/checkout@v2
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
default: true
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/setup-java@v1
with:
java-version: "11" # The JDK version to make available on the path.
Expand All @@ -41,12 +55,6 @@ jobs:
- name: Install modules
working-directory: ./nodejs
run: npm i
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: rustfmt, clippy
- name: Test
working-directory: ./nodejs
run: npm test
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ jobs:
- name: Install cargo-release
run: cargo install cargo-release
- name: Release (Dry Run)
run: cargo release --allow-branch '*' --dry-run -v -p pravega-client-shared -p pravega-client-macros -p pravega-client-channel -p pravega-client-retry -p pravega-connection-pool -p pravega-client-config -p pravega-wire-protocol -p pravega-controller-client -p pravega-client-auth
run: cargo release --allow-branch '*' --dry-run -v --unpublished -p pravega-client-shared -p pravega-client-macros -p pravega-client-channel -p pravega-client-retry -p pravega-connection-pool -p pravega-client-config -p pravega-wire-protocol -p pravega-controller-client -p pravega-client-auth
- name: Release
run: cargo release --allow-branch '*' -x --no-confirm -v -p pravega-client-shared -p pravega-client-macros -p pravega-client-channel -p pravega-client-retry -p pravega-connection-pool -p pravega-client-config -p pravega-wire-protocol -p pravega-controller-client -p pravega-client-auth
run: cargo release --allow-branch '*' -x --no-confirm -v --unpublished -p pravega-client-shared -p pravega-client-macros -p pravega-client-channel -p pravega-client-retry -p pravega-connection-pool -p pravega-client-config -p pravega-wire-protocol -p pravega-controller-client -p pravega-client-auth
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

20 changes: 14 additions & 6 deletions .github/workflows/python_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,20 @@ jobs:
timeout-minutes: 25
steps:
- uses: actions/checkout@v2
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
default: true
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: actions/setup-java@v1
with:
java-version: '11' # The JDK version to make available on the path.
Expand All @@ -32,12 +46,6 @@ jobs:
uses: actions/setup-python@v3
with:
python-version: 3.7
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: rustfmt, clippy
- name: Install maturin and tox
run: pip install 'maturin>=0.14,<0.15' virtualenv tox==3.28.0 tox-pyo3
- name: Test with tox
Expand Down

0 comments on commit 73b46a6

Please sign in to comment.