feat: Sort output in scenario output (#169)
#142
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: build | |
| on: | |
| # Run the build workflow manually from GitHub Actions menu | |
| workflow_dispatch: | |
| # Run the build workflow on merge to main | |
| push: | |
| branches: | |
| - main | |
| env: | |
| PKG_NAME: "enos" | |
| jobs: | |
| product-metadata: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| filepath: ${{ steps.generate-metadata-file.outputs.filepath }} | |
| product-version: ${{ steps.product-metadata.outputs.product-version }} | |
| steps: | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| - id: product-metadata | |
| run: | | |
| make version | |
| echo "product-version=$(make version)" >> "$GITHUB_OUTPUT" | |
| - id: generate-metadata-file | |
| uses: hashicorp/actions-generate-metadata@main | |
| with: | |
| version: ${{ steps.product-metadata.outputs.product-version }} | |
| product: ${{ env.PKG_NAME }} | |
| - uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 | |
| with: | |
| name: metadata.json | |
| path: ${{ steps.generate-metadata-file.outputs.filepath }} | |
| profile-binary: | |
| runs-on: ubuntu-latest | |
| env: | |
| GOPRIVATE: 'github.com/hashicorp/*' | |
| TOKEN: ${{ secrets.ELEVATED_GITHUB_TOKEN }} | |
| outputs: | |
| profile-path: ${{ steps.final-profile.outputs.profile-path }} | |
| steps: | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 | |
| with: | |
| go-version-file: go.mod | |
| - id: product-metadata | |
| run: | | |
| make version | |
| echo "product-version=$(make version)" >> "$GITHUB_OUTPUT" | |
| - uses: ./.github/actions/build | |
| name: Standard build | |
| with: | |
| bundle: false | |
| goarch: amd64 | |
| goos: linux | |
| version: ${{ steps.product-metadata.outputs.product-version }} | |
| - uses: ./.github/actions/profile-build | |
| name: Profile standard build | |
| with: | |
| upload-profile: false | |
| - uses: ./.github/actions/build | |
| name: Optimized build | |
| with: | |
| bundle: false | |
| goarch: amd64 | |
| goos: linux | |
| pgo: true | |
| version: ${{ steps.product-metadata.outputs.product-version }} | |
| - uses: ./.github/actions/profile-build | |
| id: final-profile | |
| name: Profile optimized build | |
| build: | |
| needs: | |
| - product-metadata | |
| - profile-binary | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| goos: [linux, darwin] | |
| goarch: [amd64, arm64] | |
| include: | |
| - goos: linux | |
| goarch: s390x | |
| fail-fast: true | |
| name: Go ${{ matrix.goos }} ${{ matrix.goarch }} build | |
| env: | |
| GOPRIVATE: 'github.com/hashicorp/*' | |
| TOKEN: ${{ secrets.ELEVATED_GITHUB_TOKEN }} | |
| outputs: | |
| artifact-name: ${{ steps.build.outputs.artifact-name }} | |
| steps: | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 | |
| with: | |
| go-version-file: go.mod | |
| - uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0 | |
| id: download | |
| with: | |
| name: ${{ needs.profile-binary.outputs.profile-path }} | |
| - uses: ./.github/actions/build | |
| name: Build | |
| id: build | |
| with: | |
| goarch: ${{ matrix.goarch }} | |
| goos: ${{ matrix.goos }} | |
| pgo: true | |
| version: ${{ needs.product-metadata.outputs.product-version }} | |
| - name: Upload Artifacts | |
| uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 | |
| with: | |
| name: ${{ steps.build.outputs.artifact-name }} | |
| path: ${{ steps.build.outputs.artifact-path }} | |
| retention-days: 1 | |
| - if: ${{ matrix.goos == 'linux' }} | |
| uses: hashicorp/actions-packaging-linux@129994a18b8e7dc106937edf859fddd97af66365 # v1.10 | |
| with: | |
| name: ${{ github.event.repository.name }} | |
| description: "enos CLI package" | |
| arch: ${{ matrix.goarch }} | |
| version: ${{ needs.product-metadata.outputs.product-version }} | |
| maintainer: "HashiCorp" | |
| homepage: "https://github.com/hashicorp/enos" | |
| license: "MPL-2.0" | |
| binary: "dist/${{ env.PKG_NAME }}" | |
| deb_depends: "openssl" | |
| rpm_depends: "openssl" | |
| - name: Set Package Names | |
| if: ${{ matrix.goos == 'linux' && matrix.goarch != 's390x' }} | |
| run: | | |
| echo "RPM_PACKAGE=$(basename out/*.rpm)" >> "$GITHUB_ENV" | |
| echo "DEB_PACKAGE=$(basename out/*.deb)" >> "$GITHUB_ENV" | |
| - name: Upload RHEL Packages | |
| uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 | |
| if: ${{ matrix.goos == 'linux' && matrix.goarch != 's390x' }} | |
| with: | |
| name: ${{ env.RPM_PACKAGE }} | |
| path: out/${{ env.RPM_PACKAGE }} | |
| - name: Upload Debian Packages | |
| uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 | |
| if: ${{ matrix.goos == 'linux' && matrix.goarch != 's390x' }} | |
| with: | |
| name: ${{ env.DEB_PACKAGE }} | |
| path: out/${{ env.DEB_PACKAGE }} | |
| build-docker: | |
| name: Docker ${{ matrix.arch }} build | |
| needs: | |
| - product-metadata | |
| - build | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| arch: ["arm64", "amd64", "s390x"] | |
| env: | |
| repo: ${{github.event.repository.name}} | |
| version: ${{needs.product-metadata.outputs.product-version}} | |
| GOPRIVATE: 'github.com/hashicorp/*' | |
| TOKEN: ${{ secrets.ELEVATED_GITHUB_TOKEN }} | |
| steps: | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| - uses: hashicorp/actions-docker-build@200254326a30d7b747745592f8f4d226bbe4abe4 # v2.2.0 | |
| with: | |
| version: ${{env.version}} | |
| target: default | |
| arch: ${{matrix.arch}} | |
| tags: | | |
| docker.io/hashicorp/${{env.repo}}:${{env.version}} | |
| 986891699432.dkr.ecr.us-east-1.amazonaws.com/hashicorp/${{env.repo}}:${{env.version}} | |
| validate-artifact: | |
| name: Validate Artifact | |
| needs: [build, product-metadata] | |
| uses: ./.github/workflows/validate.yml | |
| with: | |
| artifact-name: "enos_${{ needs.product-metadata.outputs.product-version }}_linux_amd64.zip" | |
| secrets: inherit |