Skip to content

impl: add IsPublished in questionnaires #1753

impl: add IsPublished in questionnaires

impl: add IsPublished in questionnaires #1753

Workflow file for this run

name: CI
on:
push:
branches:
- 'main'
- 'develop'
pull_request:
env:
TZ: Asia/Tokyo
jobs:
mod:
name: Mod
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
- uses: actions/cache@v3.3.2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-gomod-${{ hashFiles('**/go.sum') }}
- run: go mod download
build:
name: Build
runs-on: ubuntu-latest
needs: [mod]
env:
GOCACHE: "/tmp/go/cache"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
- uses: actions/cache@v3.3.2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-gomod-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-gomod-
- uses: actions/cache@v3.3.2
with:
path: /tmp/go/cache
key: ${{ runner.os }}-go-build-${{ github.ref }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-go-build-${{ github.ref }}-
${{ runner.os }}-go-build-
- run: go build -o anke-to
- uses: actions/upload-artifact@v3
with:
name: anke-to
path: anke-to
test:
name: Test
runs-on: ubuntu-latest
needs: [mod]
services:
mysql:
image: mariadb:10.3.9
ports:
- 3306:3306
env:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: anke-to
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
- uses: actions/cache@v3.3.2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-gomod-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-gomod-
- run: go install github.com/golang/mock/mockgen@v1.5.0
- run: go generate ./...
- run: go test ./model ./router -v -coverprofile=coverage.txt -race -vet=off
env:
MARIADB_USERNAME: root
MARIADB_PASSWORD: password
MARIADB_HOSTNAME: 127.0.0.1
MARIADB_DATABASE: anke-to
- name: Upload coverage data
uses: codecov/codecov-action@v3.1.4
with:
file: ./coverage.txt
yml: ./codecov.yml
- uses: actions/upload-artifact@v3
with:
name: coverage.txt
path: coverage.txt
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
- name: golangci-lint
uses: reviewdog/action-golangci-lint@v2.3
with:
reporter: github-pr-check
github_token: ${{ secrets.GITHUB_TOKEN }}
fail_on_error: true
spectral:
name: Spectral
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Spectral checks
uses: stoplightio/spectral-action@v0.8.7
with:
file_glob: docs/swagger/*.yaml
repo_token: ${{ secrets.GITHUB_TOKEN }}