From e3cfad5eed067c84a5cecbc2c5ddc30984d478d4 Mon Sep 17 00:00:00 2001 From: konsalex Date: Thu, 28 Aug 2025 10:44:51 +0200 Subject: [PATCH] ci: refactor how they run --- .github/workflows/ci.yml | 23 +++++++++++++++++++ .../{hopp_core.yml => hopp_core_reusable.yml} | 13 +++++------ .../{linting.yml => lintint_reusable.yml} | 4 +--- ...tauri_rust.yml => tauri_rust_reusable.yml} | 11 ++++----- 4 files changed, 35 insertions(+), 16 deletions(-) create mode 100644 .github/workflows/ci.yml rename .github/workflows/{hopp_core.yml => hopp_core_reusable.yml} (90%) rename .github/workflows/{linting.yml => lintint_reusable.yml} (85%) rename .github/workflows/{tauri_rust.yml => tauri_rust_reusable.yml} (93%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..b2136b0 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,23 @@ +name: CI + +on: + pull_request: + branches: [main] + push: + branches: [main] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + precommit: + uses: ./.github/workflows/precommit-reusable.yml + + hopp-core: + needs: precommit + uses: ./.github/workflows/hopp-core-reusable.yml + + tauri-rust: + needs: precommit + uses: ./.github/workflows/hopp-core-reusable.yml diff --git a/.github/workflows/hopp_core.yml b/.github/workflows/hopp_core_reusable.yml similarity index 90% rename from .github/workflows/hopp_core.yml rename to .github/workflows/hopp_core_reusable.yml index c71c815..70fa4f6 100644 --- a/.github/workflows/hopp_core.yml +++ b/.github/workflows/hopp_core_reusable.yml @@ -1,11 +1,7 @@ -name: hopp_core CI +name: Hopp core package CI on: - workflow_run: - workflows: ["pre-commit"] - types: - - completed - workflow_dispatch: + workflow_call: concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -18,6 +14,9 @@ jobs: outputs: core-changed: ${{ steps.filter.outputs.core }} steps: + - run: | + echo "Last commit:" + git --no-pager log --decorate=short --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' -n1 - name: Checkout code uses: actions/checkout@v4 with: @@ -74,7 +73,7 @@ jobs: steps: - name: Checkout code - - uses: actions/checkout@v4 + uses: actions/checkout@v4 with: fetch-depth: 2 ref: ${{ github.event.workflow_run.head_sha }} diff --git a/.github/workflows/linting.yml b/.github/workflows/lintint_reusable.yml similarity index 85% rename from .github/workflows/linting.yml rename to .github/workflows/lintint_reusable.yml index a03d49c..8be7b01 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/lintint_reusable.yml @@ -1,9 +1,7 @@ name: pre-commit on: - pull_request: - push: - branches: [main] + workflow_call: jobs: pre-commit: diff --git a/.github/workflows/tauri_rust.yml b/.github/workflows/tauri_rust_reusable.yml similarity index 93% rename from .github/workflows/tauri_rust.yml rename to .github/workflows/tauri_rust_reusable.yml index 004b3f9..b3773a0 100644 --- a/.github/workflows/tauri_rust.yml +++ b/.github/workflows/tauri_rust_reusable.yml @@ -1,11 +1,7 @@ name: Tauri rust CI on: - workflow_run: - workflows: ["pre-commit"] - types: - - completed - workflow_dispatch: + workflow_call: concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -18,6 +14,9 @@ jobs: outputs: tauri-changed: ${{ steps.filter.outputs.tauri }} steps: + - run: | + echo "Last commit:" + git --no-pager log --decorate=short --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' -n1 - name: Checkout code uses: actions/checkout@v4 with: @@ -127,4 +126,4 @@ jobs: - name: Lint (clippy) working-directory: tauri/src-tauri - run: cargo clippy --target ${{ matrix.target }} --all-features -- -D warnings \ No newline at end of file + run: cargo clippy --target ${{ matrix.target }} --all-features -- -D warnings