build #1788
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: | |
| push: | |
| branches: | |
| - master | |
| - build-* # to build without PR | |
| tags: | |
| - v* | |
| pull_request: | |
| branches: | |
| - '*' | |
| schedule: | |
| - cron: "30 15 * * *" # 7:30 PST (-8), 8:30 PDT (-7) | |
| workflow_dispatch: | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: '3.0' | |
| bundler-cache: true | |
| - uses: goto-bus-stop/setup-zig@v2 | |
| with: | |
| version: 0.9.1 | |
| - name: Integration test | |
| run: bundle exec rake test:integration | |
| build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read # for uses: actions/checkout | |
| id-token: write # for uses: aactions/attest-build-provenance | |
| attestations: write # for uses: aactions/attest-build-provenance | |
| strategy: | |
| matrix: | |
| include: | |
| - { os: linux, arch: x86_64 } | |
| - { os: linux, arch: i386 } | |
| - { os: linux, arch: armhf } | |
| - { os: linux, arch: aarch64 } | |
| - { os: darwin, arch: x86_64 } | |
| - { os: darwin, arch: aarch64 } | |
| fail-fast: false | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: '3.0' | |
| bundler-cache: true | |
| - uses: goto-bus-stop/setup-zig@v2 | |
| with: | |
| version: 0.9.1 | |
| - name: Build ${{ matrix.os }}-${{ matrix.arch }} binary | |
| run: bundle exec rake release:build:${{ matrix.os }}-${{ matrix.arch }} release:compress | |
| - name: Generate artifact attestation | |
| # Since the necessary permissions cannot be set in the pull_request event, it is limited to push events. | |
| if: ${{ !startsWith(github.event_name, 'pull') }} | |
| uses: actions/attest-build-provenance@v2 | |
| with: | |
| subject-path: mitamae-build/mitamae-* | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: mitamae-${{ matrix.arch }}-${{ matrix.os }} | |
| path: mitamae-build/ | |
| checksum: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write # for uses: aactions/attest-build-provenance | |
| attestations: write # for uses: aactions/attest-build-provenance | |
| needs: | |
| - build | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| path: mitamae-build/ | |
| pattern: mitamae-* | |
| merge-multiple: true | |
| - name: Check artifacts | |
| run: tree --charset ASCII mitamae-build/ | |
| - name: Verify artifacts | |
| # Since the necessary permissions cannot be set in the pull_request event, it is limited to push events. | |
| if: ${{ !startsWith(github.event_name, 'pull') }} | |
| run: | | |
| cd mitamae-build | |
| for f in $(find . -type f -name 'mitamae-*' -printf '%f\n' | sort); do | |
| gh attestation verify "$f" -R "${GITHUB_REPOSITORY}"; | |
| done | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Generate checksum | |
| run: | | |
| cd mitamae-build | |
| echo -n > SHA256SUMS | |
| for f in $(find . -type f -name 'mitamae-*' -printf '%f\n' | sort); do | |
| sha256sum "$f" | tee -a SHA256SUMS; | |
| done | |
| - name: Verify checksum | |
| run: cd mitamae-build && sha256sum -c SHA256SUMS | |
| - name: Generate artifact attestation | |
| # Since the necessary permissions cannot be set in the pull_request event, it is limited to push events. | |
| if: ${{ !startsWith(github.event_name, 'pull') }} | |
| uses: actions/attest-build-provenance@v2 | |
| with: | |
| subject-path: mitamae-build/SHA256SUMS | |
| - name: Upload checksum | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: checksum-sha256sums | |
| path: mitamae-build/SHA256SUMS | |
| release: | |
| runs-on: ubuntu-latest | |
| needs: | |
| - test | |
| - build | |
| - checksum | |
| if: startsWith(github.ref, 'refs/tags/') | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: mitamae-x86_64-linux | |
| path: mitamae-build/ | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: mitamae-i386-linux | |
| path: mitamae-build/ | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: mitamae-armhf-linux | |
| path: mitamae-build/ | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: mitamae-aarch64-linux | |
| path: mitamae-build/ | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: mitamae-x86_64-darwin | |
| path: mitamae-build/ | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: mitamae-aarch64-darwin | |
| path: mitamae-build/ | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: checksum-sha256sums | |
| path: mitamae-build/ | |
| - name: Release | |
| run: | | |
| export VERSION=$(echo "$GITHUB_REF" | sed -e 's!refs/tags/!!') | |
| curl -L "https://github.com/tcnksm/ghr/releases/download/${GHR_VERSION}/ghr_${GHR_VERSION}_linux_amd64.tar.gz" | tar xvz | |
| "ghr_${GHR_VERSION}_linux_amd64/ghr" -u itamae-kitchen -r mitamae -replace -n "$VERSION" "$VERSION" mitamae-build/ | |
| env: | |
| GHR_VERSION: v0.13.0 | |
| GITHUB_TOKEN: ${{ secrets.GITHUBTOKEN }} |