Commit eea656e612
Verified · cmc
Layout: unified · split
.github/workflows/ci.yml added +80
| @@ -0,0 +1,80 @@ | ||
| 1 | name: CI | |
| 2 | ||
| 3 | on: | |
| 4 | push: | |
| 5 | branches: | |
| 6 | - main | |
| 7 | pull_request: | |
| 8 | branches: | |
| 9 | - main | |
| 10 | ||
| 11 | jobs: | |
| 12 | test: | |
| 13 | name: Test | |
| 14 | runs-on: ubuntu-latest | |
| 15 | strategy: | |
| 16 | matrix: | |
| 17 | go-version: ['1.18', '1.21'] | |
| 18 | steps: | |
| 19 | - uses: actions/checkout@v7 | |
| 20 | ||
| 21 | - name: Set up Go | |
| 22 | uses: actions/setup-go@v6 | |
| 23 | with: | |
| 24 | go-version: ${{ matrix.go-version }} | |
| 25 | ||
| 26 | - name: Cache Go modules | |
| 27 | uses: actions/cache@v6 | |
| 28 | with: | |
| 29 | path: ~/go/pkg/mod | |
| 30 | key: ${{ runner.os }}-go-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }} | |
| 31 | restore-keys: | | |
| 32 | ${{ runner.os }}-go-${{ matrix.go-version }}- | |
| 33 | ||
| 34 | - name: Download dependencies | |
| 35 | run: go mod download | |
| 36 | ||
| 37 | - name: Run tests | |
| 38 | run: go test -v -race -coverprofile=coverage.out ./... | |
| 39 | ||
| 40 | - name: Upload coverage | |
| 41 | uses: codecov/codecov-action@v3 | |
| 42 | with: | |
| 43 | files: ./coverage.out | |
| 44 | flags: unittests | |
| 45 | name: codecov-umbrella | |
| 46 | ||
| 47 | lint: | |
| 48 | name: Lint | |
| 49 | runs-on: ubuntu-latest | |
| 50 | steps: | |
| 51 | - uses: actions/checkout@v7 | |
| 52 | ||
| 53 | - name: Set up Go | |
| 54 | uses: actions/setup-go@v6 | |
| 55 | with: | |
| 56 | go-version: '1.21' | |
| 57 | ||
| 58 | - name: golangci-lint | |
| 59 | uses: golangci/golangci-lint-action@v9 | |
| 60 | with: | |
| 61 | version: latest | |
| 62 | args: --timeout=5m | |
| 63 | ||
| 64 | build: | |
| 65 | name: Build | |
| 66 | runs-on: ubuntu-latest | |
| 67 | needs: [test, lint] | |
| 68 | steps: | |
| 69 | - uses: actions/checkout@v7 | |
| 70 | ||
| 71 | - name: Set up Go | |
| 72 | uses: actions/setup-go@v6 | |
| 73 | with: | |
| 74 | go-version: '1.21' | |
| 75 | ||
| 76 | - name: Build | |
| 77 | run: go build -v ./... | |
| 78 | ||
| 79 | - name: Verify module | |
| 80 | run: go mod verify | |
.github/workflows/release.yml added +21
| @@ -0,0 +1,21 @@ | ||
| 1 | name: Release | |
| 2 | ||
| 3 | on: | |
| 4 | push: | |
| 5 | tags: | |
| 6 | - 'v*' | |
| 7 | ||
| 8 | jobs: | |
| 9 | release: | |
| 10 | runs-on: ubuntu-latest | |
| 11 | steps: | |
| 12 | - uses: actions/checkout@v7 | |
| 13 | - name: Create Release | |
| 14 | uses: actions/create-release@v1 | |
| 15 | env: | |
| 16 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| 17 | with: | |
| 18 | tag_name: ${{ github.ref }} | |
| 19 | release_name: Release ${{ github.ref }} | |
| 20 | draft: false | |
| 21 | prerelease: false | |