From b0ee0f2d89ef1d77656056d40661e27b8b8dfd6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Simas?= Date: Thu, 20 Jun 2024 07:25:50 -0300 Subject: [PATCH] ci: add main ci workflow --- .github/workflows/main.yaml | 80 +++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 .github/workflows/main.yaml diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml new file mode 100644 index 0000000..5ff96e7 --- /dev/null +++ b/.github/workflows/main.yaml @@ -0,0 +1,80 @@ +name: Main + +on: + push: + branches: + - "main" + tags: + - "v*" + pull_request: + branches: + - "main" + +permissions: + contents: read + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version-file: 'go.mod' + - name: Build + run: make build + format: + runs-on: ubuntu-latest + needs: build + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version-file: 'go.mod' + - name: Format + run: test -z "$(make format -s)" + check-mod: + runs-on: ubuntu-latest + needs: build + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version-file: 'go.mod' + - name: Mod tidy + run: | + go mod tidy && git diff --exit-code + lint: + runs-on: ubuntu-latest + needs: build + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version-file: 'go.mod' + - name: Vet + run: make vet + - name: Lint + uses: golangci/golangci-lint-action@v6 + with: + version: v1.58 + test: + runs-on: ubuntu-latest + needs: build + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version-file: 'go.mod' + - name: Test + run: make test