From 790b6cd750aba9a50a26d63e77cdd453762874d9 Mon Sep 17 00:00:00 2001 From: joncrall Date: Mon, 12 Feb 2024 14:01:52 -0500 Subject: [PATCH] Update cibuildwheel action Revert to old github artifact actions wip wip wip wip --- .github/workflows/tests.yml | 22 +++++++++++----------- run_tests.py | 26 ++++++++++++++++++++------ 2 files changed, 31 insertions(+), 17 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index de7dad7c..da7b1aa5 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -97,7 +97,7 @@ jobs: echo "MOD_DPATH = $MOD_DPATH" python -m pytest --verbose --cov={self.mod_name} $MOD_DPATH ../tests cd .. - - uses: actions/upload-artifact@v4.3.1 + - uses: actions/upload-artifact@v3.1.3 name: Upload sdist artifact with: name: sdist_wheels @@ -138,7 +138,7 @@ jobs: with: platforms: all - name: Build binary wheels - uses: pypa/cibuildwheel@v2.16.2 + uses: pypa/cibuildwheel@v2.16.5 with: output-dir: wheelhouse config-file: pyproject.toml @@ -173,7 +173,7 @@ jobs: with: file: ./coverage.xml token: ${{ secrets.CODECOV_TOKEN }} - - uses: actions/upload-artifact@v4.3.1 + - uses: actions/upload-artifact@v3.1.3 name: Upload wheels artifact with: name: wheels @@ -325,7 +325,7 @@ jobs: uses: actions/setup-python@v5.0.0 with: python-version: ${{ matrix.python-version }} - - uses: actions/download-artifact@v4.1.2 + - uses: actions/download-artifact@v2.1.1 name: Download wheels with: name: wheels @@ -405,12 +405,12 @@ jobs: steps: - name: Checkout source uses: actions/checkout@v4.1.1 - - uses: actions/download-artifact@v4.1.2 + - uses: actions/download-artifact@v2.1.1 name: Download wheels with: name: wheels path: wheelhouse - - uses: actions/download-artifact@v4.1.2 + - uses: actions/download-artifact@v2.1.1 name: Download sdist with: name: sdist_wheels @@ -459,7 +459,7 @@ jobs: ots stamp wheelhouse/*.whl wheelhouse/*.tar.gz wheelhouse/*.asc ls -la wheelhouse twine upload --username __token__ --password "$TWINE_PASSWORD" --repository-url "$TWINE_REPOSITORY_URL" wheelhouse/*.whl wheelhouse/*.tar.gz --skip-existing --verbose || { echo "failed to twine upload" ; exit 1; } - - uses: actions/upload-artifact@v4.3.1 + - uses: actions/upload-artifact@v3.1.3 name: Upload deploy artifacts with: name: deploy_artifacts @@ -480,12 +480,12 @@ jobs: steps: - name: Checkout source uses: actions/checkout@v4.1.1 - - uses: actions/download-artifact@v4.1.2 + - uses: actions/download-artifact@v2.1.1 name: Download wheels with: name: wheels path: wheelhouse - - uses: actions/download-artifact@v4.1.2 + - uses: actions/download-artifact@v2.1.1 name: Download sdist with: name: sdist_wheels @@ -534,7 +534,7 @@ jobs: ots stamp wheelhouse/*.whl wheelhouse/*.tar.gz wheelhouse/*.asc ls -la wheelhouse twine upload --username __token__ --password "$TWINE_PASSWORD" --repository-url "$TWINE_REPOSITORY_URL" wheelhouse/*.whl wheelhouse/*.tar.gz --skip-existing --verbose || { echo "failed to twine upload" ; exit 1; } - - uses: actions/upload-artifact@v4.3.1 + - uses: actions/upload-artifact@v3.1.3 name: Upload deploy artifacts with: name: deploy_artifacts @@ -555,7 +555,7 @@ jobs: steps: - name: Checkout source uses: actions/checkout@v4.1.1 - - uses: actions/download-artifact@v4.1.2 + - uses: actions/download-artifact@v2.1.1 name: Download artifacts with: name: deploy_artifacts diff --git a/run_tests.py b/run_tests.py index cdd835aa..c3f3dab8 100755 --- a/run_tests.py +++ b/run_tests.py @@ -109,25 +109,39 @@ def copy_coverage_cibuildwheel_docker(runner_project_dir): print(f'No installed version of {package_name} found') try: - print('Changing dirs to test_dir={!r}'.format(test_dir)) - os.chdir(test_dir) + # print('Changing dirs to test_dir={!r}'.format(test_dir)) + # os.chdir(test_dir) + + import pathlib + modpath_contents = list(pathlib.Path(modpath).glob('*')) + print(f'modpath_contents = {ub.urepr(modpath_contents, nl=1)}') + testdir_contents = list(pathlib.Path(test_dir).glob('*')) + print(f'testdir_contents = {ub.urepr(testdir_contents, nl=1)}') + + pyproject_fpath = join(repo_dir, 'pyproject.toml') pytest_args = [ - '--cov-config', '../pyproject.toml', + '--cov-config', pyproject_fpath, '--cov-report', 'html', '--cov-report', 'term', '--cov-report', 'xml', '--cov=' + package_name, - modpath, '.' + modpath, test_dir ] if is_cibuildwheel(): pytest_args.append('--cov-append') pytest_args = pytest_args + sys.argv[1:] - sys.exit(pytest.main(pytest_args)) + print(f'Exec pytest with args={pytest_args}') + ret = pytest.main(pytest_args) + print(f'pytest returned ret={ret}') + except Exception as ex: + print(f'pytest exception: {ex}') + ret = 1 finally: - os.chdir(cwd) + # os.chdir(cwd) if is_cibuildwheel(): # for CIBW under linux copy_coverage_cibuildwheel_docker(f'/home/runner/work/{package_name}/{package_name}') print('Restoring cwd = {!r}'.format(cwd)) + sys.exit(ret)