2023-11-05 16:47:24 +00:00
|
|
|
name: "v CI/CD"
|
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
|
2024-02-01 04:00:38 +00:00
|
|
|
env:
|
|
|
|
GO_VERSION: '1.21'
|
|
|
|
|
2023-11-05 16:47:24 +00:00
|
|
|
jobs:
|
2024-02-01 04:53:09 +00:00
|
|
|
test:
|
2023-11-08 05:23:44 +00:00
|
|
|
name: "Tests"
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
2024-02-01 05:57:30 +00:00
|
|
|
- uses: actions/setup-go@v5
|
2023-11-08 05:23:44 +00:00
|
|
|
with:
|
2024-02-01 04:00:38 +00:00
|
|
|
go-version: ${{ env.GO_VERSION }}
|
2024-02-01 04:12:08 +00:00
|
|
|
- run: . script/test.sh
|
2024-02-01 04:13:33 +00:00
|
|
|
format:
|
|
|
|
name: "Formatting check"
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
2024-02-01 05:57:30 +00:00
|
|
|
- uses: actions/setup-go@v5
|
2024-02-01 04:13:33 +00:00
|
|
|
with:
|
|
|
|
go-version: ${{ env.GO_VERSION }}
|
|
|
|
- run: . script/format.sh
|
2023-11-05 16:47:24 +00:00
|
|
|
integration-tests:
|
|
|
|
name: "Integration tests"
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
env:
|
|
|
|
V_ROOT: /tmp/v
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
2024-02-01 05:57:30 +00:00
|
|
|
- uses: actions/setup-go@v5
|
2023-11-05 16:47:24 +00:00
|
|
|
with:
|
2024-02-01 04:00:38 +00:00
|
|
|
go-version: ${{ env.GO_VERSION }}
|
2024-02-01 04:12:08 +00:00
|
|
|
- run: . integration/install_specific_version.sh
|
2024-02-01 04:53:09 +00:00
|
|
|
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
|
2024-02-01 05:57:30 +00:00
|
|
|
- uses: actions/setup-go@v5
|
2024-02-01 04:53:09 +00:00
|
|
|
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/**/*
|