diff --git a/.github/actions/yarn/action.yml b/.github/actions/yarn/action.yml index 2aa211a518..814291b09d 100644 --- a/.github/actions/yarn/action.yml +++ b/.github/actions/yarn/action.yml @@ -1,6 +1,12 @@ name: 'Setup Node & yarn' description: 'Setup a NodeJS environment, install deps, & builds packages' +inputs: + immutable: + description: 'Run yarn install with --immutable (fail if lockfile would change)' + required: false + default: 'true' + runs: using: 'composite' steps: @@ -13,4 +19,9 @@ runs: shell: bash - name: Install dependencies shell: bash - run: yarn install --immutable + run: | + if [ "${{ inputs.immutable }}" = "true" ]; then + yarn install --immutable + else + yarn install + fi diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3322ad9daf..a2362993f0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,13 +20,30 @@ permissions: jobs: test: + name: Test (React ${{ matrix.react_version }}) runs-on: ubuntu-24.04 timeout-minutes: 30 + strategy: + matrix: + react_version: [18, 19] steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: fetch-depth: 0 + - name: Set React version + if: matrix.react_version == 18 + run: | + node -e " + const p = require('./package.json'); + p.resolutions['react'] = '18.3.1'; + p.resolutions['react-dom'] = '18.3.1'; + p.resolutions['@types/react'] = '18.3.1'; + p.resolutions['@types/react-dom'] = '18.3.0'; + require('fs').writeFileSync('package.json', JSON.stringify(p, null, 2)); + " - uses: ./.github/actions/yarn + with: + immutable: ${{ matrix.react_version == 19 }} - name: Fetch main branch run: git fetch origin main:main if: github.event_name == 'pull_request' diff --git a/package.json b/package.json index 5579ff15cd..9bf1d8bfd3 100644 --- a/package.json +++ b/package.json @@ -52,8 +52,8 @@ "@types/invariant": "2.2.29", "@types/konami-code-js": "^0.8.0", "@types/lodash": "4.17.23", - "@types/react": "^18.2.0", - "@types/react-dom": "^18.2.0", + "@types/react": "^19.0.0", + "@types/react-dom": "^19.0.0", "@types/react-test-renderer": "^19.1.0", "@types/stylis": "^4.2.0", "@typescript-eslint/eslint-plugin": "^5.15.0", @@ -113,10 +113,10 @@ "repository": "git@github.com:Codecademy/gamut.git", "resolutions": { "@typescript-eslint/utils": "^5.15.0", - "@types/react": "18.3.1", - "@types/react-dom": "18.3.0", - "react": "18.3.1", - "react-dom": "18.3.1", + "@types/react": "^19.0.0", + "@types/react-dom": "^19.0.0", + "react": "^19.0.0", + "react-dom": "^19.0.0", "error-ex": "1.3.4" }, "scripts": { diff --git a/packages/gamut-icons/package.json b/packages/gamut-icons/package.json index 28f3f47dad..fe7087b347 100644 --- a/packages/gamut-icons/package.json +++ b/packages/gamut-icons/package.json @@ -18,7 +18,7 @@ "@emotion/styled": "^11.3.0", "@types/react": "^18.0.0 || ^19.0.0", "lodash": "^4.17.5", - "react": "^17.0.2 || ^18.2.0 || ^19.0.0" + "react": "^18.2.0 || ^19.0.0" }, "publishConfig": { "access": "public" diff --git a/packages/gamut-illustrations/package.json b/packages/gamut-illustrations/package.json index d6a98ea6d7..492fc5d830 100644 --- a/packages/gamut-illustrations/package.json +++ b/packages/gamut-illustrations/package.json @@ -19,8 +19,8 @@ "@emotion/react": "^11.4.0", "@emotion/styled": "^11.3.0", "@types/react": "^18.0.0 || ^19.0.0", - "react": "^17.0.2 || ^18.2.0 || ^19.0.0", - "react-dom": "^17.0.2 || ^18.2.0 || ^19.0.0" + "react": "^18.2.0 || ^19.0.0", + "react-dom": "^18.2.0 || ^19.0.0" }, "publishConfig": { "access": "public" diff --git a/packages/gamut-patterns/package.json b/packages/gamut-patterns/package.json index 845a7356b5..579973866e 100644 --- a/packages/gamut-patterns/package.json +++ b/packages/gamut-patterns/package.json @@ -20,8 +20,8 @@ "@emotion/react": "^11.4.0", "@emotion/styled": "^11.3.0", "@types/react": "^18.0.0 || ^19.0.0", - "react": "^17.0.2 || ^18.2.0 || ^19.0.0", - "react-dom": "^17.0.2 || ^18.2.0 || ^19.0.0" + "react": "^18.2.0 || ^19.0.0", + "react-dom": "^18.2.0 || ^19.0.0" }, "publishConfig": { "access": "public" diff --git a/packages/gamut-styles/package.json b/packages/gamut-styles/package.json index 8deacc9bb8..1f16ee8cfc 100644 --- a/packages/gamut-styles/package.json +++ b/packages/gamut-styles/package.json @@ -25,7 +25,7 @@ "@emotion/styled": "^11.3.0", "@types/react": "^18.0.0 || ^19.0.0", "lodash": "^4.17.5", - "react": "^17.0.2 || ^18.2.0 || ^19.0.0", + "react": "^18.2.0 || ^19.0.0", "stylis": "^4.0.7" }, "publishConfig": { diff --git a/packages/gamut-tests/package.json b/packages/gamut-tests/package.json index 4177bd02f7..c8bd24d90e 100644 --- a/packages/gamut-tests/package.json +++ b/packages/gamut-tests/package.json @@ -23,7 +23,7 @@ "module": "dist/index.js", "peerDependencies": { "@types/react": "^18.0.0 || ^19.0.0", - "react": "^17.0.2 || ^18.2.0 || ^19.0.0" + "react": "^18.2.0 || ^19.0.0" }, "publishConfig": { "access": "public" diff --git a/packages/gamut/package.json b/packages/gamut/package.json index 62fa61feda..64c5623012 100644 --- a/packages/gamut/package.json +++ b/packages/gamut/package.json @@ -38,8 +38,8 @@ "@emotion/react": "^11.4.0", "@emotion/styled": "^11.3.0", "@types/react": "^18.0.0 || ^19.0.0", - "react": "^17.0.2 || ^18.2.0 || ^19.0.0", - "react-dom": "^17.0.2 || ^18.2.0 || ^19.0.0" + "react": "^18.2.0 || ^19.0.0", + "react-dom": "^18.2.0 || ^19.0.0" }, "publishConfig": { "access": "public"