forked from tc39/test262
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate linter workflow to GitHub Actions
This runs faster and allows for future improvements. I'm following a general principle of keeping code that isn't portable between CI providers inside the config file for the CI provider. So in this case we remove the Circle-CI-specific stuff from the file in tools/scripts/, and into .github/workflows/. We use an external action (tj-actions/changed-files) to gather the list of files to lint.
- Loading branch information
Showing
4 changed files
with
79 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Checks | ||
|
||
on: push | ||
# FIXME: | ||
# on: | ||
# push: | ||
# branches: | ||
# main | ||
|
||
jobs: | ||
lint: | ||
name: Lint tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.x' | ||
cache: pip | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r tools/lint/requirements.txt | ||
- name: Test the lint tool | ||
run: ./tools/lint/test/run.py | ||
|
||
- name: Lint all tests | ||
run: ./tools/scripts/ci_lint.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Required PR checks | ||
|
||
on: pull_request | ||
|
||
jobs: | ||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.x' | ||
cache: pip | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r tools/lint/requirements.txt | ||
- name: Test the lint tool | ||
run: ./tools/lint/test/run.py | ||
|
||
- name: Identify new or changed tests | ||
id: changed_tests | ||
uses: tj-actions/changed-files@v45 | ||
with: | ||
files: test/ | ||
separator: "\n" | ||
|
||
- name: Lint new or changed tests | ||
if: steps.changed_tests.outputs.any_changed == 'true' | ||
env: | ||
CHANGED: ${{ steps.changed_tests.outputs.all_changed_files }} | ||
run: | | ||
echo New or modified test files: | ||
echo "$CHANGED" | ||
./tools/scripts/ci_lint.sh $CHANGED |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,7 @@ | ||
#!/bin/bash | ||
|
||
if [ "$CIRCLE_PULL_REQUEST" != "" ]; then | ||
paths=$(git diff --diff-filter ACMR --name-only origin/main.. -- test/) | ||
|
||
if [ "$paths" == "" ]; then | ||
echo No test files added or modified. Exiting. | ||
exit 0 | ||
fi | ||
|
||
echo New or modified test files: | ||
echo "$paths" | ||
|
||
else | ||
paths="test/" | ||
if [ "$#" -eq 0 ]; then | ||
set -- test/ | ||
fi | ||
|
||
./tools/lint/lint.py --exceptions lint.exceptions $paths | ||
./tools/lint/lint.py --exceptions lint.exceptions $@ |