Skip to content

Build and test C-PAC #1675

Build and test C-PAC

Build and test C-PAC #1675

Workflow file for this run

name: Build and test C-PAC
on:
workflow_dispatch:
jobs:
update-check:
name: Update GitHub check
runs-on: ubuntu-latest
steps:
- name: Update check's target URL
uses: Sibz/[email protected]
with:
authToken: ${{ secrets.ACTIONS_WORKFLOW_TOKEN }}
context: "Build C-PAC images"
state: pending
target_url: ${{ github.server_url }}/${{ github.repository}}/actions/runs/${{ github.run_id }}
C-PAC:
needs: update-check
uses: ./.github/workflows/build_C-PAC.yml
with:
variant: ''
C-PAC-lite:
needs: C-PAC
uses: ./.github/workflows/build_C-PAC.yml
with:
variant: lite
C-PAC-ABCD-HCP:
needs: update-check
uses: ./.github/workflows/build_C-PAC.yml
with:
variant: ABCD-HCP
C-PAC-fMRIPrep-LTS:
needs: update-check
uses: ./.github/workflows/build_C-PAC.yml
with:
variant: fMRIPrep-LTS
smoke-tests-participant:
name: Run participant-level smoke tests
needs:
- C-PAC
- C-PAC-lite
- C-PAC-ABCD-HCP
- C-PAC-fMRIPrep-LTS
runs-on: ubuntu-latest
if: github.ref_name == 'develop' || github.ref_name == 'main'
steps:
- name: Check out C-PAC
uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Participant-level smoke tests
run: gh workflow run smoke_test_participant.yml --ref ${GITHUB_REF_NAME}
env:
GITHUB_TOKEN: ${{ secrets.ACTIONS_WORKFLOW_TOKEN }}
finish-build-check:
name: Finish GitHub check
needs:
- C-PAC
- C-PAC-lite
- C-PAC-ABCD-HCP
- C-PAC-fMRIPrep-LTS
if: always()
runs-on: ubuntu-latest
steps:
- name: Update check status
run: |
result_failure="\"result\": \"failure\""
result_cancelled="\"result\": \"cancelled\""
export STATUS=failure
if [[ $NEEDS_CONTEXT != *$result_failure* && $NEEDS_CONTEXT != *$result_cancelled* ]]
then export STATUS=success
fi
echo "STATUS=$STATUS" >> $GITHUB_ENV
- name: Finish check
uses: Sibz/[email protected]
with:
authToken: ${{ secrets.ACTIONS_WORKFLOW_TOKEN }}
context: "Build C-PAC images"
state: ${{ env.STATUS }}
target_url: ${{ github.server_url }}/${{ github.repository}}/actions/runs/${{ github.run_id }}
Circle_tests:
name: Run tests on CircleCI
needs:
- C-PAC
- C-PAC-lite
- C-PAC-ABCD-HCP
- C-PAC-fMRIPrep-LTS
if: github.ref_type == 'branch'
runs-on: ubuntu-latest
steps:
- name: Check out C-PAC
uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Trigger CircleCI tests
run: |
echo "ref: $GITHUB_REF_NAME"
TEXT="Triggered pipeline at "
U1="https://circleci.com/api/v2/project/gh/${GITHUB_REPOSITORY}/pipeline"
export DATA="{\"branch\":\"$GITHUB_REF_NAME\", \"parameters\": {\"run_tests\": true}}"
echo "URL ${U1}"
echo "data ${DATA}"
PIPELINE_NUMBER=$(curl \
--request POST \
--url "${U1}" \
-u ${{ secrets.CIRCLE_API_USER_TOKEN }}: \
--header 'content-type: application/json' \
--data "${DATA}" |
jq '.number')
if [[ $PIPELINE_NUMBER == 'null' ]]
then
echo "Failed to trigger CircleCI tests"
exit 126
fi
PIPELINE_ID=$(curl \
--request GET \
--url "https://circleci.com/api/v2/project/gh/${GITHUB_REPOSITORY}/pipeline/${PIPELINE_NUMBER}" \
-u "${{ secrets.CIRCLE_API_USER_TOKEN }}:" |
jq '.id' |
tr -d '"')
# wait for workflow to get an ID
sleep 20
WORKFLOW_ID=$(curl \
--request GET \
--url "https://circleci.com/api/v2/pipeline/${PIPELINE_ID}/workflow" \
-u "${{ secrets.CIRCLE_API_USER_TOKEN }}:" |
jq '.items[0].id' |
tr -d '"')
echo ${TEXT}https://app.circleci.com/pipelines/github/${GITHUB_REPOSITORY}/${PIPELINE_NUMBER}/workflows/${WORKFLOW_ID}
Deploy_to_Docker_Hub:
needs:
- C-PAC
if: github.ref_type == 'tag'
uses: ./.github/workflows/deploy_to_Docker_Hub.yml
with:
variant: ''
secrets: inherit
Deploy_to_Docker_Hub-lite:
needs:
- C-PAC-lite
if: github.ref_type == 'tag'
uses: ./.github/workflows/deploy_to_Docker_Hub.yml
with:
variant: 'lite'
secrets: inherit
Deploy_to_Docker_Hub-ABCD-HCP:
needs:
- C-PAC-ABCD-HCP
if: github.ref_type == 'tag'
uses: ./.github/workflows/deploy_to_Docker_Hub.yml
with:
variant: 'ABCD-HCP'
secrets: inherit
Deploy_to_Docker_Hub-fMRIPrep-LTS:
needs:
- C-PAC-fMRIPrep-LTS
if: github.ref_type == 'tag'
uses: ./.github/workflows/deploy_to_Docker_Hub.yml
with:
variant: 'fMRIPrep-LTS'
secrets: inherit