Skip to content

Commit

Permalink
reduce duplicate actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Quba1 committed Feb 14, 2024
1 parent a64cba5 commit 2e00457
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 4 deletions.
26 changes: 23 additions & 3 deletions .github/workflows/rust-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,26 @@ env:
CARGO_TERM_COLOR: always

jobs:
pre_job:
continue-on-error: true
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5
with:
# All of these options are optional, so you can remove them if you are happy with the defaults
concurrent_skipping: 'same_content_newer'
skip_after_successful_duplicate: 'true'
paths_ignore: '["**/README.md""]'
do_not_skip: '["pull_request", "workflow_dispatch", "schedule"]'

build-linux:

name: Build on Linux
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: ubuntu-latest

steps:
Expand All @@ -27,19 +44,22 @@ jobs:
sudo apt-get install libeccodes-dev
rustup update stable
cargo clean
- name: Test with cargo
run: |
RUST_BACKTRACE=full cargo test --features "experimental_index, message_ndarray" -- --include-ignored
- name: Check with clippy
run: |
cargo clippy --features "experimental_index, message_ndarray"
- name: Build release
run: |
cargo build --release --features "experimental_index, message_ndarray"
- name: Test with cargo
run: |
cargo clean
RUST_BACKTRACE=full cargo test --features "experimental_index, message_ndarray" -- --include-ignored
build-macos:

name: Build on MacOS
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: macos-latest

steps:
Expand Down
24 changes: 23 additions & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,37 @@
name: cargo

on:
on:
push:
branches:
- main
pull_request:
branches:
- main

env:
CARGO_TERM_COLOR: always

jobs:
pre_job:
continue-on-error: true
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5
with:
# All of these options are optional, so you can remove them if you are happy with the defaults
concurrent_skipping: 'same_content_newer'
skip_after_successful_duplicate: 'true'
paths_ignore: '["**/README.md""]'
do_not_skip: '["pull_request", "workflow_dispatch", "schedule"]'

build:

name: Build on Ubuntu
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -41,6 +61,8 @@ jobs:
build-macos:

name: Build on MacOS
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: macos-latest

steps:
Expand Down

0 comments on commit 2e00457

Please sign in to comment.