Skip to content

Commit

Permalink
Add standalone_suffix pick job in CI for cases where PR is run by a s…
Browse files Browse the repository at this point in the history
…erver-sync action.
  • Loading branch information
PProfizi committed Dec 12, 2023
1 parent f7484b5 commit 35b556d
Showing 1 changed file with 42 additions and 7 deletions.
49 changes: 42 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,34 @@ jobs:
env:
GITHUB_CONTEXT: ${{ toJson(github) }}

pick_server_suffix:
runs-on: ubuntu-latest
id: server
outputs:
suffix: ${{ steps.step1.outputs.suffix }}
steps:
- name: Define server branch suffix to use
- id: step1
run: |
if [[ ${{ github.event_name == 'push' }} ]]; then
echo "suffix=''" >> "$GITHUB_OUTPUT"
fi
if [[ ${{ github.event_name == 'workflow_dispatch' }} ]]; then
echo "suffix=${{ github.event.inputs.standalone_branch_suffix }}" >> "$GITHUB_OUTPUT"
fi
if [[ ${{ github.event_name == 'pull_request' }} ]]; then
suffix=''
# If the PR is server-sync then extract suffix from branch name
sub='maint/update_code_for_'
if [[ "${{ github.ref_name }}" == *"$sub"* ]]; then
ref_name=${{ github.ref_name }}
base_ref=${{ github.base_ref }}
suffix=${ref_name/$sub[0-9][0-9][0-9]/''}
suffix=${suffix/_on_$base_ref/''}
fi
echo "suffix=$suffix" >> "$GITHUB_OUTPUT"
fi
style:
name: "Style Check"
runs-on: ubuntu-latest
Expand Down Expand Up @@ -80,48 +108,53 @@ jobs:

tests:
uses: ./.github/workflows/tests.yml
needs: pick_server_suffix
with:
ANSYS_VERSION: "242"
python_versions: '["3.9"]'
wheel: true
wheelhouse: false
standalone_suffix: ${{ github.event.inputs.standalone_branch_suffix || '' }}
standalone_suffix: ${{needs.pick_server_suffix.outputs.suffix}}
secrets: inherit

tests_any:
uses: ./.github/workflows/tests.yml
needs: pick_server_suffix
with:
ANSYS_VERSION: "242"
python_versions: '["3.9"]'
wheel: true
wheelhouse: false
standalone_suffix: ${{ github.event.inputs.standalone_branch_suffix || '' }}
standalone_suffix: ${{needs.pick_server_suffix.outputs.suffix}}
test_any: true
secrets: inherit

docker_tests:
name: "Build and Test on Docker"
uses: ./.github/workflows/test_docker.yml
needs: pick_server_suffix
with:
ANSYS_VERSION: "242"
standalone_suffix: ${{ github.event.inputs.standalone_branch_suffix || '' }}
standalone_suffix: ${{needs.pick_server_suffix.outputs.suffix}}
secrets: inherit

docker_examples:
name: "Run examples on Docker"
uses: ./.github/workflows/examples_docker.yml
needs: pick_server_suffix
with:
ANSYS_VERSION: "242"
python_versions: '["3.9"]'
standalone_suffix: ${{ github.event.inputs.standalone_branch_suffix || '' }}
standalone_suffix: ${{needs.pick_server_suffix.outputs.suffix}}
secrets: inherit

docs:
if: startsWith(github.head_ref, 'master') || github.event.action == 'ready_for_review' || !github.event.pull_request.draft
uses: ./.github/workflows/docs.yml
needs: pick_server_suffix
with:
ANSYS_VERSION: "242"
standalone_suffix: ${{ github.event.inputs.standalone_branch_suffix || '' }}
standalone_suffix: ${{needs.pick_server_suffix.outputs.suffix}}
event_name: ${{ github.event_name }}
secrets: inherit

Expand Down Expand Up @@ -156,10 +189,11 @@ jobs:
examples:
if: startsWith(github.head_ref, 'master') || github.event.action == 'ready_for_review' || !github.event.pull_request.draft
uses: ./.github/workflows/examples.yml
needs: pick_server_suffix
with:
ANSYS_VERSION: "242"
python_versions: '["3.9"]'
standalone_suffix: ${{ github.event.inputs.standalone_branch_suffix || '' }}
standalone_suffix: ${{needs.pick_server_suffix.outputs.suffix}}
secrets: inherit

retro_241:
Expand Down Expand Up @@ -208,9 +242,10 @@ jobs:
name: "PyDPF-Post"
if: startsWith(github.head_ref, 'master') || github.event.action == 'ready_for_review' || !github.event.pull_request.draft
uses: ./.github/workflows/pydpf-post.yml
needs: pick_server_suffix
with:
ANSYS_VERSION: "242"
post_branch: "master"
standalone_suffix: ${{ github.event.inputs.standalone_branch_suffix || '' }}
standalone_suffix: ${{needs.pick_server_suffix.outputs.suffix}}
test_docstrings: "true"
secrets: inherit

0 comments on commit 35b556d

Please sign in to comment.