diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f2b0b447..caf72cbe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,22 +4,22 @@ on: pull_request: types: [opened, synchronize] -env: - NODE_VERSION: 20.x - jobs: setup: runs-on: ubuntu-latest + strategy: + matrix: + node-version: [18.x, 20.x] steps: - run: echo "Triggered by ${{ github.event_name }} event." - name: Check out repository code ${{ github.repository }} on ${{ github.ref }} uses: actions/checkout@v3 - - name: Set up Node.js ${{ env.NODE_VERSION }} + - name: Set up Node.js ${{ matrix.node-version }} uses: actions/setup-node@v3 with: - node-version: ${{ env.NODE_VERSION }} + node-version: ${{ matrix.node-version }} cache: 'npm' - name: Cache node modules @@ -39,10 +39,19 @@ jobs: build: needs: setup runs-on: ubuntu-latest + strategy: + matrix: + node-version: [18.x, 20.x] steps: - name: Check out repository code ${{ github.repository }} on ${{ github.ref }} uses: actions/checkout@v3 + - name: Set up Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + - name: Restore node modules from cache uses: actions/cache@v3 with: @@ -59,10 +68,19 @@ jobs: test-current: needs: setup runs-on: ubuntu-latest + strategy: + matrix: + node-version: [18.x, 20.x] steps: - name: Check out repository code ${{ github.repository }} on ${{ github.ref }} uses: actions/checkout@v3 + - name: Set up Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + - name: Restore node modules from cache uses: actions/cache@v3 with: @@ -79,6 +97,9 @@ jobs: test-target: needs: setup runs-on: ubuntu-latest + strategy: + matrix: + node-version: [18.x, 20.x] steps: - name: Check out repository code ${{ github.repository }} on ${{ github.ref }} uses: actions/checkout@v3 @@ -105,10 +126,10 @@ jobs: echo "Merge successful." fi - - name: Set up Node.js ${{ env.NODE_VERSION }} + - name: Set up Node.js ${{ matrix.node-version }} uses: actions/setup-node@v3 with: - node-version: ${{ env.NODE_VERSION }} + node-version: ${{ matrix.node-version }} cache: 'npm' - name: Restore node modules from cache @@ -141,10 +162,10 @@ jobs: run: | echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc - - name: Set up Node.js ${{ env.NODE_VERSION }} + - name: Set up Node.js 20.x uses: actions/setup-node@v3 with: - node-version: ${{ env.NODE_VERSION }} + node-version: 20.x cache: 'npm' registry-url: 'https://registry.npmjs.org/'