Upload Release Artifacts #1050
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: Upload Release Artifacts | |
| on: | |
| release: | |
| types: [created] | |
| workflow_dispatch: | |
| inputs: | |
| os: | |
| type: choice | |
| description: Operating System target | |
| default: linux | |
| options: | |
| - linux | |
| - macos | |
| - windows | |
| # The following options only influence workflow_dispatch, and are ignored otherwise. | |
| run_tests: | |
| description: Run CIRCT tests | |
| default: false | |
| type: boolean | |
| llvm_enable_assertions: | |
| description: Build with assertions. | |
| default: false | |
| type: boolean | |
| cmake_build_type: | |
| required: true | |
| type: choice | |
| options: | |
| - release | |
| - relwithdebinfo | |
| - debug | |
| default: release | |
| manual_release: | |
| description: Trigger a manual full release build | |
| default: false | |
| type: boolean | |
| # Run every day at 0700 UTC which is: | |
| # - 0000 PDT / 2300 PST | |
| # - 0300 EDT / 0200 EST | |
| schedule: | |
| - cron: '0 7 * * *' | |
| jobs: | |
| publish-sources: | |
| if: github.ref_type == 'tag' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write # Upload assets to release. | |
| steps: | |
| # Clone the CIRCT repo and its submodules. Do shallow clone to save clone | |
| # time. | |
| - name: Get CIRCT and LLVM | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 2 | |
| submodules: "true" | |
| # Package up sources for distribution, as the default source bundles from GitHub don't include LLVM. | |
| - name: Create Source Archive | |
| run: | | |
| touch circt-full-sources.tar.gz | |
| tar \ | |
| --exclude-vcs \ | |
| --exclude=circt-full-sources.tar.gz \ | |
| -czf \ | |
| circt-full-sources.tar.gz . | |
| shasum -a 256 circt-full-sources.tar.gz | cut -d ' ' -f1 > circt-full-sources.tar.gz.sha256 | |
| - name: Upload Source Archive | |
| uses: AButler/[email protected] | |
| with: | |
| # The * will grab the .sha256 as well | |
| files: circt-full-sources.tar.gz* | |
| repo-token: ${{ secrets.GITHUB_TOKEN }} | |
| release-tag: ${{ github.ref_name }} # Upload to release tag when manually run. | |
| # This job sets up the build matrix. | |
| choose-matrix: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Clone CIRCT as shallow as possible. We just need the `.github` | |
| # directory. | |
| - name: Get CIRCT and LLVM | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 1 | |
| submodules: "false" | |
| - name: Get Configuration | |
| id: get-config | |
| run: | | |
| case ${{ github.event_name }} in | |
| "release" | "schedule") | |
| config=$(.github/bin/uploadReleaseArtifacts.sh -e ${{ github.event_name }}) | |
| ;; | |
| "workflow_dispatch") | |
| config=$(.github/bin/uploadReleaseArtifacts.sh \ | |
| -b ${{ inputs.cmake_build_type }} \ | |
| -e ${{ github.event_name }} \ | |
| -o ${{ inputs.os }} \ | |
| ${{ inputs.llvm_enable_assertions && '-a' || ' ' }} \ | |
| ${{ inputs.run_tests && '-t' || ' ' }}) | |
| ;; | |
| esac | |
| echo "Build Matrix:" >> $GITHUB_STEP_SUMMARY | |
| echo "\`\`\`json" >> $GITHUB_STEP_SUMMARY | |
| echo "$config" >> $GITHUB_STEP_SUMMARY | |
| echo "\`\`\`" >> $GITHUB_STEP_SUMMARY | |
| static=$(echo "$config" | jq -c '.static') | |
| native=$(echo "$config" | jq -c '.native') | |
| echo "static=$static" >> $GITHUB_OUTPUT | |
| echo "native=$native" >> $GITHUB_OUTPUT | |
| outputs: | |
| static: ${{ steps.get-config.outputs.static }} | |
| native: ${{ steps.get-config.outputs.native }} | |
| publish-static: | |
| needs: | |
| - choose-matrix | |
| if: ${{ needs.choose-matrix.outputs.static != '[]' }} | |
| strategy: | |
| matrix: | |
| generated: ${{ fromJSON(needs.choose-matrix.outputs.static) }} | |
| permissions: | |
| contents: write # Upload assets to release. | |
| actions: write | |
| uses: ./.github/workflows/unifiedBuildTestAndInstallStatic.yml | |
| with: | |
| cmake_build_type: ${{ matrix.generated.cmake_build_type }} | |
| llvm_enable_assertions: ${{ matrix.generated.llvm_enable_assertions }} | |
| llvm_force_enable_stats: ${{ matrix.generated.llvm_force_enable_stats }} | |
| run_tests: ${{ matrix.generated.run_tests }} | |
| install_target: ${{ matrix.generated.install_target }} | |
| package_name_prefix: ${{ matrix.generated.package_name_prefix }} | |
| publish-native: | |
| needs: | |
| - choose-matrix | |
| if: ${{ needs.choose-matrix.outputs.native != '[]' }} | |
| strategy: | |
| matrix: | |
| generated: ${{ fromJSON(needs.choose-matrix.outputs.native) }} | |
| permissions: | |
| contents: write # Upload assets to release. | |
| actions: write | |
| uses: ./.github/workflows/unifiedBuildTestAndInstall.yml | |
| with: | |
| runner: ${{ matrix.generated.runner }} | |
| cmake_build_type: ${{ matrix.generated.cmake_build_type }} | |
| build_shared_libs: ${{ matrix.generated.build_shared_libs }} | |
| llvm_enable_assertions: ${{ matrix.generated.llvm_enable_assertions }} | |
| llvm_force_enable_stats: ${{ matrix.generated.llvm_force_enable_stats }} | |
| run_tests: ${{ matrix.generated.run_tests }} | |
| install_target: ${{ matrix.generated.install_target }} | |
| package_name_prefix: ${{ matrix.generated.package_name_prefix }} | |
| cmake_c_compiler: ${{ matrix.generated.cmake_c_compiler }} | |
| cmake_cxx_compiler: ${{ matrix.generated.cmake_cxx_compiler }} |