Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extracts and reuse shared CI steps #48

Merged
merged 1 commit into from
Apr 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/actions/setup-rust/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: "Setup Rust build"
description: "Common steps before running a Rust/Cargo task"

runs:
using: "composite"
steps:
- name: Setup CI caching
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
with:
save-if: ${{ github.ref == 'refs/heads/main' }}

- name: Install additional tools (Mac)
if: runner.os == 'macOS'
shell: bash
run: brew install just coreutils zig

- name: Install additional tools (Linux)
if: runner.os == 'Linux'
shell: bash
run: |
sudo snap install --edge --classic just
sudo snap install zig --classic --beta && zig version

- name: Setup Rust and Cargo plugins
shell: bash
run: just setup-ci
57 changes: 8 additions & 49 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,8 @@ jobs:
- name: Project Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Setup CI caching
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
with:
save-if: ${{ github.ref == 'refs/heads/main' }}

- name: Install additional tools
run: sudo snap install --edge --classic just

- name: Setup Rust and Cargo plugins
run: just setup-ci
- name: Setup CI
uses: ./.github/actions/setup-rust

- name: Check project for errors
run: just checks
Expand All @@ -55,18 +47,8 @@ jobs:
- name: Project Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Setup CI caching
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
with:
save-if: ${{ github.ref == 'refs/heads/main' }}

- name: Install additional tools (Linux)
run: |
sudo snap install --edge --classic just
sudo snap install zig --classic --beta && zig version

- name: Setup Rust and Cargo plugins
run: just setup-ci
- name: Setup CI
uses: ./.github/actions/setup-rust

- name: Cross-compilation against some targets
run: just e2e ${{ matrix.resource }}
Expand All @@ -82,23 +64,8 @@ jobs:
- name: Project Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Setup CI caching
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
with:
save-if: ${{ github.ref == 'refs/heads/main' }}

- name: Install additional tools (Mac)
if: runner.os == 'macOS'
run: brew install just coreutils zig

- name: Install additional tools (Linux)
if: runner.os == 'Linux'
run: |
sudo snap install --edge --classic just
sudo snap install zig --classic --beta && zig version

- name: Setup Rust and Cargo plugins
run: just setup-ci
- name: Setup CI
uses: ./.github/actions/setup-rust

- name: Cross-compilation against some targets
run: just flexible-build
Expand All @@ -117,16 +84,8 @@ jobs:
- name: Project Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Setup CI caching
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
with:
save-if: ${{ github.ref == 'refs/heads/main' }}

- name: Install additional tools
run: sudo snap install --edge --classic just

- name: Setup Rust and Cargo plugins
run: just setup-ci
- name: Setup CI
uses: ./.github/actions/setup-rust

- name: Check MSRV
run: just msrv-check
Expand Down
8 changes: 0 additions & 8 deletions e2e/disk.bats
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,3 @@
[ ! -d $HOME/aaw/build ]
[ ! -d $HOME/aaw/.gradle ]
}

@test "should detect usages of ram" {
run $HOME/aaw/gradlew tasks -q -p $HOME/aaw
run gradle-wiper ram evaluate

[[ "$output" == *"Total resources (RAM memory)"* ]]
[ "$status" -eq 0 ]
}