From 7bfa0dc477d657397dc0ad76778b8dd6481bf9d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristina=20Ca=C3=B1izales?= <113132642+CristiCanizales@users.noreply.github.com> Date: Wed, 27 Sep 2023 14:04:08 -0300 Subject: [PATCH] Cristi/unit tests (#579) * chore: new unit tests * chore: try with lts-1 and lts* * chore: delete old workflow and change references --- .github/workflows/onPushToMain.yml | 4 +- .github/workflows/testCommitExceptMain.yml | 9 ----- .github/workflows/unitTests.yml | 46 ++++++++++++++++++++++ 3 files changed, 49 insertions(+), 10 deletions(-) delete mode 100644 .github/workflows/testCommitExceptMain.yml create mode 100644 .github/workflows/unitTests.yml diff --git a/.github/workflows/onPushToMain.yml b/.github/workflows/onPushToMain.yml index 461b4a26..9f072264 100644 --- a/.github/workflows/onPushToMain.yml +++ b/.github/workflows/onPushToMain.yml @@ -6,7 +6,9 @@ on: jobs: tests: - uses: salesforcecli/github-workflows/.github/workflows/unitTest.yml@main + uses: ./.github/workflows/unitTests.yml + with: + branch: main release: runs-on: ubuntu-latest needs: diff --git a/.github/workflows/testCommitExceptMain.yml b/.github/workflows/testCommitExceptMain.yml deleted file mode 100644 index 82b7f8a1..00000000 --- a/.github/workflows/testCommitExceptMain.yml +++ /dev/null @@ -1,9 +0,0 @@ -name: unit tests -on: - push: - branches-ignore: [main] - workflow_dispatch: - -jobs: - unit-tests: - uses: salesforcecli/github-workflows/.github/workflows/unitTest.yml@main \ No newline at end of file diff --git a/.github/workflows/unitTests.yml b/.github/workflows/unitTests.yml new file mode 100644 index 00000000..d8c1f5cc --- /dev/null +++ b/.github/workflows/unitTests.yml @@ -0,0 +1,46 @@ +name: Unit Tests +on: + push: + branches-ignore: [main] + workflow_dispatch: + workflow_call: + inputs: + branch: + type: string + required: false + +jobs: + unit-tests: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [macos-latest, windows-latest, ubuntu-latest] + nodeVersion: [lts/-1, lts/*] + fail-fast: false + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node_version }} + cache: yarn + - uses: google/wireit@setup-github-actions-caching/v1 + - name: Cache node modules + id: cache-nodemodules + uses: actions/cache@v3 + env: + cache-name: cache-node-modules + with: + path: "**/node_modules" + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }} + + - uses: salesforcecli/github-workflows/.github/actions/yarnInstallWithRetries@main + if: ${{ steps.cache-nodemodules.outputs.cache-hit != 'true' }} + - run: yarn build + - uses: nick-fields/retry@943e742917ac94714d2f408a0e8320f2d1fcafcd + env: + SF_DISABLE_TELEMETRY: true + name: yarn test + with: + max_attempts: 2 + command: yarn test + timeout_minutes: 60 \ No newline at end of file