chore: add self hosted runner #26
Workflow file for this run
This file contains 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: Lint, build and upload Igitt | |
on: | |
push: | |
branches: ["main"] | |
tags: | |
- "v[0-9]+.[0-9]+.[0-9]+" | |
pull_request: | |
branches: ["main"] | |
jobs: | |
lint: | |
runs-on: self-hosted | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: "1.23" | |
- name: Lint | |
run: | | |
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest | |
golangci-lint run | |
test: | |
needs: lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: "1.23" | |
- name: Test | |
run: go test -v ./... | |
build: | |
needs: [lint, test] | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
goos: [linux, windows, darwin] | |
goarch: [amd64, arm64] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-tags: true | |
fetch-depth: 0 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: "1.23" | |
- name: Set GOOS and GOARCH | |
run: | | |
echo "GOOS=${{ matrix.goos }}" >> $GITHUB_ENV | |
echo "GOARCH=${{ matrix.goarch }}" >> $GITHUB_ENV | |
- name: Get latest tag and short commit SHA | |
run: | | |
echo "LATEST_TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV | |
echo "SHORT_COMMIT=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | |
- name: Build | |
run: | | |
if [[ "${{ matrix.goos }}" == "windows" ]]; then \ | |
go build -v -o out/igitt.exe ./cmd/igitt; \ | |
else \ | |
go build -v -o out/igitt ./cmd/igitt; \ | |
fi | |
- name: Upload Build Artifact | |
uses: actions/[email protected] | |
with: | |
name: igitt-${{ matrix.goos }}-${{ matrix.goarch }}-${{ env.LATEST_TAG }}-${{ env.SHORT_COMMIT }} | |
path: | | |
out/igitt* |