Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework how we extract lint failures into GitHub annotations #1961

Merged
merged 1 commit into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/problem-matchers/eslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"problemMatcher": [
{
"owner": "eslint-stylish",
"pattern": [
{
"regexp": "^([^\\s].*)$",
"file": 1
},
{
"regexp": "^\\s+(\\d+):(\\d+)\\s+(error|warning|info)\\s+(.*)\\s\\s+(.*)$",
"line": 1,
"column": 2,
"severity": 3,
"message": 4,
"code": 5,
"loop": true
}
]
}
]
}
21 changes: 21 additions & 0 deletions .github/problem-matchers/stylelint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"problemMatcher": [
{
"owner": "stylelint",
"pattern": [
{
"regexp": "^([^\\s].*)$",
"file": 1
},
{
"regexp": "^\\s+(?:(?:\\u001b\\[\\d+m)*(\\d+):(\\d+)(?:\\u001b\\[\\d+m)*)?\\s+(?:\\u001b\\[\\d+m)*(?:✖|×)(?:\\u001b\\[\\d+m)*\\s+(.*)\\s{2,}(?:\\u001b\\[\\d+m)*([^\\u001b]*)(?:\\u001b\\[\\d+m)*$",
"line": 1,
"column": 2,
"message": 3,
"code": 4,
"loop": true
}
]
}
]
}
18 changes: 18 additions & 0 deletions .github/problem-matchers/tsc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"problemMatcher": [
{
"owner": "tsc",
"pattern": [
{
"regexp": "^([^\\s].*)[\\(:](\\d+)[,:](\\d+)(?:\\):\\s+|\\s+-\\s+)(error|warning|info)\\s+TS(\\d+)\\s*:\\s*(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"code": 5,
"message": 6
}
]
}
]
}
9 changes: 6 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,14 @@ jobs:
cache-to: type=gha,mode=max # mode=max means cache intermediate images
build-args: |
CI=true
GITHUB_ACTIONS=true
- name: Enable problem matchers
run: |
echo "::add-matcher::${{ github.workspace }}/.github/problem-matchers/tsc.json"
echo "::add-matcher::${{ github.workspace }}/.github/problem-matchers/eslint.json"
echo "::add-matcher::${{ github.workspace }}/.github/problem-matchers/stylelint.json"
- name: Run tests
run: |
docker run -e PATH_PREFIX=${{ github.workspace }} -e CI=true -e GITHUB_ACTIONS=true --rm ${{ env.TEST_TAG }}
docker run -e PATH_PREFIX=${{ github.workspace }} -e CI=true --rm ${{ env.TEST_TAG }}
- name: Build production Docker image
uses: docker/build-push-action@v5
with:
Expand All @@ -65,4 +69,3 @@ jobs:
cache-to: type=gha,mode=max # mode=max means cache intermediate images
build-args: |
CI=true
GITHUB_ACTIONS=true
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ FROM buildenv as meteorenv
WORKDIR /app

ARG CI=true
ARG GITHUB_ACTIONS=

# Install Meteor
COPY .meteor/release /app/.meteor/release
Expand Down Expand Up @@ -97,7 +96,7 @@ COPY <<'EOF' /test.sh
set -eux
set -o pipefail
export METEOR_ALLOW_SUPERUSER=1
meteor npm run lint | sed -e "s,/app/,\${PATH_PREFIX:+\${PATH_PREFIX}/},g"
meteor npm run lint | sed -e "s,/app/,${PATH_PREFIX:+${PATH_PREFIX}/},g"
meteor npm run test
EOF
CMD ["/bin/bash", "/test.sh"]
Expand Down
99 changes: 0 additions & 99 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
"url": "https://github.com/deathandmayhem/jolly-roger"
},
"scripts": {
"lint:types": "tsc --noEmit",
"lint:js": "eslint --format gha --max-warnings 0 --ext js,jsx,ts,tsx .",
"lint:types": "tsc",
"lint:js": "eslint --max-warnings 0 --ext js,jsx,ts,tsx .",
"lint:css": "stylelint '**/*.scss' '**/*.tsx'",
"lint:format": "prettier --check .",
"lint": "meteor lint && npm-run-all --parallel lint:*",
"lint": "meteor lint && npm-run-all --continue-on-error --parallel lint:*",
"test": "TEST_BROWSER_DRIVER=puppeteer meteor test --full-app --once --driver-package meteortesting:mocha",
"prepare": "npm explore eslint-plugin-jolly-roger -- npm run build",
"postshrinkwrap": "lockfix"
Expand Down Expand Up @@ -108,7 +108,6 @@
"eslint": "^8.56.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-prettier": "^9.1.0",
"eslint-formatter-gha": "^1.4.3",
"eslint-import-resolver-meteor": "^0.4.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-deprecation": "^1.5.0",
Expand Down