Skip to content

Commit

Permalink
Merge pull request #544 from traPtitech/fix/revert-v1.5.0
Browse files Browse the repository at this point in the history
Revert v1.5.0
  • Loading branch information
cp-20 authored Sep 30, 2023
2 parents e98d86b + 996b882 commit 9ff6ef9
Show file tree
Hide file tree
Showing 31 changed files with 352 additions and 1,002 deletions.
63 changes: 0 additions & 63 deletions .air.toml

This file was deleted.

77 changes: 62 additions & 15 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,68 @@ on:
pull_request:

jobs:
mod:
name: Server Modules
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v2
with:
go-version: 1.15
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-gomod-${{ hashFiles('**/go.sum') }}
- run: go mod download
build:
name: Server Build
runs-on: ubuntu-latest
needs: [mod]
env:
GOCACHE: "/tmp/go/cache"
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
- uses: actions/setup-go@v2
with:
go-version: 1.15
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
go-version-file: ./go.mod
- name: mod
run: go mod download
path: ~/go/pkg/mod
key: ${{ runner.os }}-gomod-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-gomod-
- uses: actions/cache@v2
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-
- name: build
run: go build
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v2
with:
name: booQ
path: booQ
lint:
name: Server Lint
runs-on: ubuntu-latest
needs: [build]
needs: [mod]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
- uses: actions/setup-go@v2
with:
go-version-file: ./go.mod
go-version: 1.15
- name: Install reviewdog
run: curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh | sh -s -- -b $(go env GOPATH)/bin
- name: Install golangci-lint
run: curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-gomod-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-gomod-
- name: golangci-lint
run: golangci-lint run --out-format=line-number | reviewdog -f=golangci-lint -name=golangci-lint -reporter=github-check
env:
Expand All @@ -45,6 +78,7 @@ jobs:
runs-on: ubuntu-latest
needs: [build]
env:
GOCACHE: "/tmp/go/cache"
MYSQL_USER: root
MYSQL_PASSWORD: password
MYSQL_DATABASE: booq_test
Expand All @@ -58,10 +92,23 @@ jobs:
ports:
- 3306:3306
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
- uses: actions/setup-go@v2
with:
go-version: 1.15
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-gomod-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-gomod-
- uses: actions/cache@v2
with:
go-version-file: ./go.mod
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-
- name: Setup DB
run: go run .github/workflows/init.go
- name: Run model tests
Expand All @@ -72,9 +119,9 @@ jobs:
name: OpenApi Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v2
- name: Spectral checks
uses: stoplightio/[email protected].10
uses: stoplightio/[email protected].2
with:
file_glob: docs/swagger.yml
repo_token: ${{ secrets.GITHUB_TOKEN }}
8 changes: 4 additions & 4 deletions .github/workflows/master.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ jobs:
name: Build Docker Image (master)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v1
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
uses: docker/login-action@v1
with:
registry: ghcr.io
username: traptitech
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v4
uses: docker/build-push-action@v2
with:
context: .
push: true
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,22 @@ jobs:
steps:
- name: Set IMAGE_TAG env
run: echo "IMAGE_TAG=${GITHUB_REF:10}" >> $GITHUB_ENV
- uses: actions/checkout@v3
- uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v1
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
uses: docker/login-action@v1
with:
registry: ghcr.io
username: traptitech
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v4
uses: docker/build-push-action@v2
with:
context: .
push: true
file: docker/production/Dockerfile
tags: |
ghcr.io/traptitech/${{ env.IMAGE_NAME }}:latest
ghcr.io/traptitech/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
15 changes: 8 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
FROM golang:1.20.0-alpine AS build
FROM golang:1.15.0-alpine AS build
ENV CGO_ENABLED=0
ENV DOCKERIZE_VERSION v0.6.1
RUN apk add --update --no-cache git && \
apk --update add tzdata && \
cp /usr/share/zoneinfo/Asia/Tokyo /etc/localtime && \
apk del tzdata && \
rm -rf /var/cache/apk/*
RUN wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz && \
tar -C /usr/local/bin -xzvf dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz && \
rm dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz

WORKDIR /app
RUN go install github.com/cosmtrek/air@latest

COPY go.mod go.sum ./
WORKDIR /go/src/github.com/traPtitech/booQ
RUN go get github.com/pilu/fresh
COPY ./go.* ./
RUN go mod download

CMD ["air"]
COPY . .
20 changes: 4 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,56 +8,44 @@
management tool for equipment and book rental

## Development environment

### Setup with docker and docker-compose

#### First Up (or entirely rebuild)

```
$ docker compose -f .\compose-dev.yml up --build
$ docker-compose up --build
```

Now you can access to `http://localhost:8080` for booQ
Now you can access to `http://localhost:3000` for booQ

And you can access booQ MariaDB by executing commands
`docker-compose exec db bash` and `mysql -uroot -ppassword -Dbooq`
`docker-compose exec db bash` and `mysql -uroot -ppassword -Dbooq`

You can also execute build shell script

```
$ sh scripts/build.sh
```

And start development

```
$ sh scripts/up.sh
```
```

#### test

You can test this project

```
$ docker-compose -f docker/test/docker-compose.yml up --abort-on-container-exit
```

Or you can also execute test shell script

```
$ sh scripts/test.sh
```

#### Rebuild

`docker-compose up --no-deps --build`

#### Destroy Containers and Volumes

`docker-compose down -v`

## Contribution

The task list is in [issue](https://github.com/traPtitech/booQ/issues)

1. Fork it ( https://github.com/traPtitech/booQ )
Expand Down
47 changes: 0 additions & 47 deletions compose-dev.yml

This file was deleted.

Loading

0 comments on commit 9ff6ef9

Please sign in to comment.