Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

async/await対応ともうなんか全部 #16

Merged
merged 24 commits into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
1de7f79
:package: update: swift5.5
sun-yryr Dec 19, 2021
d280f7b
:wrench: fix: 公式に沿ったtlsの設定
sun-yryr Dec 19, 2021
ece8738
:sparkles: feat: async/await対応版(暫定)
sun-yryr Dec 19, 2021
e6ab3bc
:bug: fix: 動作確認用のコマンドを微修正
sun-yryr Dec 19, 2021
0f4632a
:recycle: refactor: swift-format
sun-yryr Dec 29, 2021
075ce27
fix: マトリクスCI
sun-yryr May 5, 2022
7057e84
fixup
sun-yryr May 5, 2022
ee36617
fixup
sun-yryr May 5, 2022
8b95484
fixup: nemuikamo
sun-yryr May 5, 2022
a1a464f
chore: ローカル検証
sun-yryr Jan 4, 2024
e9fde5d
Merge branch 'master' into feature/new-async-await
sun-yryr Jan 4, 2024
e99b83d
fix: 暫定エラー処理
sun-yryr Jan 4, 2024
02f33fc
feat: postgresql への移行
sun-yryr Jan 4, 2024
542c6e8
feat: scheduled job をやめる。Redis を消す
sun-yryr Jan 4, 2024
b46afdc
chore: CI周りの修正
sun-yryr Jan 4, 2024
8d2e8e2
chore: macos そのままだと docker 使えないので削除
sun-yryr Jan 4, 2024
a68fff2
chore: run-name で見やすく
sun-yryr Jan 4, 2024
85ad1f1
refactor: ミドルウェア生成を関数に切り出し
sun-yryr Jan 8, 2024
76f629b
chore: openapi の調整
sun-yryr Jan 8, 2024
e0bc725
fix: ヘルスチェックを正しく示す URL に変更
sun-yryr Jan 8, 2024
c719f08
chore: redoc を生成してルートに埋める
sun-yryr Jan 8, 2024
2dc8da2
chore: openapiをチェックするCIの追加
sun-yryr Jan 8, 2024
d53f06b
test: hello エンドポイントに対してのテストを health エンドポイントに変更
sun-yryr Jan 8, 2024
9483f81
chore: update README
sun-yryr Jan 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env.testing
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
DATABASE_HOST=127.0.0.1
DATABASE_PORT=3306
DATABASE_PORT=5432
DATABASE_USERNAME=vapor_username
DATABASE_PASSWORD=vapor_password
DATABASE_NAME=test_agqr_program_guide
9 changes: 5 additions & 4 deletions .github/workflows/build-push.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: build-push
run-name: Push [${{ inputs.version }}] from ${{ github.ref_name }}

on:
workflow_dispatch:
Expand All @@ -12,18 +13,18 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1.5.1
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5
with:
push: true
tags: ghcr.io/${{ github.repository }}:${{ github.event.inputs.version }}
34 changes: 34 additions & 0 deletions .github/workflows/check-openapi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Check OpenAPI
on:
push:
branches:
- master
paths:
- '.github/workflows/check-openapi.yaml'
- 'reference/agqr-radio-program-guide-api.v2.yaml'
- 'Resources/Views/redoc-static.html'
pull_request:
branches:
- master
paths:
- '.github/workflows/check-openapi.yaml'
- 'reference/agqr-radio-program-guide-api.v2.yaml'
- 'Resources/Views/redoc-static.html'

jobs:
exists-diff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: make generate-redoc
- name: Check exists diff
run: |
if ! git diff --quiet; then
exit 1
fi
# TODO: 後で直す
# lint:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - run: make lint-openapi
21 changes: 17 additions & 4 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,23 @@ on:
- master

jobs:
setup:
runs-on: macos-latest
build:
name: Swift ${{ matrix.swift }} on ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
swift: ["5.9"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: swift-actions/setup-swift@v1
with:
swift-version: ${{ matrix.swift }}
- uses: actions/checkout@v4
- run: swift package resolve
- name: swift test
- name: Build
run: swift build
- name: setup service
run: |
docker compose up -d db --wait
- name: Run tests
run: swift test
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ EXPOSE 8080

# Start the Vapor service when the image is run, default to listening on 8080 in production environment
ENTRYPOINT ["./Run"]
CMD ["serve", "--env", "production", "--hostname", "0.0.0.0", "--port", "8080"]
CMD ["serve", "--env", "production", "--hostname", "0.0.0.0", "--port", "8080"]
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ migrate:
build:
docker-compose build --no-cache
up:
docker-compose up -d db redis
docker-compose up -d db
down:
docker-compose down

.PHONY: generate-redoc
generate-redoc:
docker run --rm -v ${PWD}/reference:/spec redocly/cli build-docs agqr-radio-program-guide-api.v2.yaml -o redoc-static.html
mv reference/redoc-static.html Resources/Views/redoc-static.html
69 changes: 21 additions & 48 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@
}
},
{
"package": "fluent-mysql-driver",
"repositoryURL": "https://github.com/vapor/fluent-mysql-driver.git",
"package": "fluent-postgres-driver",
"repositoryURL": "https://github.com/vapor/fluent-postgres-driver.git",
"state": {
"branch": null,
"revision": "f86bf9c80a1c176234a16796c19add399a266c38",
"version": "4.0.2"
"revision": "7c266b539f71331ad6e53ea8fae587ccdaf972f2",
"version": "2.2.6"
}
},
{
Expand Down Expand Up @@ -92,57 +92,21 @@
}
},
{
"package": "mysql-kit",
"repositoryURL": "https://github.com/vapor/mysql-kit.git",
"package": "postgres-kit",
"repositoryURL": "https://github.com/vapor/postgres-kit.git",
"state": {
"branch": null,
"revision": "f54e0876fce2d68551be0e704b3a94f78eedb9f8",
"version": "4.5.0"
"revision": "35deea5c28a7d402f3280d81dee37bed5c56b9fe",
"version": "2.8.3"
}
},
{
"package": "mysql-nio",
"repositoryURL": "https://github.com/vapor/mysql-nio.git",
"package": "postgres-nio",
"repositoryURL": "https://github.com/vapor/postgres-nio.git",
"state": {
"branch": null,
"revision": "f0e8ad7e18e870e8665311d70bf3f01dcd6024a8",
"version": "1.4.0"
}
},
{
"package": "queues",
"repositoryURL": "https://github.com/vapor/queues.git",
"state": {
"branch": null,
"revision": "58b2d785118d164b38c59beb595cbffbea7608ef",
"version": "1.8.1"
}
},
{
"package": "queues-redis-driver",
"repositoryURL": "https://github.com/vapor/queues-redis-driver.git",
"state": {
"branch": null,
"revision": "2728477b50e24be82f5bc0bd0722c35656e1c5b1",
"version": "1.0.3"
}
},
{
"package": "redis",
"repositoryURL": "https://github.com/vapor/redis.git",
"state": {
"branch": null,
"revision": "e955843b08064071f465a6b1ca9e04bebad8623a",
"version": "4.6.0"
}
},
{
"package": "RediStack",
"repositoryURL": "https://gitlab.com/mordil/RediStack.git",
"state": {
"branch": null,
"revision": "5458d6476e05d5f1b43097f1bc9b599e936b5f2f",
"version": "1.3.0"
"revision": "d648c5b4594ffbc2f6173318f70f5531e05ccb4e",
"version": "1.11.0"
}
},
{
Expand All @@ -163,6 +127,15 @@
"version": "3.18.0"
}
},
{
"package": "swift-atomics",
"repositoryURL": "https://github.com/apple/swift-atomics.git",
"state": {
"branch": null,
"revision": "cd142fd2f64be2100422d658e7411e39489da985",
"version": "1.2.0"
}
},
{
"package": "swift-backtrace",
"repositoryURL": "https://github.com/swift-server/swift-backtrace.git",
Expand Down
12 changes: 4 additions & 8 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
// swift-tools-version:5.2
// swift-tools-version:5.5
import PackageDescription

let package = Package(
name: "agqr-program-guide",
platforms: [
.macOS(.v10_15)
.macOS(.v12)
],
dependencies: [
// 💧 A server-side Swift web framework.
.package(url: "https://github.com/vapor/vapor.git", from: "4.0.0"),
.package(url: "https://github.com/vapor/fluent.git", from: "4.0.0"),
.package(url: "https://github.com/vapor/fluent-mysql-driver.git", from: "4.0.0"),
.package(url: "https://github.com/vapor/fluent-postgres-driver.git", from: "2.0.0"),
.package(url: "https://github.com/vapor/leaf.git", from: "4.0.0"),
.package(url: "https://github.com/vapor/redis.git", from: "4.0.0"),
.package(url: "https://github.com/vapor/queues-redis-driver.git", from: "1.0.0"),
// HTML Parser
.package(url: "https://github.com/tid-kijyun/Kanna.git", .upToNextMajor(from: "5.2.4"))
],
Expand All @@ -22,10 +20,8 @@ let package = Package(
name: "App",
dependencies: [
.product(name: "Fluent", package: "fluent"),
.product(name: "FluentMySQLDriver", package: "fluent-mysql-driver"),
.product(name: "FluentPostgresDriver", package: "fluent-postgres-driver"),
.product(name: "Leaf", package: "leaf"),
.product(name: "Redis", package: "redis"),
.product(name: "QueuesRedisDriver", package: "queues-redis-driver"),
.product(name: "Vapor", package: "vapor"),
.product(name: "Kanna", package: "Kanna"),

Expand Down
Loading