diff --git a/.github/actions/setup-tools/action.yml b/.github/actions/setup-tools/action.yml new file mode 100644 index 0000000..56a6606 --- /dev/null +++ b/.github/actions/setup-tools/action.yml @@ -0,0 +1,14 @@ +name: Setup Tools +description: Action that sets up Node and pnpm +runs: + using: composite + steps: + - name: Setup pnpm + uses: pnpm/action-setup@739bfe42ca9233c5e6aca07c1a25a9d34aca49b0 # v6.0.7 + - name: Setup Node + uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 + with: + node-version-file: .nvmrc + - name: Install dependencies + shell: bash + run: pnpm install --frozen-lockfile diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 0000000..d67155a --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,30 @@ +name: PR + +on: + pull_request: + +concurrency: + group: ${{ github.workflow }}-${{ github.event.number || github.ref }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + test: + name: Test + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + fetch-depth: 0 + persist-credentials: false + - name: Setup Tools + uses: ./.github/actions/setup-tools + - name: Get base and head commits for `nx affected` + uses: nrwl/nx-set-shas@3e9ad7370203c1e93d109be57f3b72eb0eb511b1 # v4.4.0 + with: + main-branch-name: main + - name: Run Checks + run: pnpm run test:pr --parallel=3 diff --git a/package.json b/package.json index 3771c11..31b15b4 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "release": "nx run tempblot-vscode:release", "format": "prettier --write .", "test": "nx run-many -t test:lib --projects=tempblot-parser,prettier-plugin-tempblot,tempblot && nx run-many -t test:types --projects=tempblot-parser,tempblot && nx run-many -t test:build --projects=tempblot && nx run tempblot-workspace:sherif && nx run tempblot-workspace:knip", + "test:pr": "nx affected -t test:lib --projects=tempblot-parser,prettier-plugin-tempblot,tempblot && nx affected -t test:types --projects=tempblot-parser,tempblot && nx affected -t test:build --projects=tempblot && nx run tempblot-workspace:sherif && nx run tempblot-workspace:knip", "test:lib": "nx run-many -t test:lib --projects=tempblot-parser,prettier-plugin-tempblot,tempblot", "test:types": "nx run-many -t test:types --projects=tempblot-parser,tempblot", "test:build": "nx run-many -t test:build --projects=tempblot",