From 501d63adfd2e1bcb110f446e5f735b089d7815e2 Mon Sep 17 00:00:00 2001 From: Eike Foken Date: Sat, 30 Nov 2024 15:49:47 +0100 Subject: [PATCH] Setup GitHub actions --- .github/workflows/node.js.yml | 43 +++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/node.js.yml diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml new file mode 100644 index 0000000..4d3e6c7 --- /dev/null +++ b/.github/workflows/node.js.yml @@ -0,0 +1,43 @@ +name: Node.js CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [18.x, 20.x, 22.x] + + steps: + - uses: actions/checkout@v4 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'yarn' + + - name: Install dependencies + run: yarn install --immutable + + - name: Get installed Playwright version + run: echo "PLAYWRIGHT_VERSION=$(yarn info playwright --json | jq '.children.Version')" >> $GITHUB_ENV + + - name: Cache Playwright binaries + uses: actions/cache@v3 + with: + path: | + ~/.cache/ms-playwright + key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }} + + - name: Install Playwright Browsers + run: yarn playwright install --with-deps + if: steps.playwright-cache.outputs.cache-hit != 'true' + + - run: yarn test