fix(e2e): fix 3 broken destructive E2E tests #94
Workflow file for this run
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: Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Version to release (e.g., v0.2.0)' | |
| required: true | |
| permissions: | |
| contents: write | |
| jobs: | |
| detect-release-type: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| is_prerelease: ${{ steps.check.outputs.is_prerelease }} | |
| version: ${{ steps.check.outputs.version }} | |
| version_clean: ${{ steps.check.outputs.version_clean }} | |
| steps: | |
| - name: Determine release type | |
| id: check | |
| run: | | |
| if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then | |
| VERSION="${{ github.event.inputs.version }}" | |
| else | |
| VERSION="${GITHUB_REF#refs/tags/}" | |
| fi | |
| VERSION_CLEAN="${VERSION#v}" | |
| echo "version=${VERSION}" >> $GITHUB_OUTPUT | |
| echo "version_clean=${VERSION_CLEAN}" >> $GITHUB_OUTPUT | |
| if [[ ! "${VERSION}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+ ]]; then | |
| echo "ERROR: version '${VERSION}' does not match expected format vX.Y.Z[-(rc|beta|alpha).N]" | |
| exit 1 | |
| fi | |
| if [[ "${VERSION_CLEAN}" =~ (rc|beta|alpha) ]]; then | |
| echo "is_prerelease=true" >> $GITHUB_OUTPUT | |
| echo "Detected pre-release: ${VERSION}" | |
| else | |
| echo "is_prerelease=false" >> $GITHUB_OUTPUT | |
| echo "Detected stable release: ${VERSION}" | |
| fi | |
| gate-tests: | |
| needs: detect-release-type | |
| runs-on: macos-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: 'go.mod' | |
| - name: Vet | |
| run: go vet ./... | |
| - name: Unit tests | |
| run: make test-unit | |
| - name: Integration tests | |
| run: make test-integration | |
| - name: E2E tests (safe) | |
| run: make test-e2e | |
| - name: Destructive tests | |
| run: make test-destructive | |
| build: | |
| needs: [detect-release-type, gate-tests] | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| include: | |
| - os: darwin | |
| arch: amd64 | |
| - os: darwin | |
| arch: arm64 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: 'go.mod' | |
| - name: Build | |
| env: | |
| GOOS: ${{ matrix.os }} | |
| GOARCH: ${{ matrix.arch }} | |
| CGO_ENABLED: '0' | |
| run: | | |
| go build -ldflags="-s -w -X github.com/openbootdotdev/openboot/internal/cli.version=${{ needs.detect-release-type.outputs.version_clean }}" -trimpath -o openboot-${{ matrix.os }}-${{ matrix.arch }} ./cmd/openboot | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: openboot-${{ matrix.os }}-${{ matrix.arch }} | |
| path: openboot-${{ matrix.os }}-${{ matrix.arch }} | |
| smoke-test: | |
| needs: [detect-release-type, build] | |
| runs-on: macos-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: 'go.mod' | |
| - name: Download arm64 artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: openboot-darwin-arm64 | |
| path: artifacts | |
| - name: Prepare release binary for testing | |
| run: | | |
| chmod +x artifacts/openboot-darwin-arm64 | |
| cp artifacts/openboot-darwin-arm64 ./openboot | |
| - name: Verify binary version string | |
| run: | | |
| VERSION_OUTPUT=$(./openboot version 2>&1 || true) | |
| echo "Binary version output: ${VERSION_OUTPUT}" | |
| EXPECTED="${{ needs.detect-release-type.outputs.version_clean }}" | |
| if [[ "${VERSION_OUTPUT}" != *"${EXPECTED}"* ]]; then | |
| echo "ERROR: Binary version '${VERSION_OUTPUT}' does not contain expected '${EXPECTED}'" | |
| exit 1 | |
| fi | |
| - name: Run smoke tests against release binary | |
| run: make test-smoke-prebuilt | |
| - name: Upload snapshot artifact | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: smoke-test-results | |
| path: | | |
| /tmp/openboot-smoke-*.json | |
| retention-days: 7 | |
| if-no-files-found: ignore | |
| release: | |
| needs: [detect-release-type, build, smoke-test] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Generate source tarball | |
| run: | | |
| VERSION="${{ needs.detect-release-type.outputs.version }}" | |
| VERSION_CLEAN="${{ needs.detect-release-type.outputs.version_clean }}" | |
| git archive --format=tar.gz --prefix="openboot-${VERSION_CLEAN}/" -o "openboot-${VERSION_CLEAN}.tar.gz" "${VERSION}" | |
| - name: Generate checksums | |
| run: | | |
| cd artifacts | |
| find . -type f -name 'openboot-*' -exec sha256sum {} \; | sed 's|./[^/]*/||' > checksums.txt | |
| mv checksums.txt .. | |
| cd .. | |
| VERSION_CLEAN="${{ needs.detect-release-type.outputs.version_clean }}" | |
| sha256sum "openboot-${VERSION_CLEAN}.tar.gz" >> checksums.txt | |
| cat checksums.txt | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ needs.detect-release-type.outputs.version }} | |
| name: OpenBoot ${{ needs.detect-release-type.outputs.version }} | |
| draft: false | |
| prerelease: ${{ needs.detect-release-type.outputs.is_prerelease == 'true' }} | |
| files: | | |
| artifacts/openboot-darwin-amd64/openboot-darwin-amd64 | |
| artifacts/openboot-darwin-arm64/openboot-darwin-arm64 | |
| openboot-*.tar.gz | |
| checksums.txt | |
| body: | | |
| ## Installation | |
| ```bash | |
| brew install openbootdotdev/tap/openboot | |
| ``` | |
| ## Binaries | |
| | Platform | Architecture | Download | | |
| |----------|--------------|----------| | |
| | macOS | Apple Silicon (M1/M2/M3) | `openboot-darwin-arm64` | | |
| | macOS | Intel | `openboot-darwin-amd64` | | |
| update-homebrew-tap: | |
| needs: [detect-release-type, release] | |
| if: needs.detect-release-type.outputs.is_prerelease == 'false' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download release binaries and calculate SHA256 | |
| id: sha | |
| run: | | |
| VERSION="${{ needs.detect-release-type.outputs.version }}" | |
| curl -sL -o openboot-darwin-arm64 "https://github.com/openbootdotdev/openboot/releases/download/${VERSION}/openboot-darwin-arm64" | |
| curl -sL -o openboot-darwin-amd64 "https://github.com/openbootdotdev/openboot/releases/download/${VERSION}/openboot-darwin-amd64" | |
| echo "arm64=$(sha256sum openboot-darwin-arm64 | cut -d' ' -f1)" >> $GITHUB_OUTPUT | |
| echo "amd64=$(sha256sum openboot-darwin-amd64 | cut -d' ' -f1)" >> $GITHUB_OUTPUT | |
| - name: Checkout homebrew-tap | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: openbootdotdev/homebrew-tap | |
| token: ${{ secrets.HOMEBREW_TAP_TOKEN }} | |
| path: homebrew-tap | |
| - name: Update formula | |
| run: | | |
| cat > homebrew-tap/Formula/openboot.rb << 'FORMULA' | |
| class Openboot < Formula | |
| desc "Set up your macOS dev environment in one command" | |
| homepage "https://openboot.dev" | |
| version "VERSION_PLACEHOLDER" | |
| license "MIT" | |
| depends_on :macos | |
| on_arm do | |
| url "https://github.com/openbootdotdev/openboot/releases/download/vVERSION_PLACEHOLDER/openboot-darwin-arm64" | |
| sha256 "ARM64_SHA_PLACEHOLDER" | |
| end | |
| on_intel do | |
| url "https://github.com/openbootdotdev/openboot/releases/download/vVERSION_PLACEHOLDER/openboot-darwin-amd64" | |
| sha256 "AMD64_SHA_PLACEHOLDER" | |
| end | |
| def install | |
| if Hardware::CPU.arm? | |
| bin.install "openboot-darwin-arm64" => "openboot" | |
| else | |
| bin.install "openboot-darwin-amd64" => "openboot" | |
| end | |
| end | |
| test do | |
| assert_match version.to_s, shell_output("#{bin}/openboot version") | |
| end | |
| end | |
| FORMULA | |
| sed -i 's/VERSION_PLACEHOLDER/${{ needs.detect-release-type.outputs.version_clean }}/g' homebrew-tap/Formula/openboot.rb | |
| sed -i 's/ARM64_SHA_PLACEHOLDER/${{ steps.sha.outputs.arm64 }}/g' homebrew-tap/Formula/openboot.rb | |
| sed -i 's/AMD64_SHA_PLACEHOLDER/${{ steps.sha.outputs.amd64 }}/g' homebrew-tap/Formula/openboot.rb | |
| sed -i 's/^ //' homebrew-tap/Formula/openboot.rb | |
| - name: Commit and push | |
| run: | | |
| cd homebrew-tap | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add Formula/openboot.rb | |
| git diff --cached --quiet && echo "No changes" && exit 0 | |
| git commit -m "openboot ${{ needs.detect-release-type.outputs.version_clean }}" | |
| git push |