-
-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split linting and tests into new github actions
- Loading branch information
1 parent
a6059e4
commit f67c812
Showing
5 changed files
with
156 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,15 @@ | ||
name: Go | ||
name: build | ||
|
||
on: | ||
push: | ||
branches: [ main, master ] | ||
pull_request: | ||
branches: [ main, master ] | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} | ||
|
||
jobs: | ||
build: | ||
timeout-minutes: 30 | ||
|
@@ -41,7 +45,7 @@ jobs: | |
node-version: ${{ matrix.node-version }} | ||
|
||
- name: Set up Go ${{ matrix.go-version }} | ||
uses: actions/setup-go@v3 | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
id: go | ||
|
@@ -50,7 +54,6 @@ jobs: | |
uses: actions/checkout@v3 | ||
|
||
- run: npm ci --no-optional | ||
- run: npm run prettier | ||
# - run: npm test | ||
- run: npm run build | ||
env: | ||
|
@@ -68,19 +71,8 @@ jobs: | |
- name: Generate swagger docs | ||
run: swag init -g http/http.go -o swaggerdocs | ||
|
||
- name: Check formatting | ||
uses: Jerome1337/[email protected] | ||
with: | ||
gofmt-path: '.' | ||
gofmt-flags: '-l -d' | ||
|
||
- name: Goimports Check | ||
uses: DarthBenro008/[email protected] | ||
with: | ||
root-path: './' | ||
|
||
- name: Test | ||
run: go test `go list ./... | grep -v swaggerdocs` | ||
# - name: Test | ||
# run: go test `go list ./... | grep -v swaggerdocs` | ||
|
||
- name: Build | ||
run: go build -v . | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: lint | ||
on: | ||
push: | ||
branches: [ main, master ] | ||
pull_request: | ||
branches: [ main, master ] | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} | ||
|
||
permissions: | ||
contents: read | ||
# Optional: allow read access to pull request. Use with `only-new-issues` option. | ||
# pull-requests: read | ||
|
||
jobs: | ||
go: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
go: [ '1.20' ] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: ${{ matrix.go }} | ||
|
||
- name: Check formatting | ||
uses: Jerome1337/[email protected] | ||
with: | ||
gofmt-path: '.' | ||
gofmt-flags: '-l -d' | ||
|
||
- name: Goimports Check | ||
uses: DarthBenro008/[email protected] | ||
with: | ||
root-path: './' | ||
ui: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: [ "18.5.0" ] | ||
|
||
steps: | ||
- name: Set up Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
|
||
- name: Check out code | ||
uses: actions/checkout@v3 | ||
|
||
- run: npm ci --no-optional | ||
- run: npm run prettier |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: test | ||
|
||
on: | ||
push: | ||
branches: [ main, master ] | ||
pull_request: | ||
branches: [ main, master ] | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} | ||
|
||
jobs: | ||
go: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
go-version: [ "1.20" ] | ||
|
||
steps: | ||
- name: Set up Go ${{ matrix.go-version }} | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
id: go | ||
|
||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v3 | ||
|
||
- name: Copy swagger docs dummy file and Create dummy dist/index.html | ||
run: mkdir swaggerdocs && cp build/swaggerdocs_dummy.go swaggerdocs/docs.go && mkdir dist && touch dist/index.html | ||
|
||
- name: Test | ||
run: go test `go list ./... | grep -v swaggerdocs` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package swaggerdocs | ||
|
||
import "github.com/swaggo/swag" | ||
|
||
const docTemplate = `{ | ||
"schemes": {{ marshal .Schemes }}, | ||
"swagger": "2.0", | ||
"info": { | ||
"description": "{{escape .Description}}", | ||
"title": "{{.Title}}", | ||
"version": "{{.Version}}" | ||
} | ||
}` | ||
|
||
var SwaggerInfo = &swag.Spec{ | ||
Version: "BETA", | ||
Host: "", | ||
BasePath: "", | ||
Schemes: []string{}, | ||
Title: "Thunderdome API", | ||
Description: "Thunderdome Planning Poker API for both Internal and External use.\nWARNING: Currently not considered stable and is subject to change until 1.0 is released.", | ||
InfoInstanceName: "swagger", | ||
SwaggerTemplate: docTemplate, | ||
} | ||
|
||
func init() { | ||
} |