test: e2e test #359
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: Go | |
| on: | |
| push: | |
| paths: | |
| - '**.go' | |
| pull_request: | |
| paths: | |
| - '**.go' | |
| env: | |
| GOPROXY: "https://proxy.golang.org" | |
| jobs: | |
| test-mysql: | |
| name: Test MySQL | |
| runs-on: ubuntu-latest | |
| services: | |
| mysql: | |
| image: mysql:8.0.21 | |
| env: | |
| MYSQL_ROOT_PASSWORD: root | |
| MYSQL_DATABASE: nekobox | |
| ports: | |
| - 3306:3306 | |
| options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Install Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version: 1.24.x | |
| - name: Run tests | |
| run: go test -v -race -coverprofile=coverage.txt -race -covermode=atomic ./... | |
| env: | |
| DB_TYPE: mysql | |
| DB_HOST: localhost | |
| DB_PORT: 3306 | |
| DB_USER: root | |
| DB_PASSWORD: root | |
| DB_DATABASE: nekobox | |
| - name: Upload coverage reports to Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| test-postgres: | |
| name: Test Postgres | |
| runs-on: ubuntu-latest | |
| services: | |
| postgres: | |
| image: postgres | |
| env: | |
| POSTGRES_PASSWORD: postgres | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Install Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version: 1.24.x | |
| - name: Run tests | |
| run: go test -v -race -coverprofile=coverage.txt -race -covermode=atomic ./... | |
| env: | |
| DB_TYPE: postgres | |
| DB_HOST: localhost | |
| DB_PORT: 5432 | |
| DB_USER: postgres | |
| DB_PASSWORD: postgres | |
| DB_DATABASE: nekobox | |
| - name: Upload coverage reports to Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Install Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version: 1.24.x | |
| - name: Run golangci-lint | |
| uses: golangci/golangci-lint-action@v8 | |
| with: | |
| version: v2.1 | |
| args: --timeout=10m |