Merge pull request #591 from traPtitech/architecture-mermaid #1798
This file contains 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: | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version-file: ./go.mod | |
- name: Download go modules | |
run: go mod download | |
- name: Compile go packages | |
run: go build -o traPortfolio . | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: traPortfolio | |
path: traPortfolio | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version-file: ./go.mod | |
- uses: golangci/golangci-lint-action@v3 | |
with: | |
version: latest | |
install-mode: goinstall | |
test-unit: | |
name: Test (Unit) | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version-file: ./go.mod | |
- name: Run tests | |
run: go test $(go list ./... | grep -v "integration_tests") -coverprofile=coverage_unit.txt -race -vet=off | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: coverages | |
path: coverage_unit.txt | |
test-integration: | |
name: Test (Integration) | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup MySQL container | |
run: make up-db-container | |
- uses: actions/setup-go@v4 | |
with: | |
go-version-file: ./go.mod | |
- name: Run tests | |
run: go test ./integration_tests/... -coverpkg=./... -coverprofile=coverage_integration.txt -race -vet=off | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: coverages | |
path: coverage_integration.txt | |
upload-codecov: | |
name: Analyze coverages | |
runs-on: ubuntu-latest | |
needs: | |
- test-unit | |
- test-integration | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: coverages | |
- name: Upload coverage data (Unit) | |
uses: codecov/codecov-action@v3 | |
with: | |
files: ./coverage_unit.txt | |
flags: unit | |
- name: Upload coverage data (Integration) | |
uses: codecov/codecov-action@v3 | |
with: | |
files: ./coverage_integration.txt | |
flags: integration | |
tbls: | |
name: TBLS | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: traPortfolio | |
- name: Setup MySQL container | |
run: make up-db-container | |
- uses: k1low/setup-tbls@v1 | |
- name: Run database linter | |
run: | | |
chmod +x ./traPortfolio | |
./traPortfolio -c ./dev/config.yaml --only-migrate | |
tbls lint | |
spectral: | |
name: Spectral | |
runs-on: ubuntu-latest | |
container: | |
image: stoplight/spectral:6.5.1 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Spectral checks | |
run: spectral lint ./docs/swagger/traPortfolio.v1.yaml |