From 649d8d34aa604925b4870301ce15bb1216916199 Mon Sep 17 00:00:00 2001 From: Philip Korsholm <88927411+pKorsholm@users.noreply.github.com> Date: Wed, 3 Nov 2021 13:16:12 +0100 Subject: [PATCH] Feat:cancel previous actions on push (#707) --- .github/workflows/action.yml | 50 +++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 20 deletions(-) diff --git a/.github/workflows/action.yml b/.github/workflows/action.yml index c1c33c4ad7..988fea3097 100644 --- a/.github/workflows/action.yml +++ b/.github/workflows/action.yml @@ -3,22 +3,27 @@ on: [push, pull_request] jobs: unit-tests: - runs-on: ubuntu-latest - steps: + runs-on: ubuntu-latest + steps: + - name: Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.9.1 + with: + access_token: ${{ github.token }} + - name: Checkout uses: actions/checkout@v2.3.5 with: fetch-depth: 0 - + - name: Setup Node.js environment uses: actions/setup-node@v2.4.1 with: - node-version: '14' - cache: 'yarn' + node-version: "14" + cache: "yarn" - name: Assert changed run: ./scripts/assert-changed-files-actions.sh "packages" - + - name: Bootstrap packages uses: ./.github/actions/cache-bootstrap with: @@ -26,11 +31,11 @@ jobs: - name: Run unit tests run: node --max-old-space-size=2048 ./node_modules/.bin/jest -w 1 - + integration-tests: - runs-on: ubuntu-latest - - services: + runs-on: ubuntu-latest + + services: postgres: image: postgres env: @@ -43,30 +48,35 @@ jobs: --health-retries 5 ports: - 5432:5432 - - steps: + + steps: + - name: Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.9.1 + with: + access_token: ${{ github.token }} + - name: Checkout uses: actions/checkout@v2.3.5 with: fetch-depth: 0 - + - name: Setup Node.js environment uses: actions/setup-node@v2.4.1 with: - node-version: '14' - cache: 'yarn' + node-version: "14" + cache: "yarn" - name: Bootstrap packages uses: ./.github/actions/cache-bootstrap with: extension: integration-tests - + - name: Install dev cli run: sudo npm i -g medusa-dev-cli - + - name: Set path to medusa repo run: medusa-dev --set-path-to-repo `pwd` - + - name: Force install run: medusa-dev --force-install working-directory: integration-tests/api @@ -74,9 +84,9 @@ jobs: - name: Build integration tests run: yarn build working-directory: integration-tests/api - + - name: Run integration tests run: yarn test working-directory: integration-tests/api - env: + env: DB_PASSWORD: postgres