RST-322: completion placeholders #1352
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: CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - "v*" | |
| pull_request: | |
| workflow_dispatch: | |
| jobs: | |
| lint-and-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| - name: Run tests | |
| run: go test ./... | |
| - name: Run mock race tests | |
| run: go test -race ./internal/mock | |
| - name: Run golangci-lint | |
| uses: golangci/golangci-lint-action@v9 | |
| with: | |
| version: v2.12.2 | |
| release-builds: | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| needs: lint-and-test | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| goos: [linux, windows, darwin] | |
| goarch: [amd64, arm64] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| - name: Build binary | |
| env: | |
| GOOS: ${{ matrix.goos }} | |
| GOARCH: ${{ matrix.goarch }} | |
| run: | | |
| set -euo pipefail | |
| mkdir -p dist | |
| VERSION="${GITHUB_REF_NAME}" | |
| COMMIT="${GITHUB_SHA::7}" | |
| DATE="$(date -u '+%Y-%m-%d %H:%M:%S UTC')" | |
| LDFLAGS="-s -w -X 'main.version=${VERSION}' -X 'main.commit=${COMMIT}' -X 'main.date=${DATE}'" | |
| case "$GOOS" in | |
| darwin) goos_label="Darwin" ;; | |
| linux) goos_label="Linux" ;; | |
| windows) goos_label="Windows" ;; | |
| *) goos_label="$GOOS" ;; | |
| esac | |
| case "$GOARCH" in | |
| amd64) goarch_label="x86_64" ;; | |
| arm64) goarch_label="arm64" ;; | |
| *) goarch_label="$GOARCH" ;; | |
| esac | |
| name="resterm_${goos_label}_${goarch_label}" | |
| if [ "$GOOS" = "windows" ]; then | |
| name="${name}.exe" | |
| fi | |
| output="dist/${name}" | |
| echo "Building version $VERSION" | |
| GOOS="$GOOS" GOARCH="$GOARCH" go build -trimpath -ldflags "$LDFLAGS" -o "$output" ./cmd/resterm | |
| # .sha256 files only serve resterm binaries with the pre-digest updater, | |
| # which look them up on the latest release to self-update. | |
| # @ToDo: Drop this once updating straight from those versions is unlikely. | |
| # @Note: the asset count in release draft must shrink to 6 at the same time. | |
| (cd dist && sha256sum "$name" > "$name.sha256") | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist-${{ matrix.goos }}-${{ matrix.goarch }} | |
| path: dist/* | |
| if-no-files-found: error | |
| # Assets are attached while the release is still a draft, so /releases/latest | |
| # never serves a release with missing binaries or checksums. | |
| release-draft: | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| needs: release-builds | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Download build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: dist | |
| merge-multiple: true | |
| - name: Verify release is complete | |
| run: | | |
| set -euo pipefail | |
| count=$(ls dist | wc -l) | |
| if [ "$count" -ne 12 ]; then | |
| echo "expected 12 release assets, got $count:" | |
| ls dist | |
| exit 1 | |
| fi | |
| - name: Create draft release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| draft: true | |
| files: dist/* |