wip: リンクを複数追加できるようにする #2139
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@v5 | |
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@v4 | |
with: | |
name: traPortfolio | |
path: traPortfolio | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: ./go.mod | |
- uses: golangci/golangci-lint-action@v6 | |
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@v5 | |
with: | |
go-version-file: ./go.mod | |
- name: Run tests | |
run: | | |
go test ./internal/... -coverprofile=coverage_unit.tmp.txt -race -vet=off | |
grep -v "mock_" < coverage_unit.tmp.txt > coverage_unit.txt | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: coverage_unit | |
path: coverage_unit.txt | |
test-integration: | |
name: Test (Integration) | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: ./go.mod | |
- name: Run tests | |
run: | | |
go test ./integration_tests/... -coverpkg=./... -coverprofile=coverage_integration.tmp.txt -race -vet=off | |
grep -v "mock_" < coverage_integration.tmp.txt > coverage_integration.txt | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: coverage_integration | |
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@v4 | |
with: | |
name: coverage_unit | |
- uses: actions/download-artifact@v4 | |
with: | |
name: coverage_integration | |
- name: Upload coverage data (Unit) | |
uses: codecov/codecov-action@v4 | |
with: | |
files: ./coverage_unit.txt | |
flags: unit | |
token: ${{ secrets.CODECOV_TOKEN }} | |
- name: Upload coverage data (Integration) | |
uses: codecov/codecov-action@v4 | |
with: | |
files: ./coverage_integration.txt | |
flags: integration | |
token: ${{ secrets.CODECOV_TOKEN }} | |
tbls: | |
name: TBLS | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: traPortfolio | |
- name: Setup MySQL container | |
run: docker compose up -d --wait mysql | |
- uses: k1low/setup-tbls@v1 | |
- name: Run database linter | |
run: | | |
chmod +x ./traPortfolio | |
./traPortfolio --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 |