diff --git a/.github/workflows/cache-tests.yaml b/.github/workflows/cache-tests.yaml new file mode 100644 index 0000000..65a7fe6 --- /dev/null +++ b/.github/workflows/cache-tests.yaml @@ -0,0 +1,29 @@ +name: Run unit and integration tests + +on: + push: + branches: + - 'test-ci' + pull_request: + branches: + - 'test-ci' + +jobs: + tests: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [ 20.x ] + name: Run tests on Node ${{ matrix.node-version }} + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Setup node + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'yarn' + - name: Install dependencies + run: yarn install --frozen-lockfile --prefer-offline + - name: Run tests + run: yarn test:ci diff --git a/.github/workflows/shard-e2e.yaml b/.github/workflows/shard-e2e.yaml index 4d103c7..64c7920 100644 --- a/.github/workflows/shard-e2e.yaml +++ b/.github/workflows/shard-e2e.yaml @@ -1,12 +1,15 @@ name: Run e2e tests on: - push: - branches: - - 'test-ci' - pull_request: - branches: - - 'test-ci' + workflow_call: + +#on: +# push: +# branches: +# - 'test-ci' +# pull_request: +# branches: +# - 'test-ci' env: MAILER_SECRET: E2E @@ -91,13 +94,6 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 - - name: Setup node - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - cache: 'yarn' - - name: Install dependencies - run: yarn install --frozen-lockfile - name: Download blob reports from GitHub Actions Artifacts uses: actions/download-artifact@v4 with: diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 31f2bda..40e7710 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -18,6 +18,16 @@ jobs: with: node-version: ${{ matrix.node-version }} cache: 'yarn' + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT + - uses: actions/cache@v3 + id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- - name: Install dependencies run: yarn install --frozen-lockfile - name: Run tests