ci - main reusable caller #19268
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: ci - main reusable caller | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| source_repo: | |
| description: "Define the git repo used for the build" | |
| required: true | |
| default: "https://github.com/esnet/iperf.git" | |
| source_branch: | |
| description: "Specify the branch or tag to build" | |
| required: true | |
| default: "master" | |
| skip_new_tag_check: | |
| description: "Bypass new tag check to force build?" | |
| required: true | |
| default: false | |
| type: boolean | |
| linux_build_type: | |
| description: "Build Linux iperf3 via crossbuild" | |
| required: true | |
| default: false | |
| type: boolean | |
| artifacts_only: | |
| description: "Skip release - artifacts only" | |
| required: true | |
| default: false | |
| type: boolean | |
| linux: | |
| description: "Skip Linux build" | |
| type: boolean | |
| required: true | |
| default: false | |
| windows: | |
| description: "Skip Windows build" | |
| type: boolean | |
| required: true | |
| default: false | |
| osx: | |
| description: "Skip OSX builds" | |
| type: boolean | |
| required: true | |
| default: false | |
| skip_rerun: | |
| description: "Skip rerun?" | |
| required: true | |
| default: false | |
| type: boolean | |
| retries: | |
| description: "Number of rerun retries" | |
| required: true | |
| default: "2" | |
| type: choice | |
| options: ["1", "2", "3", "4", "5", "6", "7", "8", "9"] | |
| schedule: | |
| - cron: "*/5 * * * *" # every 5 minutes | |
| permissions: {} | |
| env: | |
| GH_TOKEN: "${{ github.TOKEN }}" | |
| jobs: | |
| skip_duplicate_job: | |
| runs-on: ubuntu-24.04-arm | |
| permissions: | |
| actions: write | |
| contents: read | |
| outputs: | |
| should_skip: ${{ steps.skip_check.outputs.should_skip }} | |
| steps: | |
| - id: skip_check | |
| uses: fkirc/skip-duplicate-actions@f75f66ce1886f00957d99748a42c724f4330bdcf # v5.3.1 | |
| with: | |
| concurrent_skipping: "always" | |
| cancel_others: "false" | |
| skip_after_successful_duplicate: false | |
| do_not_skip: "" | |
| scheduled_defaults: | |
| if: needs.skip_duplicate_job.outputs.should_skip != 'true' | |
| needs: skip_duplicate_job | |
| runs-on: ubuntu-24.04-arm | |
| permissions: | |
| contents: read | |
| outputs: | |
| source_repo: ${{ github.event.inputs.source_repo || 'https://github.com/esnet/iperf.git' }} | |
| source_branch: ${{ github.event.inputs.source_branch || 'master' }} | |
| artifacts_only: ${{ github.event.inputs.artifacts_only || 'false' }} | |
| skip_new_tag_check: ${{ github.event.inputs.skip_new_tag_check || 'false' }} | |
| linux_build_type: ${{ github.event.inputs.linux_build_type || 'false' }} | |
| linux: ${{ github.event.inputs.linux || 'false' }} | |
| windows: ${{ github.event.inputs.windows || 'false' }} | |
| osx: ${{ github.event.inputs.osx || 'false' }} | |
| skip_rerun: ${{ github.event.inputs.skip_rerun || 'false' }} | |
| retries: ${{ github.event.inputs.retries || '1' }} | |
| steps: | |
| - name: Setting Outputs from inputs | |
| run: | | |
| printf '%b\n\n' "Setting Outputs from Inputs" | |
| printf '%b\n\n' "Checking required secrets are set" >> $GITHUB_STEP_SUMMARY | |
| if [[ -z "${{ secrets.VT_API_KEY }}" ]]; then | |
| printf '%b\n\n' "VT_API_KEY is not set. Exiting..." >> $GITHUB_STEP_SUMMARY | |
| exit 1 | |
| fi | |
| show_outputs: | |
| if: needs.skip_duplicate_job.outputs.should_skip != 'true' | |
| needs: scheduled_defaults | |
| runs-on: ubuntu-24.04-arm | |
| env: | |
| source_repo: ${{ needs.scheduled_defaults.outputs.source_repo }} | |
| source_branch: ${{ needs.scheduled_defaults.outputs.source_branch }} | |
| artifacts_only: ${{ needs.scheduled_defaults.outputs.artifacts_only }} | |
| skip_new_tag_check: ${{ needs.scheduled_defaults.outputs.skip_new_tag_check }} | |
| linux_build_type: ${{ needs.scheduled_defaults.outputs.linux_build_type }} | |
| linux: ${{ needs.scheduled_defaults.outputs.linux }} | |
| windows: ${{ needs.scheduled_defaults.outputs.windows }} | |
| osx: ${{ needs.scheduled_defaults.outputs.osx }} | |
| skip_rerun: ${{ needs.scheduled_defaults.outputs.skip_rerun }} | |
| retries: ${{ needs.scheduled_defaults.outputs.retries }} | |
| steps: | |
| - name: Set output | |
| run: | | |
| printf '%b\n' "# Scheduled Defaults Outputs Summary" >> $GITHUB_STEP_SUMMARY | |
| printf '\n%b\n' ":octocat: Here is a summary of inputs set as string outputs that are used in workflows." >> $GITHUB_STEP_SUMMARY | |
| printf '\n%b\n' "source_repo: \`${source_repo}\`" >> $GITHUB_STEP_SUMMARY | |
| printf '\n%b\n' "source_branch: \`${source_branch}\`" >> $GITHUB_STEP_SUMMARY | |
| printf '\n%b\n' "artifacts_only: \`${artifacts_only}\`" >> $GITHUB_STEP_SUMMARY | |
| printf '\n%b\n' "skip_new_tag_check: \`${skip_new_tag_check}\`" >> $GITHUB_STEP_SUMMARY | |
| printf '\n%b\n' "linux_build_type: \`${linux_build_type}\`" >> $GITHUB_STEP_SUMMARY | |
| printf '\n%b\n' "linux: \`${linux}\`" >> $GITHUB_STEP_SUMMARY | |
| printf '\n%b\n' "windows: \`${windows}\`" >> $GITHUB_STEP_SUMMARY | |
| printf '\n%b\n' "osx: \`${osx}\`" >> $GITHUB_STEP_SUMMARY | |
| printf '\n%b\n' "skip_rerun: \`${skip_rerun}\`" >> $GITHUB_STEP_SUMMARY | |
| printf '\n%b\n' "retries: \`${retries}\`" >> $GITHUB_STEP_SUMMARY | |
| iperf3_tag: | |
| needs: scheduled_defaults | |
| if: needs.scheduled_defaults.outputs.skip_new_tag_check == 'false' && needs.skip_duplicate_job.outputs.should_skip != 'true' | |
| uses: ./.github/workflows/ci-check-for-new-release-tag.yml | |
| linux_emulation: | |
| needs: [scheduled_defaults, iperf3_tag] | |
| if: > | |
| always() && !failure() && !cancelled() && | |
| ( needs.iperf3_tag.outputs.continue_build == 'yes' || needs.scheduled_defaults.outputs.skip_new_tag_check == 'true' ) && | |
| ( needs.scheduled_defaults.outputs.linux == 'false' && needs.scheduled_defaults.outputs.linux_build_type == 'false' && needs.skip_duplicate_job.outputs.should_skip != 'true' ) | |
| permissions: | |
| id-token: write | |
| attestations: write | |
| contents: read | |
| uses: ./.github/workflows/ci-linux-emulation.yml | |
| secrets: | |
| VT_API_KEY: ${{ secrets.VT_API_KEY || '' }} | |
| with: | |
| source_repo: ${{ needs.scheduled_defaults.outputs.source_repo }} | |
| source_branch: ${{ needs.iperf3_tag.outputs.iperf3_tag || needs.scheduled_defaults.outputs.source_branch }} | |
| linux_crossbuild: | |
| needs: [scheduled_defaults, iperf3_tag] | |
| if: > | |
| always() && !failure() && !cancelled() && | |
| ( needs.iperf3_tag.outputs.continue_build == 'yes' || needs.scheduled_defaults.outputs.skip_new_tag_check == 'true' ) && | |
| ( needs.scheduled_defaults.outputs.linux == 'false' && needs.scheduled_defaults.outputs.linux_build_type == 'true' && needs.skip_duplicate_job.outputs.should_skip != 'true' ) | |
| permissions: | |
| id-token: write | |
| attestations: write | |
| contents: read | |
| uses: ./.github/workflows/ci-linux-crossbuild.yml | |
| secrets: | |
| VT_API_KEY: ${{ secrets.VT_API_KEY || '' }} | |
| with: | |
| source_repo: ${{ needs.scheduled_defaults.outputs.source_repo }} | |
| source_branch: ${{ needs.iperf3_tag.outputs.iperf3_tag || needs.scheduled_defaults.outputs.source_branch }} | |
| windows: | |
| needs: [scheduled_defaults, iperf3_tag] | |
| if: > | |
| always() && !failure() && !cancelled() && | |
| ( needs.iperf3_tag.outputs.continue_build == 'yes' || needs.scheduled_defaults.outputs.skip_new_tag_check == 'true' ) && | |
| ( needs.scheduled_defaults.outputs.windows == 'false' && needs.skip_duplicate_job.outputs.should_skip != 'true' ) | |
| permissions: | |
| id-token: write | |
| attestations: write | |
| contents: read | |
| uses: ./.github/workflows/ci-windows.yml | |
| secrets: | |
| VT_API_KEY: ${{ secrets.VT_API_KEY || '' }} | |
| with: | |
| source_repo: ${{ needs.scheduled_defaults.outputs.source_repo }} | |
| source_branch: ${{ needs.iperf3_tag.outputs.iperf3_tag || needs.scheduled_defaults.outputs.source_branch }} | |
| artifacts_only: ${{ needs.scheduled_defaults.outputs.artifacts_only }} | |
| osx: | |
| needs: [scheduled_defaults, iperf3_tag] | |
| if: > | |
| always() && !failure() && !cancelled() && | |
| ( needs.iperf3_tag.outputs.continue_build == 'yes' || needs.scheduled_defaults.outputs.skip_new_tag_check == 'true' ) && | |
| ( needs.scheduled_defaults.outputs.osx == 'false' && needs.skip_duplicate_job.outputs.should_skip != 'true' ) | |
| permissions: | |
| id-token: write | |
| attestations: write | |
| contents: read | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| runs_on: ["macos-13", "macos-14", "macos-15"] | |
| include: | |
| - runs_on: "macos-13" | |
| binary_filename: amd64-osx-13 | |
| brew_cellar: "/usr/local/Cellar" | |
| brew_install: "brew install automake" | |
| - runs_on: "macos-14" | |
| binary_filename: arm64-osx-14 | |
| brew_cellar: "/opt/homebrew/Cellar" | |
| brew_install: "brew install autoconf automake libtool" | |
| - runs_on: "macos-15" | |
| binary_filename: arm64-osx-15 | |
| brew_cellar: "/opt/homebrew/Cellar" | |
| brew_install: "brew install autoconf automake libtool" | |
| uses: ./.github/workflows/ci-osx.yml | |
| secrets: | |
| VT_API_KEY: ${{ secrets.VT_API_KEY }} | |
| with: | |
| brew_cellar: ${{ matrix.brew_cellar }} | |
| brew_install: ${{ matrix.brew_install }} | |
| runs_on: ${{ matrix.runs_on }} | |
| source_repo: ${{ needs.scheduled_defaults.outputs.source_repo }} | |
| source_branch: ${{ needs.iperf3_tag.outputs.iperf3_tag || needs.scheduled_defaults.outputs.source_branch }} | |
| binary_filename: ${{ matrix.binary_filename }} | |
| release: | |
| needs: [scheduled_defaults, linux_emulation, linux_crossbuild, windows, osx] | |
| if: > | |
| always() && !failure() && !cancelled() && | |
| ( needs.linux_emulation.result == 'success' || needs.linux_crossbuild.result == 'success' || needs.windows.result == 'success' || needs.osx.result == 'success' ) && | |
| !contains(needs.*.result, 'failure') && | |
| needs.scheduled_defaults.outputs.artifacts_only == 'false' && | |
| needs.skip_duplicate_job.outputs.should_skip != 'true' | |
| permissions: | |
| contents: write | |
| uses: ./.github/workflows/ci-release.yml | |
| with: | |
| release_tags: ${{ needs.linux_emulation.outputs.release_tags || needs.linux_crossbuild.outputs.release_tags || needs.windows.outputs.release_tags || needs.osx.outputs.release_tags }} | |
| test_linux_emulation: ${{ needs.linux_emulation.result }} | |
| test_linux_crossbuild: ${{ needs.linux_crossbuild.result }} | |
| test_windows: ${{ needs.windows.result }} | |
| test_osx: ${{ needs.osx.result }} | |
| docker: | |
| needs: [scheduled_defaults, linux_emulation, linux_crossbuild, release] | |
| if: > | |
| always() && !failure() && !cancelled() && | |
| ( needs.linux_emulation.result == 'success' || needs.linux_crossbuild.result == 'success' ) && | |
| !contains(needs.*.result, 'failure') && | |
| needs.scheduled_defaults.outputs.linux == 'false' && | |
| needs.scheduled_defaults.outputs.artifacts_only == 'false' && | |
| needs.skip_duplicate_job.outputs.should_skip != 'true' | |
| permissions: | |
| packages: write | |
| uses: ./.github/workflows/ci-docker.yml | |
| rerun_on_failure: | |
| needs: | |
| [ | |
| skip_duplicate_job, | |
| scheduled_defaults, | |
| show_outputs, | |
| iperf3_tag, | |
| linux_emulation, | |
| linux_crossbuild, | |
| windows, | |
| osx, | |
| release, | |
| docker, | |
| ] | |
| if: > | |
| failure() && | |
| ( needs.scheduled_defaults.outputs.skip_rerun == 'false' && needs.skip_duplicate_job.outputs.should_skip != 'true' ) | |
| concurrency: | |
| group: ci-auto-rerun-failed-jobs | |
| cancel-in-progress: true | |
| permissions: | |
| actions: write | |
| runs-on: ubuntu-24.04-arm | |
| env: | |
| GH_TOKEN: "${{ secrets.AUTO_RERUN || github.token }}" | |
| github_repo: "" # To use ci-auto-rerun-failed-jobs.yml hosted in a remote repository else default to the current repository. Requires PAT token AUTO_RERUN | |
| retries: ${{ github.event.inputs.retries || '1' }} | |
| distinct_id: ${{ github.event.inputs.distinct_id }} | |
| steps: | |
| - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 | |
| with: | |
| persist-credentials: false | |
| - name: ci-auto-rerun-failed-jobs via ${{ env.github_repo || github.repository }} | |
| run: > | |
| gh workflow run ci-auto-rerun-failed-jobs-action.yml | |
| --repo "${github_repo:-$GITHUB_REPOSITORY}" | |
| -f github_repo=${GITHUB_REPOSITORY} | |
| -f run_id=${GITHUB_RUN_ID} | |
| -f attempts=${GITHUB_RUN_ATTEMPT} | |
| -f retries=${retries} | |
| -f distinct_id=${distinct_id} |