diff --git a/.github/workflows/golangci-lint.yaml b/.github/workflows/golangci-lint.yaml index 9fe0486..780a2e5 100644 --- a/.github/workflows/golangci-lint.yaml +++ b/.github/workflows/golangci-lint.yaml @@ -11,18 +11,21 @@ permissions: # pull-requests: read jobs: + tests: + uses: ./.github/workflows/tests.yml golangci: name: lint + needs: [tests] runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Go uses: actions/setup-go@v4 with: - go-version: '1.21' + go-version-file: go.mod cache: false - name: golangci-lint uses: golangci/golangci-lint-action@v3 diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 5620e23..3c1067e 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -12,7 +12,13 @@ permissions: # packages: write jobs: + lint: + uses: ./.github/workflows/golangci-lint.yaml + tests: + needs: [lint] + uses: ./.github/workflows/tests.yml goreleaser: + needs: [tests] runs-on: ubuntu-latest steps: - @@ -24,7 +30,7 @@ jobs: name: Set up Go uses: actions/setup-go@v4 with: - go-version: stable + go-version-file: go.mod - name: Run GoReleaser uses: goreleaser/goreleaser-action@v5 @@ -33,4 +39,4 @@ jobs: version: latest args: release --clean env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..29884f3 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,22 @@ +name: tests + +on: + workflow_call: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + run: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version-file: go.mod + - run: make unit-tests