Skip to content

remove deprecated for 3.x, 0.1.x, 0.1.0 #504

remove deprecated for 3.x, 0.1.x, 0.1.0

remove deprecated for 3.x, 0.1.x, 0.1.0 #504

Workflow file for this run

name: CI
on:
pull_request:
branches: [ "main" ]
workflow_dispatch:
jobs:
check-change-files:
runs-on: ubuntu-latest
name: Check change files
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 7.27.0
- name: Use Node.js 18
uses: actions/setup-node@v3
with:
node-version: 18.16.0
cache: 'pnpm'
- name: Install dependencies
run: pnpm install -w
- name: Run check
run: pnpm check
build-supported-version-matrix:
name: Build supported version matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 7.27.0
- name: Use Node.js 18
uses: actions/setup-node@v3
with:
node-version: 18.16.0
cache: 'pnpm'
- id: set-matrix
run: |
pnpm -s --package=semver@7.3.8 -c dlx node <<EOF
// HACK: probably better to set up a temp package in /tmp/\$RANDOM but sounds annoying, pnpm should have this feature
const semver = require(process.env.PATH.split(":").find(x => x.includes(".bin")) + "/../semver");
const ourPkgJson = require("./packages/transformer/package.json");
let json = "";
require("https").get("https://registry.npmjs.org/@itwin/core-backend", r => r.setEncoding("utf8").on("data", d => json += d).on("end", () => {
const supportedMinors = Object.keys(JSON.parse(json).versions)
.filter(v => semver.satisfies(v, ourPkgJson.peerDependencies["@itwin/core-backend"]))
.sort(semver.compare)
// find max patch of each minor
.reduce((result, currVersion) => {
const firstDotIdx = currVersion.indexOf('.');
const secondDotIdx = currVersion.indexOf('.', firstDotIdx + 1);
const minorPrefix = currVersion.substring(0, secondDotIdx);
const currMax = result.maxes[minorPrefix];
if (!currMax)
result.maxes[minorPrefix] = currVersion;
else {
result.maxes[minorPrefix] = semver.gt(currVersion, currMax) ? currVersion : currMax;
}
return result;
}, {
maxes: {},
_getMaxes() { return Object.values(this.maxes); }
}
)
._getMaxes()
.concat("USE_FROZEN_DEV_DEPS");
require("fs").writeFileSync("$GITHUB_OUTPUT", "matrix="+JSON.stringify({ version: supportedMinors }));
}));
EOF
build:
runs-on: ubuntu-latest
name: Lint Build and run Tests
needs: build-supported-version-matrix
strategy:
matrix: ${{ fromJSON(needs.build-supported-version-matrix.outputs.matrix) }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 7.27.0
- name: Use Node.js 18
uses: actions/setup-node@v3
with:
node-version: 18.16.0
cache: 'pnpm'
- name: Force dependency resolution
if: matrix.version != 'USE_FROZEN_DEV_DEPS'
run: |
node <<EOF
const fs = require("fs");
const workspacePkgJsonPath = "./package.json";
const workspacePkgJson = require(workspacePkgJsonPath);
let pnpm = {}
let overrides = {}
if (workspacePkgJson.pnpm) pnpm = workspacePkgJson.pnpm
if (pnpm?.overrides) overrides = pnpm.overrides
workspacePkgJson.pnpm = {
...pnpm,
overrides: {
...overrides,
...Object.fromEntries([
// must be in sync with @itwin dependencies in packages/transformer/package.json#peerDependencies!
"@itwin/core-backend",
"@itwin/core-bentley",
"@itwin/core-common",
"@itwin/core-geometry",
"@itwin/core-quantity",
"@itwin/ecschema-metadata",
].map(pkg => [pkg, "$CORE_VERSION"]))
}
};
fs.writeFileSync(workspacePkgJsonPath, JSON.stringify(workspacePkgJson));
EOF
env:
CORE_VERSION: ${{ matrix.version }}
- name: Install dependencies
run: pnpm install $ARGS
env:
ARGS: ${{ matrix.version == 'USE_FROZEN_DEV_DEPS' && '' || '--no-frozen-lockfile' }}
- name: Sanity test dependency resolution
if: matrix.version != 'USE_FROZEN_DEV_DEPS'
run: |
cd packages/transformer
node <<EOF
const coreVersion = require("@itwin/core-backend/package.json").version;
if (coreVersion !== "$CORE_VERSION")
throw Error('expected core version $CORE_VERSION but got ' + coreVersion)
EOF
env:
CORE_VERSION: ${{ matrix.version }}
- name: Lint
run: pnpm run lint
- name: Build
run: pnpm run build
- name: Test
run: pnpm run test