Skip to content

Commit

Permalink
chore: switching to an affected strategy (#5215)
Browse files Browse the repository at this point in the history
* switiching to an affected strategy

* updating base affected option for ci and ci-v3 workflows

* Update .github/workflows/ci-v3.yml

Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>

* checking github context

* checking pnpm version

* fix?

* does not like main - let's use a sha then

* checking git head

* checking git in general

* fix????

* fix???????? pleeeease

* still in detatched head state

* try checking out the pr head sha?

* checking out pr branch

* checking githubref

* full gh ref

* dumping context again

* try to checkout head ref

* adding repo prop

* git logging

* trying with sha for base

* fixing other jobs

* fixing other jobs again

* reverting root specific projects to run many

* removing special stuff from build test

* testing affected

* reverting change

---------

Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
  • Loading branch information
ZackDeRose and TkDodo authored Apr 2, 2023
1 parent dbf452e commit 55bdf77
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
- name: Run Tests
uses: nick-fields/retry@v2.8.3
with:
command: pnpm run test:ci
command: pnpm run test:ci --base=${{ github.event.before }}
timeout_minutes: 10
max_attempts: 3
- name: Publish
Expand Down
30 changes: 25 additions & 5 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.head_ref }}
repository: ${{github.event.pull_request.head.repo.full_name}}
- uses: pnpm/action-setup@v2.2.4
with:
version: 7
Expand All @@ -22,7 +26,7 @@ jobs:
- name: Run Tests
uses: nick-fields/retry@v2.8.3
with:
command: pnpm test:lib
command: pnpm test:lib --base=${{ github.event.pull_request.base.sha }}
timeout_minutes: 5
max_attempts: 3
- name: Upload coverage to Codecov
Expand All @@ -32,6 +36,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.head_ref }}
repository: ${{github.event.pull_request.head.repo.full_name}}
- uses: pnpm/action-setup@v2.2.4
with:
version: 7
Expand All @@ -41,12 +49,16 @@ jobs:
cache: 'pnpm'
- name: Install dependencies
run: pnpm --filter "./packages/**" --filter query --prefer-offline install
- run: pnpm run test:eslint
- run: pnpm run test:eslint --base=${{ github.event.pull_request.base.sha }}
typecheck:
name: 'Typecheck'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.head_ref }}
repository: ${{github.event.pull_request.head.repo.full_name}}
- uses: pnpm/action-setup@v2.2.4
with:
version: 7
Expand All @@ -56,12 +68,16 @@ jobs:
cache: 'pnpm'
- name: Install dependencies
run: pnpm --filter "./packages/**" --filter query --prefer-offline install
- run: pnpm run test:types
- run: pnpm run test:types --base=${{ github.event.pull_request.base.sha }}
format:
name: 'Format'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.head_ref }}
repository: ${{github.event.pull_request.head.repo.full_name}}
- uses: pnpm/action-setup@v2.2.4
with:
version: 7
Expand All @@ -71,12 +87,16 @@ jobs:
cache: 'pnpm'
- name: Install dependencies
run: pnpm --filter "./packages/**" --filter query --prefer-offline install
- run: pnpm run test:format
- run: pnpm run test:format --base=${{ github.event.pull_request.base.sha }}
test-react-17:
name: 'Test React 17'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.head_ref }}
repository: ${{github.event.pull_request.head.repo.full_name}}
- uses: pnpm/action-setup@v2.2.4
with:
version: 7
Expand All @@ -91,7 +111,7 @@ jobs:
with:
timeout_minutes: 5
max_attempts: 3
command: pnpm run test:react:17
command: pnpm run test:react:17 --base=${{ github.event.pull_request.base.sha }}
env:
REACTJS_VERSION: 17
test-build:
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
"preinstall": "node -e \"if(process.env.CI == 'true') {console.log('Skipping preinstall...'); process.exit(1)}\" || npx -y only-allow pnpm",
"install:csb": "pnpm install --frozen-lockfile",
"test": "pnpm run test:ci",
"test:ci": "nx run-many --targets=test:lib,test:types,test:eslint,test:format --parallel=5",
"test:react:17": "nx run-many --target=test:lib --projects=@tanstack/react-*",
"test:eslint": "nx run-many --target=test:eslint --parallel=5",
"test:ci": "nx affected --targets=test:lib,test:types,test:eslint,test:format --parallel=5",
"test:react:17": "nx affected --target=test:lib --projects=@tanstack/react-*",
"test:eslint": "nx affected --target=test:eslint --parallel=5",
"test:format": "pnpm run prettier --check",
"test:lib": "nx run-many --target=test:lib --parallel=5",
"test:lib": "nx affected --target=test:lib --parallel=5",
"test:lib:dev": "pnpm --filter \"./packages/**\" run test:lib:dev",
"test:build": "nx run-many --target=test:build --projects=root",
"test:types": "nx run-many --target=test:types --parallel=5",
"test:types": "nx affected --target=test:types --parallel=5",
"build": "nx run-many --target=build --projects=root",
"build:types": "nx run-many --target=build:types --parallel=5",
"build:types": "nx affected --target=build:types --parallel=5",
"watch": "concurrently --kill-others \"rollup --config rollup.config.js -w\" \"pnpm run build:types --watch\"",
"dev": "pnpm run watch",
"prettier": "prettier --plugin-search-dir . \"{packages,examples}/**/src/**/*.{md,js,jsx,ts,tsx,json,vue,svelte}\"",
Expand Down

0 comments on commit 55bdf77

Please sign in to comment.