Verify content of dist/ folder matches build output

This commit is contained in:
Michal Dorner 2022-11-13 12:39:16 +01:00
parent 3cca7492d0
commit 59de73d003
No known key found for this signature in database
GPG key ID: 7325B8B59CA1B65C
5 changed files with 94 additions and 4 deletions

53
.github/workflows/check-dist.yml vendored Normal file
View file

@ -0,0 +1,53 @@
# `dist/index.js` is a special file in Actions.
# When you reference an action with `uses:` in a workflow,
# `index.js` is the code that will run.
# For our project, we generate this file through a build process from other source files.
# We need to make sure the checked-in `index.js` actually matches what we expect it to be.
name: Check dist/
on:
push:
branches:
- main
paths-ignore:
- '**.md'
pull_request:
paths-ignore:
- '**.md'
workflow_dispatch:
jobs:
check-dist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set Node.js 16.x
uses: actions/setup-node@v3.5.1
with:
node-version: 16.x
- name: Install dependencies
run: npm ci
- name: Rebuild the dist/ directory
run: |
npm run build
npm run package
- name: Compare the expected and actual dist/ directories
run: |
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
echo "Detected uncommitted changes after build. See status below:"
git diff
exit 1
fi
id: diff
# If index.js was different than expected, upload the expected version as an artifact
- uses: actions/upload-artifact@v2
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
with:
name: dist
path: dist/

4
dist/index.js generated vendored
View file

@ -2036,8 +2036,8 @@ var Align;
Align["None"] = "---"; Align["None"] = "---";
})(Align = exports.Align || (exports.Align = {})); })(Align = exports.Align || (exports.Align = {}));
exports.Icon = { exports.Icon = {
skip: '✖️', skip: '',
success: '✔️', success: '',
fail: '❌' // ':x:' fail: '❌' // ':x:'
}; };
function link(title, address) { function link(title, address) {

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

36
package-lock.json generated
View file

@ -31,6 +31,7 @@
"@typescript-eslint/eslint-plugin": "^5.33.1", "@typescript-eslint/eslint-plugin": "^5.33.1",
"@typescript-eslint/parser": "^5.33.1", "@typescript-eslint/parser": "^5.33.1",
"@vercel/ncc": "^0.34.0", "@vercel/ncc": "^0.34.0",
"eol-converter-cli": "^1.0.8",
"eslint": "^8.22.0", "eslint": "^8.22.0",
"eslint-import-resolver-typescript": "^3.4.2", "eslint-import-resolver-typescript": "^3.4.2",
"eslint-plugin-github": "^4.1.2", "eslint-plugin-github": "^4.1.2",
@ -2748,6 +2749,25 @@
"node": ">=10.13.0" "node": ">=10.13.0"
} }
}, },
"node_modules/eol": {
"version": "0.9.1",
"resolved": "https://registry.npmjs.org/eol/-/eol-0.9.1.tgz",
"integrity": "sha512-Ds/TEoZjwggRoz/Q2O7SE3i4Jm66mqTDfmdHdq/7DKVk3bro9Q8h6WdXKdPqFLMoqxrDK5SVRzHVPOS6uuGtrg==",
"dev": true
},
"node_modules/eol-converter-cli": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/eol-converter-cli/-/eol-converter-cli-1.0.8.tgz",
"integrity": "sha512-+N4aWl2eAbcJBgcXiPBIkPuKUlpXGts5yPEYo0XnbaKHOqcnPuMOBUqXlwl+139V866iEXUziVOGDebR7z8Tzg==",
"dev": true,
"dependencies": {
"eol": "^0.9.1",
"glob": "^7.1.2"
},
"bin": {
"eolConverter": "src/index.js"
}
},
"node_modules/error-ex": { "node_modules/error-ex": {
"version": "1.3.2", "version": "1.3.2",
"resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz",
@ -8879,6 +8899,22 @@
"tapable": "^2.2.0" "tapable": "^2.2.0"
} }
}, },
"eol": {
"version": "0.9.1",
"resolved": "https://registry.npmjs.org/eol/-/eol-0.9.1.tgz",
"integrity": "sha512-Ds/TEoZjwggRoz/Q2O7SE3i4Jm66mqTDfmdHdq/7DKVk3bro9Q8h6WdXKdPqFLMoqxrDK5SVRzHVPOS6uuGtrg==",
"dev": true
},
"eol-converter-cli": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/eol-converter-cli/-/eol-converter-cli-1.0.8.tgz",
"integrity": "sha512-+N4aWl2eAbcJBgcXiPBIkPuKUlpXGts5yPEYo0XnbaKHOqcnPuMOBUqXlwl+139V866iEXUziVOGDebR7z8Tzg==",
"dev": true,
"requires": {
"eol": "^0.9.1",
"glob": "^7.1.2"
}
},
"error-ex": { "error-ex": {
"version": "1.3.2", "version": "1.3.2",
"resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz",

View file

@ -9,7 +9,7 @@
"format": "prettier --write **/*.ts", "format": "prettier --write **/*.ts",
"format-check": "prettier --check **/*.ts", "format-check": "prettier --check **/*.ts",
"lint": "eslint src/**/*.ts", "lint": "eslint src/**/*.ts",
"package": "ncc build --source-map --license licenses.txt", "package": "ncc build --source-map --license licenses.txt && eolConverter lf dist/*",
"test": "jest --ci --reporters=default --reporters=jest-junit", "test": "jest --ci --reporters=default --reporters=jest-junit",
"all": "npm run build && npm run format && npm run lint && npm run package && npm test", "all": "npm run build && npm run format && npm run lint && npm run package && npm test",
"dart-fixture": "cd \"reports/dart\" && dart test --file-reporter=\"json:../../__tests__/fixtures/dart-json.json\"", "dart-fixture": "cd \"reports/dart\" && dart test --file-reporter=\"json:../../__tests__/fixtures/dart-json.json\"",
@ -52,6 +52,7 @@
"@typescript-eslint/eslint-plugin": "^5.33.1", "@typescript-eslint/eslint-plugin": "^5.33.1",
"@typescript-eslint/parser": "^5.33.1", "@typescript-eslint/parser": "^5.33.1",
"@vercel/ncc": "^0.34.0", "@vercel/ncc": "^0.34.0",
"eol-converter-cli": "^1.0.8",
"eslint": "^8.22.0", "eslint": "^8.22.0",
"eslint-import-resolver-typescript": "^3.4.2", "eslint-import-resolver-typescript": "^3.4.2",
"eslint-plugin-github": "^4.1.2", "eslint-plugin-github": "^4.1.2",