From f794e8f112abb2084dd040baf2e378da6a361fab Mon Sep 17 00:00:00 2001 From: "Lin, Hung-Shin" Date: Thu, 28 Sep 2023 13:54:36 +0800 Subject: [PATCH] feat: setup github action e2e job --- .github/workflows/ci_cd.yml | 25 ++++++++++++++++++++++++- docker-compose.testing.yml | 12 ++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index f03ee82..4a31aab 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -24,8 +24,31 @@ jobs: - name: Test run: yarn test + e2e: + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v3 + + - name: Pull Test Environment Images + run: docker-compose -f docker-compose.testing.yml pull db-test + + - name: Build Test Environment, Stage 1 + run: docker-compose -f docker-compose.testing.yml build base backend app-test + + - name: Build Test Environment, Stage 2 + run: docker-compose -f docker-compose.testing.yml build helloworld + + - name: Run Cypress Tests + run: docker-compose -f docker-compose.testing.yml run cypress + + - name: Tear Down Test Environment + run: docker-compose -f docker-compose.testing.yml down + build-and-push: - needs: ci + needs: + - ci + - e2e if: github.ref == 'refs/heads/main' runs-on: ubuntu-latest diff --git a/docker-compose.testing.yml b/docker-compose.testing.yml index f651f03..9232f84 100644 --- a/docker-compose.testing.yml +++ b/docker-compose.testing.yml @@ -53,6 +53,18 @@ services: - MONGO_PASS=user-password - MONGO_DB=odyssey-test + base: + image: lancatlin/linux-odyssey:base + build: + context: . + dockerfile: ./quests/Dockerfile + + helloworld: + image: lancatlin/linux-odyssey:helloworld + build: + context: . + dockerfile: quests/helloworld/Dockerfile + networks: internal: players: