-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from camaoag/ci_add_github_actions
ci: add tests on all branches and release workflow
- Loading branch information
Showing
4 changed files
with
110 additions
and
2 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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Go | ||
|
||
on: | ||
push: | ||
branches: | ||
- '**' | ||
- '!master' | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ^1.16 | ||
id: go | ||
- name: Get dependencies | ||
run: make get-dependencies | ||
|
||
- name: Ensure that all files are properly formatted | ||
run: | | ||
FILES=$(gofmt -s -l .) | ||
if [ -n "${FILES}" ]; then | ||
printf "Following files are not formatted: \n%s" "$FILES" | ||
exit 1 | ||
fi | ||
- name: GO vet | ||
run: make vet | ||
|
||
- name: Test | ||
run: make unit-test | ||
|
||
- name: Test building | ||
run: make build |
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,49 @@ | ||
name: Release | ||
|
||
on: workflow_dispatch | ||
|
||
jobs: | ||
release: | ||
name: 'Release to GitHub' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
# Go setup | ||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ^1.16 | ||
id: go | ||
|
||
- name: Get dependencies | ||
run: make get-dependencies | ||
|
||
# Go test | ||
- name: Ensure that all files are properly formatted | ||
run: | | ||
FILES=$(gofmt -s -l .) | ||
if [ -n "${FILES}" ]; then | ||
printf "Following files are not formatted: \n%s" "$FILES" | ||
exit 1 | ||
fi | ||
- name: GO vet | ||
run: make vet | ||
|
||
- name: Test | ||
run: make test | ||
|
||
- name: Test building | ||
run: make build | ||
|
||
# Prepare release | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 13 | ||
- name: Add execution plugin | ||
run: npm install @semantic-release/exec | ||
- name: Release to GitHub | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | ||
run: npx semantic-release |
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,7 @@ | ||
--- | ||
branches: | ||
- master | ||
plugins: | ||
- "@semantic-release/commit-analyzer" | ||
- "@semantic-release/release-notes-generator" | ||
- - "@semantic-release/github" |
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