Skip to content

Commit

Permalink
test on ci
Browse files Browse the repository at this point in the history
  • Loading branch information
martis42 committed Dec 16, 2024
1 parent 42193d9 commit a388d59
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 50 deletions.
99 changes: 50 additions & 49 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,65 +3,66 @@ 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/[email protected]

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/[email protected]
#
# 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
run: python examples/test.py
- 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
17 changes: 16 additions & 1 deletion examples/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 "
Expand All @@ -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 (
Expand Down

0 comments on commit a388d59

Please sign in to comment.