Merge pull request #3 from emmadevjr/main #8
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
name: CI | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setting up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: '1.22.2' | |
- name: Check out code | |
uses: actions/checkout@v2 | |
- name: Build | |
run: go build -v . | |
fmt: | |
name: Format Check | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v2 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: '1.22.2' | |
- name: Check Formatting | |
run: | | |
unformatted=$(gofmt -l .) | |
if [ -n "$unformatted" ]; then | |
echo "Unformatted files:" | |
echo "$unformatted" | |
exit 1 | |
fi | |
unit-test: | |
name: Unit Tests | |
runs-on: ubuntu-latest | |
needs: fmt | |
steps: | |
- name: Setting up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: '1.22.2' | |
- name: Check out code | |
uses: actions/checkout@v2 | |
- name: Cache Go Modules | |
uses: actions/cache@v2 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Run Unit Tests | |
run: go test -v ./... -run '.*_unit_test.go' | |
property-test: | |
name: Property Tests | |
runs-on: ubuntu-latest | |
needs: fmt | |
steps: | |
- name: Setting up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: '1.22.2' | |
- name: Check out code | |
uses: actions/checkout@v2 | |
- name: Cache Go Modules | |
uses: actions/cache@v2 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Run Property Tests | |
run: go test -v ./... -run '.*_property_test.go' |