Skip to content

Commit

Permalink
with retro
Browse files Browse the repository at this point in the history
  • Loading branch information
bguerout committed Dec 9, 2023
1 parent ee04b4a commit 38dc50c
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 12 deletions.
39 changes: 29 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,50 @@ on: [ push ]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x, 17.x, 18.x ]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
node-version: 18.x
cache: npm
- run: npm ci
- run: npm test
- run: npm run lint
- run: npm run build
- uses: actions/upload-artifact@v3
with:
name: built-tests
path: dist/test/

matrix:
runs-on: ubuntu-latest
needs: test
strategy:
matrix:
node-version: [ 12.x, 14.x, 15.x ]
steps:
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- uses: actions/download-artifact@v3
with:
name: built-tests
path: built-tests
- run: npm --prefix built-tests install
- run: npm --prefix built-tests test

coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.x
- run: npm ci
- run: npm run coverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: .coverage
11 changes: 9 additions & 2 deletions .tools/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,26 @@ cd "${PROJECT_DIR}"

echo "Building oleoduc (esm version)..."
tsc -p tsconfig.json
cat >"./dist/mjs/package.json" <<!EOF
cat >"${PROJECT_DIR}/dist/mjs/package.json" <<!EOF
{
"type": "module"
}
!EOF

echo "Building oleoduc (cjs version)..."
tsc -p tsconfig.cjs.json
cat >"./dist/cjs/package.json" <<!EOF
cat >"${PROJECT_DIR}/dist/cjs/package.json" <<!EOF
{
"type": "commonjs"
}
!EOF

echo "Building oleoduc (test version)..."
tsc -p tsconfig.test.json
echo "Patching package.json to be able to run tests against previous versions of nodejs..."
cp "${PROJECT_DIR}/package.json" "${PROJECT_DIR}/dist/test"
npx json -I -f "${PROJECT_DIR}/dist/test/package.json" -e 'this.scripts.test="mocha --recursive test/"'
npx json -I -f "${PROJECT_DIR}/dist/test/package.json" -e 'this.devDependencies.mocha="10.2.0"'

cd -

1 change: 1 addition & 0 deletions tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./dist/test",
"rootDirs": ["./test"],
"types": ["node", "mocha"]
},
Expand Down

0 comments on commit 38dc50c

Please sign in to comment.