Merge pull request #62 from teknologi-umum/test/backend/more-tests #35
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: Master | |
| on: | |
| push: | |
| branches: | |
| - master | |
| jobs: | |
| frontend: | |
| name: Frontend | |
| runs-on: ubuntu-latest | |
| container: node:20 | |
| timeout-minutes: 30 | |
| defaults: | |
| run: | |
| working-directory: ./frontend | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: latest | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Lint | |
| run: pnpm run lint:check | |
| - name: Build | |
| run: pnpm run build | |
| backend: | |
| name: Backend / ${{ matrix.database.name }} | |
| runs-on: ubuntu-latest | |
| container: golang:1.24 | |
| timeout-minutes: 30 | |
| strategy: | |
| matrix: | |
| database: | |
| - name: "ClickHouse" | |
| url: "clickhouse://semyi:password@clickhouse:9000/default" | |
| - name: "DuckDB" | |
| url: "./test.duckdb" | |
| services: | |
| clickhouse: | |
| # According to the documentation: | |
| # If jobs.<job_id>.services.<service_id>.image is assigned an empty string, the service will not start. | |
| image: ${{ matrix.database.name == 'ClickHouse' && 'clickhouse/clickhouse-server:latest' || '' }} | |
| env: | |
| CLICKHOUSE_DB: default | |
| CLICKHOUSE_USER: semyi | |
| CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT: 1 | |
| CLICKHOUSE_PASSWORD: password | |
| options: >- | |
| --health-cmd "wget --no-verbose --tries=1 --spider http://localhost:8123/ping || exit 1" | |
| --health-interval 10s | |
| --health-timeout 10s | |
| --health-retries 10 | |
| --health-start-period 30s | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup gcc | |
| run: apt-get update && apt-get install -y build-essential | |
| - name: Build | |
| run: go build -buildvcs=false . | |
| working-directory: ./backend | |
| - name: Test | |
| run: go test -v -coverprofile=coverage.out -covermode=atomic ./... | |
| working-directory: ./backend | |
| env: | |
| DATABASE_URL: ${{ matrix.database.url }} | |
| - uses: codecov/codecov-action@v5 | |
| with: | |
| files: ./backend/coverage.out | |
| flags: backend | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| cd: | |
| name: CD | |
| needs: | |
| - frontend | |
| - backend | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Log in to the Container registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - | |
| name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Extract metadata (tags, labels) for Docker | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ghcr.io/${{ github.repository }} | |
| flavor: | | |
| latest=false | |
| tags: | | |
| type=edge | |
| type=sha | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v4 | |
| with: | |
| context: . | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| platforms: linux/amd64,linux/arm64 | |
| secrets: | | |
| "SENTRY_DSN=${{ secrets.SENTRY_DSN }}" | |
| "SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }}" |