From 02cd4e3c0ac59ee898e78e757d2ef3c6c865edcf Mon Sep 17 00:00:00 2001 From: Javier Bullrich Date: Tue, 23 Apr 2024 14:58:33 +0200 Subject: [PATCH] replaced several jobs for a matrix of tests It's cleaner and more straightforward --- .github/workflows/javascript-test.yml | 64 +++++++++------------------ 1 file changed, 22 insertions(+), 42 deletions(-) diff --git a/.github/workflows/javascript-test.yml b/.github/workflows/javascript-test.yml index 14adaa9..7418125 100644 --- a/.github/workflows/javascript-test.yml +++ b/.github/workflows/javascript-test.yml @@ -3,55 +3,35 @@ name: Continuous testing on: [pull_request] jobs: - lint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Use node 20 - uses: actions/setup-node@v3 - with: - node-version: 20 - - uses: c-hive/gha-yarn-cache@v2 - - name: Install dependencies - run: yarn install --frozen-lockfile - - run: yarn run lint - - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Use node 20 - uses: actions/setup-node@v3 - with: - node-version: 20 - - uses: c-hive/gha-yarn-cache@v2 - - name: Install dependencies - run: yarn install --frozen-lockfile - - run: yarn run build - test: + strategy: + matrix: + command: [lint, build, test, "cli '.github/review-bot.yml'"] runs-on: ubuntu-latest + name: running ${{ matrix.command }} + timeout-minutes: 5 steps: - - uses: actions/checkout@v3 - - name: Use node 20 - uses: actions/setup-node@v3 + - uses: actions/checkout@v4.1.3 + - uses: actions/setup-node@v4.0.2 with: node-version: 20 - - uses: c-hive/gha-yarn-cache@v2 + - name: Cache node modules + id: cache-npm + uses: actions/cache@v4.0.2 + env: + cache-name: cache-node-modules + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }} + restore-keys: ${{ runner.os }}-build-${{ env.cache-name }}- - name: Install dependencies run: yarn install --frozen-lockfile - - run: yarn run test + - run: yarn run ${{ matrix.command }} - evaluate-config: + conclude: runs-on: ubuntu-latest + name: All tests passed + needs: [test] steps: - - uses: actions/checkout@v3 - - name: Use node 20 - uses: actions/setup-node@v3 - with: - node-version: 20 - - uses: c-hive/gha-yarn-cache@v2 - - name: Install dependencies - run: yarn install --frozen-lockfile - - name: Evaluates config file - run: yarn run cli ".github/review-bot.yml" + - run: echo '### Good job! All the tests passed 🚀' >> $GITHUB_STEP_SUMMARY