Skip to content

Commit

Permalink
ci: refine github action ci and use the latest go version
Browse files Browse the repository at this point in the history
  • Loading branch information
zyy17 committed Aug 21, 2023
1 parent 9e4d922 commit 0230fec
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 19 deletions.
41 changes: 27 additions & 14 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
name: CI

on: [push, pull_request]
on: [
push,
pull_request
]

env:
GO_VERSION: "1.21"

permissions:
contents: read

jobs:
typos-check:
Expand All @@ -11,8 +20,9 @@ jobs:
uses: actions/checkout@v3
- name: Check spelling with custom config file
uses: crate-ci/[email protected]
linter:
name: linter

lint:
name: lint
runs-on: ubuntu-latest
steps:
- name: Checkout sources
Expand All @@ -21,29 +31,32 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: "1.18.4"
go-version: ${{ env.GO_VERSION }}

- name: golangci-lint
uses: golangci/golangci-lint-action@v3.3.0
uses: golangci/golangci-lint-action@v3
with:
version: v1.50.0
args: --timeout 10m0s
version: v1.54
# '-v' flag is required to show the output of golangci-lint.
args: -v

unit-test:
name: coverage-test
runs-on: ubuntu-latest
needs: [ linter ]
needs: [ lint ]
steps:
- name: Checkout sources
uses: actions/checkout@v3

- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: "1.18.4"
go-version: ${{ env.GO_VERSION }}

- name: Unit test
run: |
make coverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
Expand All @@ -52,19 +65,19 @@ jobs:
files: ./coverage.xml
name: codecov-gtctl
verbose: true
e2e-test:
name: e2e-test
e2e:
name: e2e
runs-on: ubuntu-latest
needs: [ linter ]
needs: [ lint ]
steps:
- name: Checkout sources
uses: actions/checkout@v3

- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: "1.18.4"
go-version: ${{ env.GO_VERSION }}

- name: e2e test of basic cluster
- name: Run e2e
run: |
make e2e
19 changes: 14 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
name: Release

on:
release:
types: [created]
push:
tags:
- "v*"

env:
GO_VERSION: "1.21"

jobs:
build:
Expand Down Expand Up @@ -35,7 +39,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: "1.18.4"
go-version: ${{ env.GO_VERSION }}

- name: Build project
run: |
Expand Down Expand Up @@ -76,8 +80,13 @@ jobs:
uses: actions/download-artifact@v3

- name: Publish release
uses: softprops/action-gh-release@v1
uses: ncipollo/release-action@v1
with:
name: "Release ${{ github.ref_name }}"
files: |
prerelease: false
make_release: true
generateReleaseNotes: true
allowUpdates: true
tag: ${{ github.ref_name }}
artifacts: |
**/gtctl-*

0 comments on commit 0230fec

Please sign in to comment.