From 304010ef58a719bee785115eea5b8e861e0d5642 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 | 25 ++++++++-- 2 files changed, 70 insertions(+), 54 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..1be8ee2 100755 --- a/examples/test.py +++ b/examples/test.py @@ -104,17 +104,32 @@ class Result: success: bool -def make_cmd(example: Example, bazel: Path, legacy_workspace: bool) -> str: - cmd = str(bazel) + " build " +def make_cmd(example: Example, bazel: Path, legacy_workspace: bool) -> list[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 = [bazel, "build"] if legacy_workspace: - cmd += "--noenable_bzlmod " - cmd += example.build_cmd + cmd.append("--noenable_bzlmod") + cmd.extend(shlex.split(example.build_cmd)) return cmd 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 (