workerを整理 #123
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 | |
jobs: | |
check: | |
env: | |
DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres | |
REDIS_HOST: localhost:6379 | |
services: | |
postgres: | |
image: postgres:14.5 | |
env: | |
POSTGRES_PASSWORD: postgres | |
ports: | |
- 5432:5432 | |
redis: | |
image: redis:5.0.14 | |
ports: | |
- 6379:6379 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- run: npm ci | |
- run: npx lerna run build | |
- run: npm run format:check | |
- run: npm run lint | |
- run: | | |
npx prisma migrate deploy | |
npm test | |
working-directory: packages/server | |
docker: | |
runs-on: ubuntu-latest | |
needs: check | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to Docker | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Generate tags | |
uses: kgtkr/docker-tags-gen-action@master | |
id: tags | |
with: | |
name: ghcr.io/${{ github.repository_owner }}/anontown-server | |
- name: Build and push | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: ${{ steps.tags.outputs.tags }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |