Skip to content

Commit

Permalink
chore: update actions (#3986)
Browse files Browse the repository at this point in the history
  • Loading branch information
quantizor committed Aug 30, 2024
1 parent 728f8b9 commit fbe8da0
Show file tree
Hide file tree
Showing 7 changed files with 221 additions and 152 deletions.
67 changes: 31 additions & 36 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,41 +10,32 @@ jobs:
name: 'determine changes'
runs-on: ubuntu-latest
outputs:
changes: ${{ steps.changed-files-yaml.outputs.src_any_changed }}
changes: ${{ steps.changed-files-yaml.outputs.any_changed }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Detect changed files
id: changed-files-yaml
uses: tj-actions/changed-files@v39
uses: tj-actions/changed-files@v45
with:
files_yaml: |
src:
- packages/formik/src/**
- packages/formik/package.json
- packages/formik-native/src/**
- packages/formik-native/package.json
files: |
.github/workflows/ci.yml
packages/formik/src/**
packages/formik/package.json
packages/formik-native/src/**
packages/formik-native/package.json
benchmark:
if: needs.detectChangedSourceFiles.outputs.changes == 'true'
if: always() && needs.detectChangedSourceFiles.outputs.changes == 'true'
needs: detectChangedSourceFiles
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
cache: yarn
node-version-file: .nvmrc

- name: Detect changed files
id: changed-files-yaml
uses: tj-actions/changed-files@v39
with:
files_yaml: |
src:
- packages/formik/src/**
- packages/formik-native/src/**
- name: Install & build
run: |
node --version
Expand All @@ -54,7 +45,7 @@ jobs:
yarn build:benchmark
- name: Download previous benchmark data
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ./benchmark-cache
key: ${{ runner.os }}-benchmark
Expand All @@ -78,13 +69,15 @@ jobs:
fail-threshold: 120%
# needed for commenting on PRs
github-token: ${{ secrets.GITHUB_TOKEN }}

interaction:
if: needs.detectChangedSourceFiles.outputs.changes == 'true'
needs: detectChangedSourceFiles
if: always() && needs.detectChangedSourceFiles.outputs.changes == 'true'
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
cache: yarn
node-version-file: .nvmrc
Expand All @@ -97,7 +90,7 @@ jobs:
run: echo "PLAYWRIGHT_VERSION=$(node -e "console.log(require('./package-lock.json').dependencies['@playwright/test'].version)")" >> $GITHUB_ENV

- name: Cache playwright binaries
uses: actions/cache@v3
uses: actions/cache@v4
id: playwright-cache
with:
path: |
Expand All @@ -112,31 +105,33 @@ jobs:

- name: Run Playwright tests
run: yarn playwright test
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 5

size:
if: needs.detectChangedSourceFiles.outputs.changes == 'true'
needs: detectChangedSourceFiles
if: always() && needs.detectChangedSourceFiles.outputs.changes == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: preactjs/compressed-size-action@v2
with:
repo-token: '${{ secrets.GITHUB_TOKEN }}'
build-script: 'turbo run build --filter {./packages/*}...'

unit:
if: needs.detectChangedSourceFiles.outputs.changes == 'true'
needs: detectChangedSourceFiles
if: always() && needs.detectChangedSourceFiles.outputs.changes == 'true'
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
cache: yarn
node-version-file: .nvmrc
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ jobs:
runs-on: ubuntu-latest
if: github.repository == 'jaredpalmer/formik'
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
cache: yarn
node-version-file: .nvmrc
Expand All @@ -22,7 +22,7 @@ jobs:
run: yarn install

- name: Create Release Pull Request or Publish to npm
uses: changesets/action@master
uses: changesets/action@1.4.8
with:
publish: yarn release
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v3
- uses: actions/stale@v9
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
days-before-stale: 30
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"lint-staged": "^10.4.0",
"prettier": "^2.1.2",
"react-hook-form": "^7.45.0",
"ts-node": "^10.9.1",
"tslib": "^2.5.3",
"tsx": "^4.19.0",
"turbo": "^1.9.9"
},
"workspaces": [
Expand All @@ -43,7 +43,7 @@
"precommit": "lint-staged",
"e2e:ui": "playwright test --ui",
"start:app": "turbo run build --filter formik... && yarn --cwd packages/formik link && yarn --cwd ./app link formik && yarn --cwd ./app && yarn --cwd ./app run dev",
"benchmark": "ts-node scripts/benchmark.tsx | tee output.txt"
"benchmark": "tsx scripts/benchmark.tsx | tee output.txt"
},
"lint-staged": {
"**/*.{ts,tsx,md,mdx,js,jsx}": [
Expand Down
14 changes: 7 additions & 7 deletions scripts/benchmark.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ import { renderToString } from 'react-dom/server';
import { useFieldArray, useForm } from 'react-hook-form';
import * as yup from 'yup';

const schema = yup.object({
firstName: yup.string().required(),
lastName: yup.string().required(),
email: yup.string().email().required(),
guests: yup.array(yup.object({ name: yup.string().required() })).ensure(),
});

const suite = new Benchmark.Suite({ initCount: 50 });

suite
Expand All @@ -23,13 +30,6 @@ suite
})
.run();

const schema = yup.object({
firstName: yup.string().required(),
lastName: yup.string().required(),
email: yup.string().email().required(),
guests: yup.array(yup.object({ name: yup.string().required() })).ensure(),
});

// generic Formik implementation
function FormikSimpleExample() {
return (
Expand Down
4 changes: 0 additions & 4 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,5 @@
"formik-native": ["./packages/react-native/src"],
"$test/*": ["test/*"]
}
},
"ts-node": {
"esm": true,
"transpileOnly": true
}
}
Loading

0 comments on commit fbe8da0

Please sign in to comment.