-
Notifications
You must be signed in to change notification settings - Fork 18
feat(ci): implement ci pipeline #48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
a7b527c
3bed33a
1a1a18d
70c6ea6
d4bea8d
21e48e7
0c772f8
ca2831a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| name: DefiFundr CI | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ main, develop ] | ||
| pull_request: | ||
| branches: [ main, develop ] | ||
|
|
||
| jobs: | ||
| lint: | ||
| name: Lint | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v3 | ||
|
|
||
| - name: Set up Go | ||
| uses: actions/setup-go@v4 | ||
| with: | ||
| go-version: '1.21' | ||
| cache: true | ||
|
|
||
| - name: Install golangci-lint | ||
| run: | | ||
| curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.55.2 | ||
|
|
||
| - name: Lint code | ||
| run: | | ||
| export PATH=$PATH:$(go env GOPATH)/bin | ||
| golangci-lint run --timeout=5m | ||
|
|
||
| test: | ||
| name: Test | ||
| runs-on: ubuntu-latest | ||
| services: | ||
| postgres: | ||
| image: postgres:15-alpine | ||
| env: | ||
| POSTGRES_USER: root | ||
| POSTGRES_PASSWORD: secret | ||
| POSTGRES_DB: defi | ||
| ports: | ||
| - 5433:5432 | ||
| options: >- | ||
| --health-cmd pg_isready | ||
| --health-interval 10s | ||
| --health-timeout 5s | ||
| --health-retries 5 | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v3 | ||
|
|
||
| - name: Set up Go | ||
| uses: actions/setup-go@v4 | ||
| with: | ||
| go-version: '1.21' | ||
|
||
| cache: true | ||
|
|
||
| - name: Install dependencies | ||
| run: go mod download | ||
|
|
||
| - name: Run tests | ||
| run: go test -v -race -coverprofile=coverage.txt -covermode=atomic ./... | ||
| env: | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. check previous CI implementation. Use similar strategies, avoid exposing sensitive data in CI implementation |
||
| DB_SOURCE: postgresql://root:secret@localhost:5433/defi?sslmode=disable | ||
|
|
||
| - name: Upload coverage to Codecov | ||
| uses: codecov/codecov-action@v3 | ||
| with: | ||
| file: ./coverage.txt | ||
| fail_ci_if_error: false | ||
|
|
||
| build: | ||
| name: Build | ||
| runs-on: ubuntu-latest | ||
| needs: [lint, test] | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v3 | ||
|
|
||
| - name: Set up Go | ||
| uses: actions/setup-go@v4 | ||
| with: | ||
| go-version: '1.21' | ||
| cache: true | ||
|
|
||
| - name: Build application | ||
| run: go build -v -o defifundr_backend ./cmd/api | ||
|
|
||
| - name: Upload artifact | ||
| uses: actions/upload-artifact@v3 | ||
| with: | ||
| name: defifundr-backend | ||
| path: defifundr_backend | ||
| retention-days: 5 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| linters: | ||
| enable: | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. reduce sensitivity of linter for now |
||
| - gofmt | ||
| - govet | ||
| - goimports | ||
| - gosec | ||
| - gosimple | ||
| - ineffassign | ||
| - misspell | ||
| - staticcheck | ||
| - unconvert | ||
| - unparam | ||
| - unused | ||
| - revive | ||
| - errcheck | ||
|
|
||
| linters-settings: | ||
| gofmt: | ||
| simplify: true | ||
| goimports: | ||
| local-prefixes: "github.com/DefiFundr-Labs/defifundr_backend" | ||
| revive: | ||
| rules: | ||
| - name: exported | ||
| arguments: | ||
| - disableStutteringCheck | ||
|
|
||
| run: | ||
| timeout: 5m | ||
| issues-exit-code: 1 | ||
| tests: true | ||
|
|
||
| issues: | ||
| max-issues-per-linter: 0 | ||
| max-same-issues: 0 | ||
| exclude-rules: | ||
| - path: _test\.go | ||
| linters: | ||
| - gosec | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Postgres is used but migration test in ci is not done