Skip to content

Merge pull request #17 from WillyTonkas/not-feature/back/ci-cd #13

Merge pull request #17 from WillyTonkas/not-feature/back/ci-cd

Merge pull request #17 from WillyTonkas/not-feature/back/ci-cd #13

Workflow file for this run

name: CI Workflow
on:
pull_request:
branches: ["main", "dev"]
push:
branches-ignore: ["main"]
jobs:
lint-and-test:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: '1.23'
- name: Cache Go modules
uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Check formatting with gofmt
run: |
echo "Checking code formatting with gofmt..."
unformatted=$(gofmt -l .)
if [ -n "$unformatted" ]; then
echo "The following files are not formatted:"
echo "$unformatted"
exit 1
fi
- name: Run golint
run: golint ./... || exit 1
- name: Run tests
run: go test ./... -v