From 635ed63b6304412ed6ceeeba20065a0e0c9a8fbf Mon Sep 17 00:00:00 2001 From: sinYa Iwasaki Date: Fri, 31 Mar 2023 01:45:25 +0900 Subject: [PATCH] Use GitHub Actions #451 test --- .github/workflows/ci.yml | 51 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fa75a2a2..d2da6643 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,6 +60,55 @@ jobs: timeout-minutes: 1 + env: + DATABASE_URL: mysql://root:root@127.0.0.1:3306/test + + services: + mysql: + image: mysql + ports: + - 3306:3306 + env: + MYSQL_DATABASE: test + MYSQL_ROOT_USER: root + MYSQL_ROOT_PASSWORD: root + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + + redis: + image: redis + ports: + - 6379:6379 + options: >- + --health-cmd "redis-cli ping" + --health-interval 10s + --health-timeout 5s + --health-retries 5 + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + + - name: Install dependencies + run: npm ci + + - name: Prisma generate + run: npx prisma generate + + - name: Prisma migrate + run: npx prisma migrate deploy + + - name: Seeder generate + run: npx prisma db seed + + - name: Test + run: npm run test:ci + + test_e2e: + name: Run end-to-end tests + runs-on: ubuntu-latest + + timeout-minutes: 1 + env: DATABASE_URL: mysql://root:root@127.0.0.1:3306/test @@ -105,4 +154,4 @@ jobs: run: npx prisma db seed - name: Test - run: npm run test:ci + run: npm run test:e2e