Skip to content

Commit

Permalink
Separated ci-tests workflow to be a reusable workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
gbruer15 committed Sep 4, 2024
1 parent f2b32be commit 86b5b06
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 11 deletions.
1 change: 0 additions & 1 deletion .github/workflows/auto-format.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ jobs:
auto-format:
name: Run JuliaFormatter and create pull request
runs-on: ubuntu-latest
if: ${{ github.event_name != 'pull_request' || !github.event.pull_request.isDraft }}
steps:
- name: Set base branch automatically
if: inputs.base_branch == ''
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: PR Check
name: All Checks
on:
pull_request:
types: [ready_for_review, synchronize]
Expand All @@ -12,10 +12,15 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

if: ${{ github.event_name != 'pull_request' || !github.event.pull_request.isDraft }}

jobs:
format:
uses: ./.github/workflows/auto-format.yaml
secrets: inherit
docs:
uses: ./.github/workflows/docs.yaml
secrets: inherit
docs:
uses: ./.github/workflows/ci-tests.yaml
secrets: inherit
38 changes: 29 additions & 9 deletions .github/workflows/ci-tests.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,38 @@
name: CI Tests
on:
pull_request:
types: [ready_for_review, synchronize]
push:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
workflow_call:
inputs:
target_ref:
required: false
type: string
workflow_dispatch:
inputs:
target_ref:
description: 'Commit or branch to run tests'
default: 'main'
required: false
type: string

jobs:
read-params:
name: Get branch or commit ID
runs-on: ubuntu-latest
outputs:
target_ref: ${{ env.target_ref }}
steps:
- name: Set target ref automatically
if: inputs.target_ref == ''
run: |
echo "target_ref=${{ github.head_ref || github.ref_name }}" >> $GITHUB_ENV
- name: Read target ref from inputs
if: inputs.target_ref
run: |
echo 'target_ref=${{ inputs.target_ref }}' >> $GITHUB_ENV
echo 'formatter_branch=auto-formatter/${{ inputs.target_ref }}' >> $GITHUB_ENV
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
runs-on: ${{ matrix.os }}
needs: read-params
timeout-minutes: 60
permissions:
actions: write
Expand Down Expand Up @@ -41,6 +60,7 @@ jobs:
echo "JOB_NAME=$JOB_NAME" >> $GITHUB_ENV
- uses: actions/checkout@v4
with:
ref: ${{needs.read-params.outputs.target_ref }}
submodules: recursive
- uses: julia-actions/setup-julia@v2
with:
Expand Down

0 comments on commit 86b5b06

Please sign in to comment.