feat(cicd): add github actions workflow #3
Workflow file for this run
This file contains hidden or 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: | |
| pull_request: | |
| branches: | |
| - develop | |
| types: | |
| - opened | |
| - synchronize | |
| - reopened | |
| - ready_for_review | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ci-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| GO_VERSION_FILE: go.mod | |
| MAKEFILE_PATH: Makefile/makefile | |
| # Use goinstall mode below so the built Go version | |
| # is not lower than the repo's targeted Go version. | |
| GOLANGCI_LINT_VERSION: v1.64.8 | |
| jobs: | |
| ci: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: ${{ env.GO_VERSION_FILE }} | |
| cache: true | |
| - name: Download Go modules | |
| run: go mod download | |
| - name: Format (gofmt) | |
| run: make -f "${MAKEFILE_PATH}" fmt | |
| - name: Ensure no formatting diff | |
| run: git diff --exit-code | |
| - name: Setup golangci-lint | |
| uses: golangci/golangci-lint-action@v6 | |
| with: | |
| version: ${{ env.GOLANGCI_LINT_VERSION }} | |
| install-mode: goinstall | |
| - name: Lint | |
| run: make -f "${MAKEFILE_PATH}" lint | |
| - name: Unit tests | |
| run: make -f "${MAKEFILE_PATH}" test | |
| - name: Integration tests | |
| env: | |
| TEST_DATABASE_URL: postgres://postgres:postgres@localhost:5433/cixing_test?sslmode=disable | |
| run: make -f "${MAKEFILE_PATH}" it |