From c33a952ad89d4c895727a9f07e4fdd117c0b784f Mon Sep 17 00:00:00 2001 From: Giannis Katsanos Date: Mon, 29 Jan 2024 23:03:15 +0200 Subject: [PATCH] feat: Add CI workflow Added a new CI workflow for Github Actions that will vet, and lint the code and run the test suite. Linting is done with golangci-lint. Tests are run against all Go versions from 1.19 onwards. --- .github/workflows/ci.yml | 42 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..4b087cd1 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,42 @@ +name: CI + +on: + pull_request: + push: + branches: + - $default-branch + - v2 + +jobs: + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Setup go + uses: actions/setup-go@v4 + with: + go-version: "1.21" + - name: Format + run: diff -u <(echo -n) <(gofmt -d -s .) + - name: Vet + run: go vet ./... + - name: Run linter + uses: golangci/golangci-lint-action@v3 + test: + name: "Test: go v${{ matrix.go-version }}" + strategy: + matrix: + go-version: + - "1.19" + - "1.20" + - "1.21" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Setup go + uses: actions/setup-go@v4 + with: + go-version: ${{ matrix.go-version }} + - name: Run tests + run: go test -v -race ./...