Skip to content

Commit

Permalink
ci: switch to workflow_call with input parameter for modular workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
BayernMuller committed Jan 21, 2025
1 parent b9cca9d commit c10c237
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 31 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/build-linux-amd64.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
name: Linux AMD64

on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
workflow_dispatch:
workflow_call:
inputs:
ref:
required: true
type: string

jobs:
linux-amd64:
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}

- name: Install dependencies
run: |
Expand Down
12 changes: 7 additions & 5 deletions .github/workflows/build-linux-arm64.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
name: Linux ARM64

on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
workflow_dispatch:
workflow_call:
inputs:
ref:
required: true
type: string

jobs:
linux-arm64:
runs-on: ubuntu-22.04-arm
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}

- name: Install dependencies
run: |
Expand Down
12 changes: 7 additions & 5 deletions .github/workflows/build-macos-amd64.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
name: MacOS AMD64

on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
workflow_dispatch:
workflow_call:
inputs:
ref:
required: true
type: string

jobs:
macos-amd64:
runs-on: macos-13
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}

- name: Install dependencies
run: brew install fftw --formula
Expand Down
12 changes: 7 additions & 5 deletions .github/workflows/build-macos-arm64.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
name: MacOS ARM64

on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
workflow_dispatch:
workflow_call:
inputs:
ref:
required: true
type: string

jobs:
macos-arm64:
runs-on: macos-14
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}

- name: Install dependencies
run: brew install fftw --formula
Expand Down
12 changes: 7 additions & 5 deletions .github/workflows/build-webassembly.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: WebAssembly

on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
workflow_dispatch:
workflow_call:
inputs:
ref:
required: true
type: string

jobs:
web-assembly:
Expand All @@ -16,6 +16,8 @@ jobs:

- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}

- name: Build FFTW3 for WebAssembly
run: |
Expand Down
12 changes: 7 additions & 5 deletions .github/workflows/build-windows-amd64.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
name: Windows AMD64

on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
workflow_dispatch:
workflow_call:
inputs:
ref:
required: true
type: string

jobs:
windows-amd64:
runs-on: windows-2022
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}

- name: Install dependencies
run: vcpkg install curl:x64-windows fftw3:x64-windows
Expand Down
40 changes: 39 additions & 1 deletion .github/workflows/precheck.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ on:
jobs:
precheck:
runs-on: ubuntu-22.04
outputs:
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref_name }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -20,4 +22,40 @@ jobs:
sudo apt-get install -y build-essential cmake cpplint
- name: Check cpplint
run: cpplint --recursive lib include
run: cpplint --recursive lib include

build-linux-amd64:
needs: precheck
uses: ./.github/workflows/build-linux-amd64.yaml
with:
ref: ${{ needs.precheck.outputs.ref }}

build-linux-arm64:
needs: precheck
uses: ./.github/workflows/build-linux-arm64.yaml
with:
ref: ${{ needs.precheck.outputs.ref }}

build-macos-amd64:
needs: precheck
uses: ./.github/workflows/build-macos-amd64.yaml
with:
ref: ${{ needs.precheck.outputs.ref }}

build-macos-arm64:
needs: precheck
uses: ./.github/workflows/build-macos-arm64.yaml
with:
ref: ${{ needs.precheck.outputs.ref }}

build-windows-amd64:
needs: precheck
uses: ./.github/workflows/build-windows-amd64.yaml
with:
ref: ${{ needs.precheck.outputs.ref }}

build-webassembly:
needs: precheck
uses: ./.github/workflows/build-webassembly.yaml
with:
ref: ${{ needs.precheck.outputs.ref }}

0 comments on commit c10c237

Please sign in to comment.