update ci to use mise #80
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: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| preflight: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| gopath: ${{ steps.gopath.outputs.value }} | |
| go-mods-cache-key: ${{ steps.cache-keys.outputs.go-mods-cache-key }} | |
| go-bins-cache-key: ${{ steps.cache-keys.outputs.go-bins-cache-key }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: "false" | |
| - uses: jdx/mise-action@v3 | |
| with: | |
| cache: true | |
| reshim: true | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Get Go path | |
| id: gopath | |
| run: echo "value=$(go env GOPATH)" >> $GITHUB_OUTPUT | |
| - name: Cache keys | |
| id: cache-keys | |
| run: | | |
| echo "go-mods-cache-key=go-mods-${{ runner.os }}-${{ hashFiles('**/go.sum') }}" >> $GITHUB_OUTPUT | |
| - name: Cache Go mods | |
| id: go-mods-cache | |
| uses: actions/cache@v4 | |
| with: | |
| lookup-only: true | |
| path: ${{ steps.gopath.outputs.value }}/pkg/mod | |
| key: ${{ steps.cache-keys.outputs.go-mods-cache-key }} | |
| - name: 📥 Download dependencies | |
| if: steps.go-mods-cache.outputs.cache-hit != 'true' | |
| run: go mod download | |
| test: | |
| runs-on: ubuntu-latest | |
| needs: preflight | |
| services: | |
| postgres: | |
| image: postgres:17.4 | |
| ports: | |
| - 5444:5432 | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| env: | |
| POSTGRES_PASSWORD: password | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: jdx/mise-action@v3 | |
| with: | |
| cache: true | |
| reshim: true | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: 💾 Cache Go mods | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ needs.preflight.outputs.gopath }}/pkg/mod | |
| key: ${{ needs.preflight.outputs.go-mods-cache-key }} | |
| fail-on-cache-miss: true | |
| - name: Run tests units | |
| run: | | |
| mkdir -p /tmp/test-reports | |
| gotestsum --junitfile /tmp/test-reports/unit-tests.xml | |
| - uses: actions/upload-artifact@v4 | |
| name: Upload test results | |
| with: | |
| name: test-reports-${{ matrix.go-version }} | |
| path: /tmp/test-reports | |
| - name: Run Examples | |
| run: make test-examples | |
| - name: Update coverage report | |
| uses: ncruces/go-coverage-report@v0.3.0 | |
| with: | |
| report: true | |
| chart: true | |
| amend: true | |
| if: | | |
| matrix.go-version == 'stable' | |
| continue-on-error: true | |
| test-race: | |
| runs-on: ubuntu-latest | |
| needs: preflight | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: jdx/mise-action@v3 | |
| with: | |
| cache: true | |
| reshim: true | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: 💾 Cache Go mods | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ needs.preflight.outputs.gopath }}/pkg/mod | |
| key: ${{ needs.preflight.outputs.go-mods-cache-key }} | |
| fail-on-cache-miss: true | |
| - name: Run tests with race detector | |
| run: make test-race | |
| lint: | |
| runs-on: ubuntu-latest | |
| needs: preflight | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: jdx/mise-action@v3 | |
| with: | |
| cache: true | |
| reshim: true | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: 💾 Cache Go mods | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ needs.preflight.outputs.gopath }}/pkg/mod | |
| key: ${{ needs.preflight.outputs.go-mods-cache-key }} | |
| fail-on-cache-miss: true | |
| - name: go vet | |
| run: mise vet | |
| - name: Running staticcheck | |
| run: mise static | |
| - name: Running vulncheck | |
| run: mise vuln | |
| fmt: | |
| runs-on: ubuntu-latest | |
| needs: preflight | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: jdx/mise-action@v3 | |
| with: | |
| cache: true | |
| reshim: true | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: 💾 Cache Go mods | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ needs.preflight.outputs.gopath }}/pkg/mod | |
| key: ${{ needs.preflight.outputs.go-mods-cache-key }} | |
| fail-on-cache-miss: true | |
| - name: Running formatting | |
| run: | | |
| mise fmt | |
| mise has-changes |