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 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
30 changes: 0 additions & 30 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,33 +37,6 @@ execution_steps: &execution_steps
- run: hostPath=$HOME/.esvu/bin/$hostPath npm run ci

jobs:
"Test262: verify tools; build & lint tests":
docker:
- image: cimg/python:3.7.4
working_directory: ~/test262
steps:
- checkout
- 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
# - run:
# name: "Run deploy"
# command: ./tools/scripts/deploy.sh
"V8: New or modified tests execution":
docker:
- image: *node_image
Expand Down Expand Up @@ -135,9 +108,6 @@ jobs:
<<: [*execution_steps]
workflows:
version: 2
Tools:
jobs:
- "Test262: verify tools; build & lint tests"
Tests execution:
jobs:
# - "ChakraCore: New or modified tests execution"
Expand Down
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[{README.md,package.json,.travis.yml,*.sh,*.js,*.case,*.template}]
[{README.md,package.json,*.yml,*.sh,*.js,*.case,*.template}]
indent_style = space
indent_size = 2

Expand Down
87 changes: 87 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Checks

on:
- push
- pull_request

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: Lint all tests
if: github.event_name == 'push'
run: ./tools/lint/lint.py test/

- name: Identify new or changed tests
id: changed_tests
if: github.event_name == 'pull_request'
uses: tj-actions/changed-files@v45
with:
files: test/

- name: Lint new or changed tests
if: |
github.event_name == 'pull_request' &&
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/lint/lint.py $CHANGED 2> >(tee errors.out >&2)

- name: Create annotations in the PR
if: failure() && github.event_name == 'pull_request'
run: |
awk -F': ' <errors.out \
"{ sub(\"$(pwd)/\", \"\"); printf \"::error file=%s,line=1::%s\n\", \$1, \$2 }"


build:
name: Build generated 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 for generation tool
run: |
python -m pip install --upgrade pip
pip install -r tools/generation/requirements.txt

- name: Build tests
run: |
./make.py clean >/dev/null
./make.py

- name: Verify changes
uses: tj-actions/verify-changed-files@v20
with:
fail-if-changed: true
fail-message: |
New changes were found after re-generating the tests.
Please read the documentation on procedurally generated tests
https://github.com/tc39/test262/blob/HEAD/CONTRIBUTING.md#procedurally-generated-tests
22 changes: 14 additions & 8 deletions .github/workflows/esmeta-test262.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,20 @@ jobs:
- name: build esmeta
working-directory: ${{ env.ESMETA_HOME }}
run: sbt assembly

- name: Identify new or changed tests
id: changed_tests
uses: tj-actions/changed-files@v45
with:
files: test/

- name: run test262
if: steps.changed_tests.outputs.any_changed == 'true'
env:
CHANGED: ${{ steps.changed_tests.outputs.all_changed_files }}
run: |
git fetch origin main
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"
"${ESMETA_HOME}"/bin/esmeta test262-test -status -test262dir=$(pwd) $paths
for file in $CHANGED; do
echo $file
done
"${ESMETA_HOME}"/bin/esmeta test262-test -status -test262dir=$(pwd) $CHANGED
52 changes: 52 additions & 0 deletions .github/workflows/test-tools.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Test tools

on:
push:
files:
- 'tools/**'
pull_request:
ptomato marked this conversation as resolved.
Show resolved Hide resolved
files:
- 'tools/**'

jobs:
lint:
name: Test the lint tool
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

generation:
name: Test the generation tool
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 for generation tool
run: |
python -m pip install --upgrade pip
pip install -r tools/generation/requirements.txt

- name: Test the generation tool
run: ./tools/generation/test/run.py
28 changes: 0 additions & 28 deletions make.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

OUT_DIR = os.environ.get('OUT_DIR') or 'test'
SRC_DIR = os.environ.get('SRC_DIR') or 'src'
UPSTREAM = os.environ.get('UPSTREAM') or 'git@github.com:tc39/test262.git'
MAINTAINER = os.environ.get('MAINTAINER') or 'test262@ecma-international.org'

def shell(*args):
sp = subprocess.Popen(list(args), stdout=subprocess.PIPE, universal_newlines=True)
Expand Down Expand Up @@ -50,32 +48,6 @@ def build():
def clean():
shell(sys.executable, 'tools/generation/generator.py', 'clean', OUT_DIR)

@target('clean', 'build')
def deploy():
shell('git', 'add', '--all', OUT_DIR)
shell('git', 'commit', '--message', '"Re-build from source"')
shell('git', 'push', UPSTREAM, 'main')
shell('git', 'checkout', '-')

# Generate a deploy key for use in a continuous integration system, allowing
# for automated deployment in response to merge events.
@target()
def github_deploy_key():
shell('ssh-keygen',
'-t', 'rsa',
'-b', '4096',
'-C', MAINTAINER,
'-f', 'github-deploy-key')

# Encrypt the deploy key so that it may be included in the repository (to be
# decrypted by the continuous integration server during automated deployment)
# This requires the "travis" Ruby gem
# Source: https://docs.travis-ci.com/user/encrypting-files/
@target('github_deploy_key')
def github_deploy_key_enc():
shell('travis', 'login')
shell('travis', 'encrypt-file', 'github-deploy-key')

if len(sys.argv) == 1:
targets['build']()

Expand Down
6 changes: 5 additions & 1 deletion tools/lint/lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@ def lint(file_names, features):
if args.exceptions:
exceptions = lib.exceptions.parse(args.exceptions)
else:
exceptions = dict()
try:
with open('lint.exceptions', 'r') as default_exceptions:
exceptions = lib.exceptions.parse(default_exceptions)
except FileNotFoundError:
exceptions = dict()

files = [path for _path in args.path for path in collect_files(_path)]
file_count = len(files)
Expand Down
17 changes: 0 additions & 17 deletions tools/scripts/ci_build.sh

This file was deleted.

18 changes: 0 additions & 18 deletions tools/scripts/ci_lint.sh

This file was deleted.

24 changes: 0 additions & 24 deletions tools/scripts/deploy.sh

This file was deleted.

Loading