Skip to content

feat: lstn to <ecosystem> <name> [[version] [shasum] | [version constraint]] #490

feat: lstn to <ecosystem> <name> [[version] [shasum] | [version constraint]]

feat: lstn to <ecosystem> <name> [[version] [shasum] | [version constraint]] #490

Workflow file for this run

name: cross-building
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
jobs:
build:
strategy:
fail-fast: false
matrix:
goos:
- linux
- darwin
- windows
go:
- "1.21"
include:
# Set the minimum Go patch version for the given Go minor
- go: "1.21"
GO_VERSION: "~1.21.0"
runs-on: ubuntu-latest
continue-on-error: true
permissions:
contents: write
steps:
- name: Check out the source code
if: ${{ github.event_name == 'push' }}
uses: actions/checkout@v4
with:
fetch-depth: 0 # Avoid running against a shallow clone
- name: Check out the source code
if: ${{ github.event_name == 'pull_request' }}
uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }} # We plan to run only against internal pull requests
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 0 # Avoid running against a shallow clone
- name: Force fetch upstream tags
run: git fetch --force --tags
- name: Set up Go ${{ matrix.go }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.GO_VERSION }}
check-latest: true
- name: Print environment
id: vars
run: |
printf "Using Go at $(which go) (version $(go version))\n"
printf "\n\nGo environment:\n\n"
go env
printf "\n\nSystem environment:\n\n"
env
- name: Build the make/make tool
run: go build -o make/make make/main.go
- name: Build
env:
GOOS: ${{ matrix.goos }}
CGO_ENABLED: 0
shell: bash
run: |
make/make GOOS=$GOOS lstn
- name: Generate docs
if: ${{ github.event_name == 'pull_request' && matrix.goos == 'linux' && matrix.go == '1.21' }}
run: |
GITHUB_ACTIONS= GITHUB_EVENT_PATH= ./lstn manual 2> docs/cheatsheet.md
./lstn config 2> docs/configuration.md
./lstn env 2> docs/environment.md
./lstn exit 2> docs/exitcodes.md
./lstn reporters 2> docs/reporters.md
- name: Update docs
if: ${{ github.event_name == 'pull_request' && matrix.goos == 'linux' && matrix.go == '1.21' }}
uses: EndBug/add-and-commit@v9
with:
default_author: github_actor
commit: --signoff
add: "docs"
message: "docs: update autogenerated docs"
push: true
- name: Archive the artifact(s)
if: ${{ matrix.go == '1.21' && matrix.goos != 'windows' }}
uses: actions/upload-artifact@v4
with:
name: artifact-${{ matrix.goos }}
path: ./lstn
retention-days: 1
- name: Archive the artifact(s)
if: ${{ matrix.go == '1.21' && matrix.goos == 'windows' }}
uses: actions/upload-artifact@v4
with:
name: artifact-${{ matrix.goos }}
path: ./lstn.exe
retention-days: 1
version-darwin:
name: "check version (darwin, 1.21)"
needs: build
runs-on: macos-latest
steps:
- name: Check out the source code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Avoid running against a shallow clone
- name: Get binaries
uses: actions/download-artifact@v4
with:
name: artifact-darwin
path: .
- name: Check short version
shell: bash
run: |
file lstn
chmod +x lstn
./lstn version
latest_tag=$(git for-each-ref --sort=-creatordate --count 1 --format="%(refname:short)" "refs/tags/v*")
[[ "lstn ${latest_tag}" == $(./lstn version 2>&1) ]]
version-linux:
name: "check version (linux, 1.21)"
needs: build
runs-on: ubuntu-latest
steps:
- name: Check out the source code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Avoid running against a shallow clone
- name: Get binaries
uses: actions/download-artifact@v4
with:
name: artifact-linux
path: .
- name: Check short version
shell: bash
run: |
file lstn
chmod +x lstn
./lstn version
latest_tag=$(git for-each-ref --sort=-creatordate --count 1 --format="%(refname:short)" "refs/tags/v*")
[[ "lstn ${latest_tag}" == $(./lstn version 2>&1) ]]
version-windows:
name: "check version (windows, 1.21)"
needs: build
runs-on: windows-latest
steps:
- name: Check out the source code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Avoid running against a shallow clone
- name: Get binaries
uses: actions/download-artifact@v4
with:
name: artifact-windows
path: .
# TODO: equality
- name: Check short version
run: |
file lstn.exe
.\lstn.exe version