Skip to content

traPtitech/traPortfolio

Repository files navigation

traPortfolio

GitHub release CI Build image codecov swagger

Develop environment

If you want to contribute to traPortfolio, then follow these pages.

Quick start with DevContainer

If you use VSCode, you can use DevContainer to develop traPortfolio. See ./.devcontainer/README.md for more details.

Start docker container (with Docker Compose)

docker compose up

or

# enable live reload
docker compose watch

Now you can access to

Tasks

Usable tasks are below.

Tip

You can use xc to run the following tasks easily. See https://xcfile.dev for more details.

go install github.com/joerdav/xc/cmd/xc@latest

gen

Generate code.

go generate -x ./...

lint

Run linter (golangci-lint).

go run github.com/golangci/golangci-lint/cmd/golangci-lint@latest run --fix ./...

test:unit

Run unit tests.

go test -v -cover -race ./internal/...

test:integration

Run integration tests.

go test -v -cover -race ./integration_tests/...

test:all

Run all tests.

Requires: test:unit, test:integration

RunDeps: async

db:migrate

Migrate the database.

# TODO: use environment variables for config
docker compose run --build --entrypoint "/traPortfolio -c /opt/traPortfolio/config.yaml --db-host mysql --only-migrate" backend

db:gen-docs

Generate database schema documentation with tbls.

Requires: db:migrate

rm -rf ./docs/dbschema
go run github.com/k1LoW/tbls@latest doc

db:lint

Lint the database schema with tbls.

Requires: db:migrate

go run github.com/k1LoW/tbls@latest lint

openapi:lint

Lint the OpenAPI schema with Spectral.

docker run --rm -it -w /tmp -v $PWD:/tmp stoplight/spectral:latest lint ./docs/swagger/traPortfolio.v1.yaml