Skip to content
This repository was archived by the owner on Jun 25, 2024. It is now read-only.

Commit

Permalink
Merge pull request #13 from KusionStack/refine-workflow-configurations
Browse files Browse the repository at this point in the history
  • Loading branch information
elliotxx authored May 15, 2022
2 parents 4d9384b + c83a960 commit 1a18515
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 31 deletions.
53 changes: 46 additions & 7 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,50 @@ on:
permissions:
contents: write
jobs:
goreleaser:
Test:
name: Unit tests with coverage
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Go 1.17
uses: actions/setup-go@v2
with:
go-version: 1.17
- name: Running go tests with coverage
env:
GO111MODULE: on
run: make cover
- name: Send coverage
uses: shogo82148/actions-goveralls@v1
with:
path-to-profile: coverage.out
Lint:
name: Lint checks
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Go 1.17
uses: actions/setup-go@v2
with:
go-version: 1.17
- name: Download golangci-lint
run: |
wget https://github.com/golangci/golangci-lint/releases/download/v1.41.0/golangci-lint-1.41.0-linux-amd64.tar.gz
tar -xvf ./golangci-lint-1.41.0-linux-amd64.tar.gz
- name: Running golangci-lint
env:
GO111MODULE: on
GOPATH: /home/runner/work/
run: GOLINTER=./golangci-lint-1.41.0-linux-amd64/golangci-lint make lint
Publish:
runs-on: ubuntu-latest
needs: [Test, Lint]
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -21,19 +63,16 @@ jobs:
go-version: 1.17
- name: Login to Docker Hub
if: startsWith(github.ref, 'refs/tags/v')
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# TODO: default GITHUB_TOKEN insufficient permissions
# Publish image to Docker Hub, changelog and package to Github Release by GoReleaser
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
# either 'goreleaser' (default) or 'goreleaser-pro'
distribution: goreleaser
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
# Your GoReleaser Pro key, if you are using the 'goreleaser-pro' distribution
# GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
47 changes: 23 additions & 24 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,39 +10,38 @@ on:
- main

jobs:
test:
Test:
name: Unit tests with coverage
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.17
uses: actions/setup-go@v2
with:
go-version: 1.17
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@main
- name: Running go tests with coverage
env:
GO111MODULE: on
run: make cover
- name: Send coverage
uses: shogo82148/actions-goveralls@v1
with:
path-to-profile: coverage.out
lint:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Go 1.17
uses: actions/setup-go@v2
with:
go-version: 1.17
- name: Running go tests with coverage
env:
GO111MODULE: on
run: make cover
- name: Send coverage
uses: shogo82148/actions-goveralls@v1
with:
path-to-profile: coverage.out
Lint:
name: Lint checks
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Go 1.17
uses: actions/setup-go@v2
with:
go-version: 1.17
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@main
- name: Download golangci-lint
run: |
wget https://github.com/golangci/golangci-lint/releases/download/v1.41.0/golangci-lint-1.41.0-linux-amd64.tar.gz
Expand Down

0 comments on commit 1a18515

Please sign in to comment.