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

CI improvements #4307

Merged
merged 10 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
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
ptomato committed Nov 11, 2024
commit 0c84bdfde5fa4bb87b12275817275523d4d70aa1
13 changes: 2 additions & 11 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ execution_steps: &execution_steps
- run: hostPath=$HOME/.esvu/bin/$hostPath npm run ci

jobs:
"Test262: verify tools; build & lint tests":
"Test262: verify tools; build tests":
docker:
- image: cimg/python:3.7.4
working_directory: ~/test262
Expand All @@ -46,21 +46,12 @@ jobs:
- run:
name: "Install requirements for generation tool"
command: python -m pip install --user --requirement tools/generation/requirements.txt
- run:
name: "Install requirements for lint tool"
command: python -m pip install --user --requirement tools/lint/requirements.txt
- run:
name: "Test the generation tool"
command: ./tools/generation/test/run.py
- run:
name: "Test the lint tool"
command: ./tools/lint/test/run.py
- run:
name: "Build tests; check for new changes"
command: ./tools/scripts/ci_build.sh
- run:
name: "Lint tests"
command: ./tools/scripts/ci_lint.sh
"V8: New or modified tests execution":
docker:
- image: *node_image
Expand Down Expand Up @@ -134,7 +125,7 @@ workflows:
version: 2
Tools:
jobs:
- "Test262: verify tools; build & lint tests"
- "Test262: verify tools; build tests"
Tests execution:
jobs:
# - "ChakraCore: New or modified tests execution"
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/checks-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Checks

on: push

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
42 changes: 42 additions & 0 deletions .github/workflows/checks-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
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/

- 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:
for file in $CHANGED; do
echo $file
done
./tools/scripts/ci_lint.sh $CHANGED
17 changes: 3 additions & 14 deletions tools/scripts/ci_lint.sh
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 $@