Skip to content

FEATURE: add github workflows #10

FEATURE: add github workflows

FEATURE: add github workflows #10

Workflow file for this run

name: launcher_go
on:
push:
branches:
- main
paths:
- "launcher_go/**"
- ".github/workflows/launcher_go.yml"
pull_request:
paths:
- "launcher_go/**"
- ".github/workflows/launcher_go.yml"
jobs:
lint:
runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
fail-fast: true
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ">=1.21.0"
- name: Run gofmt
working-directory: ./launcher_go/v2
run: |
if [ "$(gofmt -l . | wc -l)" -gt 0 ]; then
exit 1
fi
test:
runs-on: ${{ matrix.os }}
timeout-minutes: 5
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ">=1.21.0"
- name: Run tests
working-directory: ./launcher_go/v2
run: go test ./...
build_latest:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
permissions:
contents: write
runs-on: ubuntu-latest
needs: [lint, test]
strategy:
matrix:
goos: [linux, darwin]
goarch: ["386", amd64, arm64]
exclude:
- goarch: "386"
goos: darwin
steps:
- uses: actions/checkout@v4
- uses: wangyoucao577/go-release-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
project_path: ./launcher_go/v2
binary_name: launcher2
overwrite: true
release_tag: latest
add_version:
runs-on: ubuntu-latest
needs: build_latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ">=1.21.0"
- run: go run ./... --version > ../../launcher_version.txt
working-directory: ./launcher_go/v2
- name: upload version
uses: softprops/action-gh-release@v2
with:
tag_name: latest
files: launcher_version.txt
build_release:
if: github.event_name == 'release'
permissions:
contents: write
runs-on: ubuntu-latest
needs: [lint, test]
strategy:
matrix:
goos: [linux, darwin]
goarch: ["386", amd64, arm64]
exclude:
- goarch: "386"
goos: darwin
steps:
- uses: actions/checkout@v4
- uses: wangyoucao577/go-release-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
project_path: ./launcher_go/v2
binary_name: launcher2