Skip to content

Commit

Permalink
Setup all tests for old versions of effector (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
igorkamyshev authored Nov 30, 2023
1 parent 00e05ea commit 77cc914
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,46 @@ jobs:
- run: pnpm install --frozen-lockfile
- run: pnpm playwright install
- run: pnpm test:e2e

checks_old_versions:
runs-on: ubuntu-latest

strategy:
matrix:
version: [22]

steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
- run: pnpm install --frozen-lockfile

- run: node ./tools/other-majors/prepare.mjs ${{ matrix.version }}
- run: pnpm install --no-frozen-lockfile

- run: pnpm test
- run: pnpm test:types
e2e_old_versions:
runs-on: ubuntu-latest

strategy:
matrix:
version: [22]

steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
- run: pnpm install --frozen-lockfile

- run: node ./tools/other-majors/prepare.mjs ${{ matrix.version }}
- run: pnpm install --no-frozen-lockfile

- run: pnpm playwright install
- run: pnpm test:e2e
6 changes: 6 additions & 0 deletions tools/other-majors/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"22": {
"effector": "^22.8.6",
"effector-vue": "^22.2.0"
}
}
36 changes: 36 additions & 0 deletions tools/other-majors/prepare.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { createRequire } from 'node:module';

import manifest from './manifest.json' assert { type: 'json' };

const require = createRequire(import.meta.url);

const { readJsonFile, writeJsonFile } = require('@nx/devkit');

const [, , versoin] = process.argv;

const oldPackageJson = readJsonFile('package.json');

const newVersions = manifest[versoin];

if (!newVersions) {
throw new Error(`No versions found for ${versoin}`);
}

writeJsonFile('package.json', {
...oldPackageJson,
devDependencies: applyNewVersions(
oldPackageJson.devDependencies,
newVersions
),
dependencies: applyNewVersions(oldPackageJson.dependencies, newVersions),
});

function applyNewVersions(deps, newVersions) {
return Object.entries(deps).reduce((acc, [key, value]) => {
if (newVersions[key]) {
return { ...acc, [key]: newVersions[key] };
}

return { ...acc, [key]: value };
}, {});
}

0 comments on commit 77cc914

Please sign in to comment.