-
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.
- Loading branch information
1 parent
cd8210b
commit 31899fd
Showing
2 changed files
with
70 additions
and
1 deletion.
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,69 @@ | ||
# This workflow will ensure the project is tidy, buildable and all tests pass | ||
# on every push to the main branch and on every pull request. | ||
# | ||
name: Build and Test | ||
|
||
on: | ||
push: | ||
paths: | ||
- "**.go" | ||
- "go.sum" | ||
branches: [main, master] | ||
pull_request: | ||
paths: | ||
- "**.go" | ||
- "go.sum" | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
GO_VERSION: 1.21 | ||
|
||
jobs: | ||
|
||
# Check if the go.mod file is tidy | ||
tidy: | ||
runs-on: ubuntu-latest | ||
name: tidy | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
- run: | | ||
go mod tidy | ||
CHANGES_IN_REPO=$(git status --porcelain) | ||
if [[ -n "$CHANGES_IN_REPO" ]]; then | ||
echo "Repository is dirty. Showing 'git status' and 'git --no-pager diff':" | ||
git status && git --no-pager diff | ||
exit 1 | ||
fi | ||
# Build and compile the go project | ||
build: | ||
runs-on: ubuntu-latest | ||
name: build | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
- run: go build ./... | ||
|
||
# Run all standard, go tests | ||
test: | ||
runs-on: ubuntu-latest | ||
name: test | ||
steps: | ||
- name: Install Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Test | ||
run: go test ./... |
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 |
---|---|---|
|
@@ -5,5 +5,5 @@ import ( | |
) | ||
|
||
func main() { | ||
fmt.Println("Hello, World!") | ||
fmt.Println("Hello, Cosmos!") | ||
} |