diff --git a/.github/untar_func-e_release.sh b/.github/untar_func-e_release.sh deleted file mode 100755 index d8057ff2..00000000 --- a/.github/untar_func-e_release.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh -ue -# -# This script extracts "func-e" for a specific release tag. The release can be a draft. -# Ex. GITHUB_TOKEN=your_repo_token .github/untar_func-e_release.sh v0.3.0 - -# Crash early on any missing prerequisites -tag_name=$1 -curl --version >/dev/null -go version >/dev/null -jq --version >/dev/null -tar --version >/dev/null - -# strip the v off the tag name more shell portable than ${tag_name:1} -version=$(echo "${tag_name}" | cut -c2-100) || exit 1 - -# form the asset name you'd find on the release page -tarball="func-e_${version}_$(go env GOOS)_$(go env GOARCH).tar.gz" || exit 1 -curl="curl -fsSL" - -# Lookup the last 10 releases, knowing the one we are looking for may not be published. -# See https://docs.github.com/en/rest/reference/repos#list-releases -echo "looking for release that contains ${tarball}" -tarball_url=$(${curl} -H "Authorization: token ${GITHUB_TOKEN}" https://api.github.com/repos/tetratelabs/func-e/releases?per_page=10 | - jq -er ".|first|.assets|map(select(.name == \"${tarball}\"))|first|.url") || exit 1 - -# Extract func-e to the current directory per https://docs.github.com/en/rest/reference/repos#get-a-release-asset -echo "extracting func-e from ${tarball_url}" -${curl} -H "Authorization: token ${GITHUB_TOKEN}" -H'Accept: application/octet-stream' "${tarball_url}" | tar -xzf - func-e -./func-e -version diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index f2db939b..bf1808e5 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -32,15 +32,25 @@ jobs: run: make release e2e: + needs: func-e name: Run e2e tests (${{ matrix.os }}) - needs: - - func-e runs-on: ${{ matrix.os }} timeout-minutes: 90 # instead of 360 by default strategy: - fail-fast: false # don't fail fast as sometimes failures are operating system specific matrix: - os: [ ubuntu-latest, macos-latest ] + include: + - os: ubuntu-latest + pattern: '*linux_amd64.tar.gz' + - os: macos-latest + pattern: '*darwin_amd64.tar.gz' + - os: windows-latest + pattern: '*windows_amd64.zip' + unzip: unzip -o *.zip && rm *.zip + + defaults: + run: # use bash for all operating systems unless overridden + shell: bash + steps: - name: "Checkout" uses: actions/checkout@v2 @@ -51,13 +61,20 @@ jobs: go-version: ${{ env.GO_VERSION }} - name: "Extract `func-e` binary from GitHub release assets" - run: .github/untar_func-e_release.sh ${GITHUB_REF#refs/*/} + run: | + gh release download "${GITHUB_REF#refs/tags/}" -p '${{ matrix.pattern }}' + ${{ matrix.unzip || tar -xzf *.tar.gz && rm *.tar.gz }} env: # authenticate as the release is a draft GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: "Run e2e tests using released `func-e` binary" run: go test -parallel 1 -v -failfast ./e2e + homebrew: + needs: e2e + name: Bump homebrew-core formula + runs-on: ubuntu-latest + steps: - name: Bump homebrew-core formula uses: mislav/bump-homebrew-formula-action@v1 with: diff --git a/internal/moreos/moreos.go b/internal/moreos/moreos.go index d5c1e1fb..2613eb4b 100644 --- a/internal/moreos/moreos.go +++ b/internal/moreos/moreos.go @@ -26,6 +26,7 @@ import ( const ( // Exe is the runtime.GOOS-specific suffix for executables. Ex. "" unless windows which is ".exe" + // See https://github.com/golang/go/issues/47567 for formalization Exe = exe // OSDarwin is a Platform.OS a.k.a. "macOS" OSDarwin = "darwin"