From 2d79b985a3a942681d06c149f0e4b36af7b2b3f5 Mon Sep 17 00:00:00 2001 From: alexperez Date: Wed, 11 Dec 2024 10:43:25 -0300 Subject: [PATCH] chore: update deployment workflow to support additional branches and improve testing strategy --- .github/workflows/deployment.yml | 51 +++++++++++--------------------- 1 file changed, 18 insertions(+), 33 deletions(-) diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index a349f98..408870b 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -7,39 +7,26 @@ on: - master - main - develop + - stage + - support/* pull_request: branches: - - master - main + - develop + jobs: - test_linux: - name: Ubuntu - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 - with: - node-version: 16 - - uses: actions/cache@v1 - with: - path: ~/.npm - key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-node- - - name: Install Playwright dependencies - run: npx playwright install --with-deps - - name: Install dependencies - run: npm ci - - name: Run tests - run: npm test - test_win: - name: "Windows" - runs-on: windows-latest + tests: + name: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-20.04, windows-2019] + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2 - uses: actions/setup-node@v1 with: - node-version: 16 + node-version: 18 - uses: microsoft/playwright-github-action@v1 - uses: actions/cache@v1 with: @@ -47,19 +34,17 @@ jobs: key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} restore-keys: | ${{ runner.os }}-node- - - name: Install Playwright dependencies - run: npx playwright install --with-deps - name: Install dependencies run: npm ci - name: Run tests run: npm test + tag: name: "Publishing release" - if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' + if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' needs: - - test_linux - - test_win - runs-on: ubuntu-latest + - tests + runs-on: self-hosted steps: - name: Checkout code uses: actions/checkout@v2 @@ -67,7 +52,7 @@ jobs: fetch-depth: 0 - uses: actions/setup-node@v2 with: - node-version: '16.x' + node-version: '18.x' registry-url: 'https://registry.npmjs.org' - uses: actions/cache@v1 with: @@ -75,7 +60,7 @@ jobs: key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} restore-keys: | ${{ runner.os }}-node- - - run: npm install + - run: npm ci - name: Read version from package.json uses: culshaw/read-package-node-version-actions@v1 id: package-node-version