Skip to content

build-devel-sofa-all #102

build-devel-sofa-all

build-devel-sofa-all #102

name: devel-sofa-all
on:
# schedule:
# Nightly launches at 1:15
# - cron: '15 1 * * *'
workflow_dispatch:
inputs:
sofa-git-sha:
description: 'SOFA git commit SHA1'
required: true
type: string
default: 'master'
sofa-git-commit-date:
description: 'SOFA git commit date'
required: true
type: string
default: 'NODATE' # for testing
sofa-python3-git-sha:
description: 'sofa-python3 git commit SHA1'
required: true
type: string
default: 'master'
sofa-python3-git-commit-date:
description: 'sofa-python3 git commit date'
required: true
type: string
default: 'NODATE' # for testing
repository_dispatch:
types: [build-devel-sofa-all]
jobs:
extract-params:
runs-on: ubuntu-slim
outputs:
sofa-git-sha: ${{ steps.params.outputs.sofa-git-sha }}
sofa-git-commit-date: ${{ steps.params.outputs.sofa-git-commit-date }}
sofa-python3-git-sha: ${{ steps.params.outputs.sofa-python3-git-sha }}
sofa-python3-git-commit-date: ${{ steps.params.outputs.sofa-python3-git-commit-date }}
steps:
- name: Extract parameters
id: params
run: |
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
echo "sofa-git-sha=${{ inputs.sofa-git-sha }}" >> $GITHUB_OUTPUT
echo "sofa-git-commit-date=${{ inputs.sofa-git-commit-date }}" >> $GITHUB_OUTPUT
echo "sofa-python3-git-sha=${{ inputs.sofa-python3-git-sha }}" >> $GITHUB_OUTPUT
echo "sofa-python3-git-commit-date=${{ inputs.sofa-python3-git-commit-date }}" >> $GITHUB_OUTPUT
elif [ "${{ github.event_name }}" == "repository_dispatch" ]; then
echo "sofa-git-sha=${{ github.event.client_payload.sofa_commit_hash }}" >> $GITHUB_OUTPUT
echo "sofa-git-commit-date=${{ github.event.client_payload.sofa_commit_date }}" >> $GITHUB_OUTPUT
echo "sofa-python3-git-sha=${{ github.event.client_payload.sofa_python3_commit_hash }}" >> $GITHUB_OUTPUT
echo "sofa-python3-git-commit-date=${{ github.event.client_payload.sofa_python3_commit_date }}" >> $GITHUB_OUTPUT
fi
- name: Check parameters
run: |
echo "✓ sofa-git-sha: ${{ steps.params.outputs.sofa-git-sha }}"
echo "✓ sofa-git-commit-date: ${{ steps.params.outputs.sofa-git-commit-date }}"
echo "✓ sofa-python3-git-sha: ${{ steps.params.outputs.sofa-python3-git-sha }}"
echo "✓ sofa-python3-git-commit-date: ${{ steps.params.outputs.sofa-python3-git-commit-date }}"
notify-begin:
runs-on: ubuntu-slim
if: ${{ github.event_name == 'repository_dispatch' }}
needs: extract-params
steps:
- name: Notify commit begin
shell: bash
run: |
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.PERF_REG_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/sofa-framework/sofa/statuses/${{ needs.extract-params.outputs.sofa-git-sha }} \
-d '{"state":"pending","target_url":"https://github.com/sofa-framework/conda-ci/actions/runs/${{ github.run_id }}","description":"Conda devel packages build started...","context":"conda-ci"}'
build-publish-sofa:
uses: ./.github/workflows/devel-sofa.yml
if: always()
needs: extract-params
with:
git-sha: ${{ needs.extract-params.outputs.sofa-git-sha }}
git-commit-date: ${{ needs.extract-params.outputs.sofa-git-commit-date }}
secrets: inherit
build-publish-sofa-python3:
uses: ./.github/workflows/devel-sofa-python3.yml
needs: [build-publish-sofa, extract-params]
if: ${{ needs.build-publish-sofa.result == 'success' }}
with:
git-sha: ${{ needs.extract-params.outputs.sofa-python3-git-sha }}
git-commit-date: ${{ needs.extract-params.outputs.sofa-python3-git-commit-date }}
sofa-git-sha: ${{ needs.extract-params.outputs.sofa-git-sha }}
secrets: inherit
notify-end:
runs-on: ubuntu-slim
if: ${{ always() && github.event_name == 'repository_dispatch' }}
needs: [extract-params, build-publish-sofa, build-publish-sofa-python3]
steps:
- name: Get status from package build
shell: bash
run: |
if [[ "${{ needs.build-publish-sofa.result }}" == "success" && "${{ needs.build-publish-sofa-python3.result }}" == "success" ]]; then
echo "COMMIT_STATUS=success" >> $GITHUB_ENV
else
echo "COMMIT_STATUS=failure" >> $GITHUB_ENV
fi
- name: Notify commit end
shell: bash
run: |
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.PERF_REG_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/sofa-framework/sofa/statuses/${{ needs.extract-params.outputs.sofa-git-sha }} \
-d '{"state":"${{ env.COMMIT_STATUS }}","target_url":"https://github.com/sofa-framework/conda-ci/actions/runs/${{ github.run_id }}","description":"Conda devel packages build completed with ${{ steps.run_perf_tests.outcome }}","context":"conda-ci"}'