Skip to content

Commit

Permalink
refactor: Modernize CI/CD components
Browse files Browse the repository at this point in the history
action-rs has been disabled since last year.
Additionally, Zprofile got recently deprecated.
  • Loading branch information
RedEtherbloom committed Nov 12, 2024
1 parent a4b221f commit 6d7a091
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 57 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ jobs:
MACOSX_DEPLOYMENT_TARGET: 10.7
steps:
- uses: actions/checkout@master
- uses: actions-rs/toolchain@v1
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
default: true
- uses: actions-rs/cargo@v1
override: true
- uses: clechasseur/rs-cargo@v2
with:
command: build
args: --release ${{matrix.features}} --target=${{ matrix.target }}
Expand Down
60 changes: 32 additions & 28 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ jobs:
MACOSX_DEPLOYMENT_TARGET: 10.7
steps:
- uses: actions/checkout@master
- uses: actions-rs/toolchain@v1
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
default: true
- uses: actions-rs/cargo@v1
override: true
- uses: clechasseur/rs-cargo@v2
with:
command: build
args: --release ${{matrix.features}} --target=${{ matrix.target }}
Expand Down Expand Up @@ -122,7 +122,7 @@ jobs:
steps:
- name: Check out Git repository
uses: actions/checkout@v4
- uses: actions-rs/cargo@v1
- uses: clechasseur/rs-cargo@v2
with:
command: build
args: --release
Expand Down Expand Up @@ -150,7 +150,7 @@ jobs:
steps:
- name: Check out Git repository
uses: actions/checkout@v4
- uses: actions-rs/cargo@v1
- uses: clechasseur/rs-cargo@v2
with:
command: build
args: --release
Expand Down Expand Up @@ -180,7 +180,7 @@ jobs:
steps:
- name: Check out Git repository
uses: actions/checkout@v4
- uses: actions-rs/cargo@v1
- uses: clechasseur/rs-cargo@v2
with:
command: build
args: --release
Expand All @@ -198,11 +198,11 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Install toolchain
uses: actions-rs/toolchain@v1
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: nightly
override: true
profile: minimal
components: llvm-tools-preview
- run: sudo apt-get update
- name: 'Install Taskwarrior'
uses: ./.github/actions/install-taskwarrior
Expand All @@ -217,36 +217,40 @@ jobs:
- run: |
# prepare taskwarrior, initial setup
task rc.confirmation=off || echo 0
- name: Execute tests
uses: actions-rs/cargo@v1
- name: Clean environment for grcov
uses: clechasseur/rs-cargo@v2
with:
command: clean
- name: Build taskwarrior-tui with coverage
uses: clechasseur/rs-cargo@v2
with:
command: build
env:
RUSTFLAGS: "-Cinstrument-coverage"
- name: Run taskwarrior-tui tests in coverage environment
uses: clechasseur/rs-cargo@v2
with:
command: test
args: --all
args: --worksoace
env:
CARGO_INCREMENTAL: 0
RUSTFLAGS: "-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests"

# Note that `actions-rs/grcov` Action can install `grcov` too,
# but can't use faster installation methods yet.
# As a temporary experiment `actions-rs/install` Action plugged in here.
# Consider **NOT** to copy that into your workflow,
# but use `actions-rs/grcov` only
- name: Pre-installing grcov
uses: actions-rs/[email protected]
RUSTFLAGS: "-Cinstrument-coverage"
LLVM_PROFILE_FILE: "your_name-%p-%m.profraw"
- name: Install grcov
uses: clechasseur/rs-cargo@v2
with:
crate: grcov
use-tool-cache: true

command: install
args: grcov
- name: Gather coverage data
id: coverage
uses: actions-rs/[email protected]

run: |
mkdir ./target/debug/coverage/
grcov . -s . --binary-path ./target/debug/ -t lcov --branch --ignore-not-existing -o ./target/debug/coverage/
shell: bash
- name: Coveralls upload
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel: true
path-to-lcov: ${{ steps.coverage.outputs.report }}
file: ./target/debug/coverage/lcov

grcov_finalize:
runs-on: ubuntu-latest
Expand Down
26 changes: 11 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
- uses: clechasseur/rs-cargo@v2
with:
command: check

Expand All @@ -26,9 +25,8 @@ jobs:
RUST_BACKTRACE: full
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- run: sudo apt-get update
Expand All @@ -45,23 +43,22 @@ jobs:
- run: |
# prepare taskwarrior, initial setup
task rc.confirmation=off || echo 0
- uses: actions-rs/cargo@v1
- uses: clechasseur/rs-cargo@v2
with:
command: test
args: --all -- --nocapture
args: --workspace -- --nocapture

fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true
- run: rustup component add rustfmt
- uses: actions-rs/cargo@v1
components: rustfmt
- uses: clechasseur/rs-cargo@v2
with:
command: fmt
args: --all -- --check
Expand All @@ -71,13 +68,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- run: rustup component add clippy
- uses: actions-rs/cargo@v1
components: clippy
- uses: clechasseur/rs-cargo@v2
with:
command: clippy
args: -- -D warnings
19 changes: 8 additions & 11 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -505,17 +505,14 @@ impl TaskwarriorTui {
let virtual_tag_names_in_precedence = &self.config.rule_precedence_color;
let mut style = Style::default();
for tag_name in virtual_tag_names_in_precedence.iter().rev() {
match tag_name.as_str() {
"project." => {
let s = self
.config
.color
.get(&format!("color.project.{}", project[0]))
.copied()
.unwrap_or_default();
style = style.patch(s);
}
&_ => {}
if tag_name.as_str() == "project." {
let s = self
.config
.color
.get(&format!("color.project.{}", project[0]))
.copied()
.unwrap_or_default();
style = style.patch(s);
}
}
style
Expand Down

0 comments on commit 6d7a091

Please sign in to comment.