From b3354de1fae216729bc5982f19bf479668479fe8 Mon Sep 17 00:00:00 2001 From: Lev Chelyadinov Date: Sun, 16 Jun 2024 21:43:03 +0200 Subject: [PATCH] Make tests run on other OSes --- .github/actions/setup/action.yaml | 27 +++++++++++++++++++ .github/workflows/code-quality.yaml | 41 ++++++++++++++++------------- 2 files changed, 50 insertions(+), 18 deletions(-) create mode 100644 .github/actions/setup/action.yaml diff --git a/.github/actions/setup/action.yaml b/.github/actions/setup/action.yaml new file mode 100644 index 0000000..1b9d0f2 --- /dev/null +++ b/.github/actions/setup/action.yaml @@ -0,0 +1,27 @@ +name: "Setup and install" +description: "Common setup steps for Actions" +inputs: + node-version: + description: "Version of Node.js" + required: true + default: "20" + +runs: + using: composite + steps: + - name: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: 9 + + - uses: actions/setup-node@v4 + with: + node-version: ${{ inputs.node-version }} + cache: "pnpm" + + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install dependencies + shell: bash + run: pnpm install diff --git a/.github/workflows/code-quality.yaml b/.github/workflows/code-quality.yaml index 538558c..36441a2 100644 --- a/.github/workflows/code-quality.yaml +++ b/.github/workflows/code-quality.yaml @@ -4,31 +4,36 @@ on: push: jobs: - check-code-quality: + static-checks: runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 + - uses: actions/checkout@v4 - - name: Setup pnpm - uses: pnpm/action-setup@v4 - with: - version: 8 - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: "22" - cache: "pnpm" - - - name: Install dependencies - run: pnpm install + - name: Setup + uses: ./.github/actions/setup - run: pnpm lint - run: pnpm typecheck - - run: pnpm test - run: pnpx prettier --check . + check-code-quality: + timeout-minutes: 10 + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + node: [18, 22] + + steps: + - uses: actions/checkout@v4 + + - name: Setup + uses: ./.github/actions/setup + with: + node-version: ${{ matrix.node }} + + - name: Run tests + run: pnpm test + - name: Try building the library run: pnpm build