From a388d59f3d0977b6543623bd0cb585b2ae3134fd Mon Sep 17 00:00:00 2001 From: Martin Medler Date: Sun, 15 Dec 2024 19:18:09 +0100 Subject: [PATCH] test on ci --- .github/workflows/ci.yaml | 99 ++++++++++++++++++++------------------- examples/test.py | 17 ++++++- 2 files changed, 66 insertions(+), 50 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7bed665..3991fa7 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -3,33 +3,34 @@ name: CI on: [ pull_request ] jobs: - pre-commit: - runs-on: ubuntu-24.04 - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: "3.12" - - uses: pre-commit/action@v3.0.1 - - fast-tests: - runs-on: ubuntu-24.04 - needs: [ pre-commit ] - steps: - - uses: actions/checkout@v4 - - name: DWYU Unit tests - run: bazel test //... - - name: Aspect integration tests scripts unittests - run: ./scripts/test_aspect_tests_scripts.sh - - name: Build examples - run: ./scripts/build_examples.sh +# pre-commit: +# runs-on: ubuntu-24.04 +# steps: +# - uses: actions/checkout@v4 +# - uses: actions/setup-python@v5 +# with: +# python-version: "3.12" +# - uses: pre-commit/action@v3.0.1 +# +# fast-tests: +# runs-on: ubuntu-24.04 +# needs: [ pre-commit ] +# steps: +# - uses: actions/checkout@v4 +# - name: DWYU Unit tests +# run: bazel test //... +# - name: Aspect integration tests scripts unittests +# run: ./scripts/test_aspect_tests_scripts.sh +# - name: Build examples +# run: ./scripts/build_examples.sh integration-tests-examples: strategy: matrix: - os: [ ubuntu-24.04, macos-15, windows-2022 ] + #os: [ ubuntu-24.04, macos-15, windows-2022 ] + os: [ windows-2022 ] runs-on: ${{ matrix.os }} - needs: [ fast-tests ] + #needs: [ fast-tests ] steps: - uses: actions/checkout@v4 - name: Integration tests - Examples @@ -37,31 +38,31 @@ jobs: - name: Integration tests - Examples with legacy WORKSPACE setup run: python examples/test.py --legacy-workspace - integration-tests-aspect: - strategy: - matrix: - os: [ ubuntu-24.04, macos-15, windows-2022 ] - runs-on: ${{ matrix.os }} - needs: [ fast-tests, integration-tests-examples ] - steps: - - uses: actions/checkout@v4 - - name: Integration tests - Aspect - if: runner.os != 'Windows' - run: python test/aspect/execute_tests.py - - name: Integration tests - Aspect - if: runner.os == 'Windows' - run: python test/aspect/execute_tests.py -b 7.0.0 -p 3.8.18 +# integration-tests-aspect: +# strategy: +# matrix: +# os: [ ubuntu-24.04, macos-15, windows-2022 ] +# runs-on: ${{ matrix.os }} +# needs: [ fast-tests, integration-tests-examples ] +# steps: +# - uses: actions/checkout@v4 +# - name: Integration tests - Aspect +# if: runner.os != 'Windows' +# run: python test/aspect/execute_tests.py +# - name: Integration tests - Aspect +# if: runner.os == 'Windows' +# run: python test/aspect/execute_tests.py -b 7.0.0 -p 3.8.18 - integration-tests-apply-fixes: - strategy: - matrix: - os: [ ubuntu-24.04, macos-15, windows-2022 ] - runs-on: ${{ matrix.os }} - needs: [ fast-tests ] - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/prepare_buildozer - with: - version: '7.3.1' - - name: Integration tests - Applying fixes - run: python test/apply_fixes/execute_tests.py +# integration-tests-apply-fixes: +# strategy: +# matrix: +# os: [ ubuntu-24.04, macos-15, windows-2022 ] +# runs-on: ${{ matrix.os }} +# needs: [ fast-tests ] +# steps: +# - uses: actions/checkout@v4 +# - uses: ./.github/actions/prepare_buildozer +# with: +# version: '7.3.1' +# - name: Integration tests - Applying fixes +# run: python test/apply_fixes/execute_tests.py diff --git a/examples/test.py b/examples/test.py index 08dd1d8..1b95699 100755 --- a/examples/test.py +++ b/examples/test.py @@ -105,6 +105,21 @@ class Result: def make_cmd(example: Example, bazel: Path, legacy_workspace: bool) -> str: + logging.info("-------------------") + logging.info(bazel) + logging.info(bazel.is_file()) + logging.info(type(bazel)) + logging.info(str(bazel)) + logging.info("-------------------") + subprocess.run([bazel, "--version"], shell=False, check=False) + logging.info("++++++") + subprocess.run([str(bazel), "--version"], shell=False, check=False) + logging.info("++++++") + subprocess.run([bazel, "build", "//..."], shell=False, check=False) + logging.info("++++++") + subprocess.run([bazel, "build", "--aspects=//:aspect.bzl%dwyu", "--output_groups=dwyu", "//basic_usage:correct_dependencies"], shell=False, check=False) + logging.info("-------------------") + cmd = str(bazel) + " build " if legacy_workspace: cmd += "--noenable_bzlmod " @@ -114,7 +129,7 @@ def make_cmd(example: Example, bazel: Path, legacy_workspace: bool) -> str: def execute_example(example: Example, bazel: Path, legacy_workspace: bool) -> Result: cmd = make_cmd(example=example, bazel=bazel, legacy_workspace=legacy_workspace) - logging.info(f"\n##\n## Executing: {cmd}\n##\n") + logging.info(f"\n##\n## Executing: '{cmd}'\n##\n") process = subprocess.run(shlex.split(cmd), check=False) if (process.returncode == 0 and example.expected_success) or (