61 lines
1.5 KiB
YAML
61 lines
1.5 KiB
YAML
name: "v CI/CD"
|
|
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
env:
|
|
GO_VERSION: '1.21'
|
|
|
|
jobs:
|
|
test:
|
|
name: "Tests"
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version: ${{ env.GO_VERSION }}
|
|
- run: . script/test.sh
|
|
format:
|
|
name: "Formatting check"
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version: ${{ env.GO_VERSION }}
|
|
- run: . script/format.sh
|
|
integration-tests:
|
|
name: "Integration tests"
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
V_ROOT: /tmp/v
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version: ${{ env.GO_VERSION }}
|
|
- run: . integration/install_specific_version.sh
|
|
build:
|
|
name: "Build"
|
|
runs-on: ubuntu-latest
|
|
needs: [test,format,integration-tests]
|
|
strategy:
|
|
matrix:
|
|
dist: ["darwin_amd64", "darwin_arm64", "linux_amd64"]
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version: ${{ env.GO_VERSION }}
|
|
- run: PROD=$PROD GOOS=${DIST%_*} GOARCH=${DIST#*_} . script/build.sh
|
|
env:
|
|
DIST: ${{ matrix.dist }}
|
|
PROD: ${{ github.ref == 'refs/heads/main' && '1' || '' }}
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: build-${{matrix.dist}}
|
|
path: ./build/**/*
|