From 2543594f3f95782a22bc06c17f74b14898d15039 Mon Sep 17 00:00:00 2001 From: Bernardo Guerreiro Date: Tue, 23 Jan 2024 22:40:02 +0000 Subject: [PATCH] feat: add pr workflow --- .github/workflows/pull_request.yaml | 38 +++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/pull_request.yaml diff --git a/.github/workflows/pull_request.yaml b/.github/workflows/pull_request.yaml new file mode 100644 index 0000000..6996a69 --- /dev/null +++ b/.github/workflows/pull_request.yaml @@ -0,0 +1,38 @@ +name: Run tests on Branch + +on: + workflow_dispatch: + pull_request: + branches: + - main + +jobs: + run-unit-tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install dependencies + run: npm ci + - name: Run unit tests + run: npm test + + deploy-ephemeral: + uses: ./.github/workflows/serverless-deploy.yaml + needs: run-unit-tests + permissions: + id-token: write + contents: read + secrets: + AWS_DEPLOYER_ROLE: ${{ secrets.AWS_DEPLOYER_ROLE }} + with: + ENVIRONMENT: ${{ github.actor }}-${{ github.event.pull_request.number }} + SHOULD_SEED_DB: true + + run-functional-tests: + needs: deploy-ephemeral + runs-on: ubuntu-latest + steps: + - name: Run functional tests + run: echo "Running functional tests against ${{ needs.deploy-ephemeral.outputs.SERVICE_URL }}" + env: + SERVICE_URL: ${{ needs.deploy-ephemeral.outputs.SERVICE_URL }} \ No newline at end of file