perf(repository): paginate before joining assets in version listing #81
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 | |
| - dev | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| test: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 | |
| with: | |
| go-version-file: go.mod | |
| cache: true | |
| - name: Run tests | |
| run: go test -v -race -coverprofile=coverage.out ./... | |
| - name: Upload coverage | |
| uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0 | |
| if: github.event_name == 'push' | |
| with: | |
| files: ./coverage.out | |
| fail_ci_if_error: false | |
| continue-on-error: true | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 | |
| with: | |
| go-version-file: go.mod | |
| cache: true | |
| - name: Run golangci-lint | |
| uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0 | |
| with: | |
| version: v2.11 | |
| args: --timeout=5m | |
| generate: | |
| name: Verify generated code | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 | |
| with: | |
| go-version-file: go.mod | |
| cache: true | |
| - name: Install mise | |
| uses: jdx/mise-action@1648a7812b9aeae629881980618f079932869151 # v4.0.1.6.4.0.1 | |
| with: | |
| install: true | |
| - name: Generate code | |
| run: go generate ./... | |
| - name: Check for uncommitted changes | |
| run: | | |
| if ! git diff --exit-code; then | |
| echo "Generated code is out of sync. Please run 'go generate ./...' and commit the changes." | |
| exit 1 | |
| fi | |
| build: | |
| name: Build binaries | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| target: | |
| - cmd/server | |
| - cmd/worker | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 | |
| with: | |
| go-version-file: go.mod | |
| cache: true | |
| - name: Build ${{ matrix.target }} | |
| run: go build -v ./${{ matrix.target }} | |
| docker: | |
| name: Build and push Docker image | |
| runs-on: ubuntu-latest | |
| needs: [test, lint, build] | |
| if: github.event_name == 'push' | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4.0.0 | |
| - uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0 | |
| - uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: App image metadata | |
| id: app-meta | |
| uses: docker/metadata-action@030e881283bb7a6894de51c315a6bfe6a94e05cf # v6.0.0 | |
| with: | |
| images: ghcr.io/${{ github.repository }} | |
| tags: | | |
| type=sha,prefix=,enable=${{ github.ref == 'refs/heads/main' }} | |
| type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }} | |
| type=sha,prefix=dev-,enable=${{ github.ref == 'refs/heads/dev' }} | |
| type=raw,value=dev-latest,enable=${{ github.ref == 'refs/heads/dev' }} | |
| - name: Migrate image metadata | |
| id: migrate-meta | |
| uses: docker/metadata-action@030e881283bb7a6894de51c315a6bfe6a94e05cf # v6.0.0 | |
| with: | |
| images: ghcr.io/${{ github.repository }}/migrate | |
| tags: | | |
| type=sha,prefix=,enable=${{ github.ref == 'refs/heads/main' }} | |
| type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }} | |
| type=sha,prefix=dev-,enable=${{ github.ref == 'refs/heads/dev' }} | |
| type=raw,value=dev-latest,enable=${{ github.ref == 'refs/heads/dev' }} | |
| - name: Build and push app image | |
| uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0 | |
| with: | |
| context: . | |
| target: app | |
| push: true | |
| platforms: linux/amd64,linux/arm64 | |
| tags: ${{ steps.app-meta.outputs.tags }} | |
| labels: ${{ steps.app-meta.outputs.labels }} | |
| cache-from: type=gha,scope=app | |
| cache-to: type=gha,scope=app,mode=max | |
| build-args: | | |
| VERSION=${{ github.sha }} | |
| - name: Build and push migrate image | |
| uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0 | |
| with: | |
| context: . | |
| target: migrate | |
| push: true | |
| platforms: linux/amd64,linux/arm64 | |
| tags: ${{ steps.migrate-meta.outputs.tags }} | |
| labels: ${{ steps.migrate-meta.outputs.labels }} | |
| cache-from: type=gha,scope=migrate | |
| cache-to: type=gha,scope=migrate,mode=max |