Remove encrypted in-repo secrets #1246
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This workflow is autogenerated by xcookie. | ||
| # File kind: tests | ||
| # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | ||
| # Based on ~/code/xcookie/xcookie/builders/github_actions.py | ||
| # See: https://github.com/Erotemic/xcookie | ||
| name: BinPyCI | ||
| on: | ||
| push: | ||
| pull_request: | ||
| branches: [ main ] | ||
| jobs: | ||
| lint_job: | ||
| ## | ||
| # Run quick linting and typing checks. | ||
| # To disable all linting add "linter=false" to the xcookie config. | ||
| # To disable type checks add "notypes" to the xcookie tags. | ||
| ## | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout source | ||
| uses: actions/[email protected] | ||
| - name: Set up Python 3.13 for linting | ||
| uses: actions/[email protected] | ||
| with: | ||
| python-version: '3.13' | ||
| - name: Install dependencies | ||
| run: |- | ||
| python -m pip install pip uv -U | ||
| python -m uv pip install flake8 | ||
| - name: Lint with flake8 | ||
| run: |- | ||
| # stop the build if there are Python syntax errors or undefined names | ||
| flake8 ./line_profiler --count --select=E9,F63,F7,F82 --show-source --statistics | ||
| - name: Typecheck | ||
| run: |- | ||
| python -m pip install mypy | ||
| pip install -r requirements/runtime.txt | ||
| mypy ./line_profiler | ||
| python -m pip install ty | ||
| pip install -r requirements/runtime.txt | ||
| ty check ./line_profiler | ||
| build_and_test_sdist: | ||
| ## | ||
| # Build the binary package from source and test it in the same | ||
| # environment. | ||
| ## | ||
| name: Build sdist | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout source | ||
| uses: actions/[email protected] | ||
| - name: Set up Python 3.13 | ||
| uses: actions/[email protected] | ||
| with: | ||
| python-version: '3.13' | ||
| - name: Upgrade pip | ||
| run: |- | ||
| python -m pip install pip uv -U | ||
| python -m pip install --prefer-binary -r requirements/tests.txt | ||
| python -m pip install --prefer-binary -r requirements/runtime.txt | ||
| - name: Build sdist | ||
| shell: bash | ||
| run: |- | ||
| python -m pip install pip uv -U | ||
| python -m uv pip install setuptools>=0.8 wheel build twine | ||
| python -m build --sdist --outdir wheelhouse | ||
| python -m twine check ./wheelhouse/line_profiler*.tar.gz | ||
| - name: Install sdist | ||
| run: |- | ||
| ls -al wheelhouse | ||
| python -m pip install --prefer-binary wheelhouse/line_profiler*.tar.gz -v | ||
| - name: Test minimal loose sdist | ||
| env: | ||
| COVERAGE_CORE: ctrace | ||
| run: |- | ||
| pwd | ||
| ls -al | ||
| # Run in a sandboxed directory | ||
| WORKSPACE_DNAME="testsrcdir_minimal_${CI_PYTHON_VERSION}_${GITHUB_RUN_ID}_${RUNNER_OS}" | ||
| mkdir -p $WORKSPACE_DNAME | ||
| cd $WORKSPACE_DNAME | ||
| # Run the tests | ||
| # Get path to installed package | ||
| MOD_DPATH=$(python -c "import line_profiler, os; print(os.path.dirname(line_profiler.__file__))") | ||
| echo "MOD_DPATH = $MOD_DPATH" | ||
| python -m pytest --verbose --cov=line_profiler $MOD_DPATH ../tests | ||
| cd .. | ||
| - name: Test full loose sdist | ||
| env: | ||
| COVERAGE_CORE: ctrace | ||
| run: |- | ||
| pwd | ||
| ls -al | ||
| true | ||
| # Run in a sandboxed directory | ||
| WORKSPACE_DNAME="testsrcdir_full_${CI_PYTHON_VERSION}_${GITHUB_RUN_ID}_${RUNNER_OS}" | ||
| mkdir -p $WORKSPACE_DNAME | ||
| cd $WORKSPACE_DNAME | ||
| # Run the tests | ||
| # Get path to installed package | ||
| MOD_DPATH=$(python -c "import line_profiler, os; print(os.path.dirname(line_profiler.__file__))") | ||
| echo "MOD_DPATH = $MOD_DPATH" | ||
| python -m pytest --verbose --cov=line_profiler $MOD_DPATH ../tests | ||
| cd .. | ||
| - uses: actions/[email protected] | ||
| name: Upload sdist artifact | ||
| with: | ||
| name: sdist_wheels | ||
| path: ./wheelhouse/line_profiler*.tar.gz | ||
| build_binpy_wheels: | ||
| ## | ||
| # Build the binary wheels. Note: even though cibuildwheel will test | ||
| # them internally here, we will test them independently later in the | ||
| # test_binpy_wheels step. | ||
| ## | ||
| name: ${{ matrix.os }}, arch=${{ matrix.arch }} | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| # Normally, xcookie generates explicit lists of platforms to build / test | ||
| # on, but in this case cibuildwheel does that for us, so we need to just | ||
| # set the environment variables for cibuildwheel. These are parsed out of | ||
| # the standard [tool.cibuildwheel] section in pyproject.toml and set | ||
| # explicitly here. | ||
| os: | ||
| - ubuntu-latest | ||
| - macOS-latest | ||
| - windows-latest | ||
| - ubuntu-24.04-arm | ||
| cibw_skip: | ||
| - '*-win32 cp3{10}-win_arm64 cp313-musllinux_i686' | ||
| arch: | ||
| - auto | ||
| steps: | ||
| - name: Checkout source | ||
| uses: actions/[email protected] | ||
| - name: Enable MSVC 64bit | ||
| uses: ilammy/msvc-dev-cmd@v1 | ||
| if: ${{ startsWith(matrix.os, 'windows-') }} && ${{ contains(matrix.cibw_skip, '*-win32') }} | ||
|
Check warning on line 143 in .github/workflows/tests.yml
|
||
| with: | ||
| arch: ${{ contains(matrix.os, 'arm') && 'arm64' || 'x64' }} | ||
| - name: Set up QEMU | ||
| uses: docker/[email protected] | ||
| if: runner.os == 'Linux' && matrix.arch != 'auto' | ||
| with: | ||
| platforms: all | ||
| - name: Build binary wheels | ||
| uses: pypa/[email protected] | ||
| with: | ||
| output-dir: wheelhouse | ||
| config-file: pyproject.toml | ||
| env: | ||
| CIBW_SKIP: ${{ matrix.cibw_skip }} | ||
| CIBW_TEST_SKIP: '*-win_arm64' | ||
| CIBW_ARCHS_LINUX: ${{ matrix.arch }} | ||
| PYTHONUTF8: '1' | ||
| VSCMD_ARG_TGT_ARCH: '' | ||
| - name: Show built files | ||
| shell: bash | ||
| run: ls -la wheelhouse | ||
| - name: Set up Python 3.13 to combine coverage | ||
| uses: actions/[email protected] | ||
| if: runner.os == 'Linux' | ||
| with: | ||
| python-version: '3.13' | ||
| - name: Combine coverage Linux | ||
| if: runner.os == 'Linux' | ||
| run: |- | ||
| echo '############ PWD' | ||
| pwd | ||
| cp .wheelhouse/.coverage* . || true | ||
| ls -al | ||
| uv pip install coverage[toml] | pip install coverage[toml] | ||
| echo '############ combine' | ||
| coverage combine . || true | ||
| echo '############ XML' | ||
| coverage xml -o ./coverage.xml || true | ||
| echo '### The cwd should now have a coverage.xml' | ||
| ls -altr | ||
| pwd | ||
| - uses: codecov/[email protected] | ||
| name: Codecov Upload | ||
| env: | ||
| HAVE_CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN != '' }} | ||
| # Only upload coverage if we have the token | ||
| if: ${{ env.HAVE_PERSONAL_TOKEN == 'true' }} | ||
| with: | ||
| file: ./coverage.xml | ||
| token: ${{ secrets.CODECOV_TOKEN }} | ||
| - uses: codecov/[email protected] | ||
| name: Codecov Upload | ||
| with: | ||
| file: ./coverage.xml | ||
| token: ${{ secrets.CODECOV_TOKEN }} | ||
| - uses: actions/[email protected] | ||
| name: Upload wheels artifact | ||
| with: | ||
| name: wheels-${{ matrix.os }}-${{ matrix.arch }} | ||
| path: ./wheelhouse/line_profiler*.whl | ||
| test_binpy_wheels: | ||
| ## | ||
| # Download the previously built binary wheels from the | ||
| # build_binpy_wheels step, and test them in an independent | ||
| # environment. | ||
| ## | ||
| name: ${{ matrix.python-version }} on ${{ matrix.os }}, arch=${{ matrix.arch }} with ${{ matrix.install-extras }} | ||
| if: "! startsWith(github.event.ref, 'refs/heads/release')" | ||
| runs-on: ${{ matrix.os }} | ||
| needs: | ||
| - build_binpy_wheels | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| # Xcookie generates an explicit list of environments that will be used | ||
| # for testing instead of using the more concise matrix notation. | ||
| include: | ||
| - python-version: '3.10' | ||
| install-extras: tests-strict,runtime-strict | ||
| os: ubuntu-latest | ||
| arch: auto | ||
| - python-version: '3.10' | ||
| install-extras: tests-strict,runtime-strict | ||
| os: macOS-latest | ||
| arch: auto | ||
| - python-version: '3.10' | ||
| install-extras: tests-strict,runtime-strict | ||
| os: windows-latest | ||
| arch: auto | ||
| - python-version: '3.10' | ||
| install-extras: tests-strict,runtime-strict | ||
| os: ubuntu-24.04-arm | ||
| arch: auto | ||
| - python-version: '3.13' | ||
| install-extras: tests-strict,runtime-strict,optional-strict | ||
| os: ubuntu-latest | ||
| arch: auto | ||
| - python-version: '3.13' | ||
| install-extras: tests-strict,runtime-strict,optional-strict | ||
| os: macOS-latest | ||
| arch: auto | ||
| - python-version: '3.13' | ||
| install-extras: tests-strict,runtime-strict,optional-strict | ||
| os: windows-latest | ||
| arch: auto | ||
| - python-version: '3.13' | ||
| install-extras: tests-strict,runtime-strict,optional-strict | ||
| os: ubuntu-24.04-arm | ||
| arch: auto | ||
| - python-version: '3.13' | ||
| install-extras: tests-strict,runtime-strict,optional-strict | ||
| os: windows-11-arm | ||
| arch: auto | ||
| - python-version: '3.13' | ||
| install-extras: tests | ||
| os: macOS-latest | ||
| arch: auto | ||
| - python-version: '3.13' | ||
| install-extras: tests | ||
| os: windows-latest | ||
| arch: auto | ||
| - python-version: '3.13' | ||
| install-extras: tests | ||
| os: ubuntu-24.04-arm | ||
| arch: auto | ||
| - python-version: '3.13' | ||
| install-extras: tests | ||
| os: windows-11-arm | ||
| arch: auto | ||
| - python-version: '3.10' | ||
| install-extras: tests,optional | ||
| os: ubuntu-latest | ||
| arch: auto | ||
| - python-version: '3.11' | ||
| install-extras: tests,optional | ||
| os: ubuntu-latest | ||
| arch: auto | ||
| - python-version: '3.12' | ||
| install-extras: tests,optional | ||
| os: ubuntu-latest | ||
| arch: auto | ||
| - python-version: '3.13' | ||
| install-extras: tests,optional | ||
| os: ubuntu-latest | ||
| arch: auto | ||
| - python-version: '3.14' | ||
| install-extras: tests,optional | ||
| os: ubuntu-latest | ||
| arch: auto | ||
| - python-version: '3.10' | ||
| install-extras: tests,optional | ||
| os: macOS-latest | ||
| arch: auto | ||
| - python-version: '3.11' | ||
| install-extras: tests,optional | ||
| os: macOS-latest | ||
| arch: auto | ||
| - python-version: '3.12' | ||
| install-extras: tests,optional | ||
| os: macOS-latest | ||
| arch: auto | ||
| - python-version: '3.13' | ||
| install-extras: tests,optional | ||
| os: macOS-latest | ||
| arch: auto | ||
| - python-version: '3.14' | ||
| install-extras: tests,optional | ||
| os: macOS-latest | ||
| arch: auto | ||
| - python-version: '3.10' | ||
| install-extras: tests,optional | ||
| os: windows-latest | ||
| arch: auto | ||
| - python-version: '3.11' | ||
| install-extras: tests,optional | ||
| os: windows-latest | ||
| arch: auto | ||
| - python-version: '3.12' | ||
| install-extras: tests,optional | ||
| os: windows-latest | ||
| arch: auto | ||
| - python-version: '3.13' | ||
| install-extras: tests,optional | ||
| os: windows-latest | ||
| arch: auto | ||
| - python-version: '3.14' | ||
| install-extras: tests,optional | ||
| os: windows-latest | ||
| arch: auto | ||
| - python-version: '3.10' | ||
| install-extras: tests,optional | ||
| os: ubuntu-24.04-arm | ||
| arch: auto | ||
| - python-version: '3.11' | ||
| install-extras: tests,optional | ||
| os: ubuntu-24.04-arm | ||
| arch: auto | ||
| - python-version: '3.12' | ||
| install-extras: tests,optional | ||
| os: ubuntu-24.04-arm | ||
| arch: auto | ||
| - python-version: '3.13' | ||
| install-extras: tests,optional | ||
| os: ubuntu-24.04-arm | ||
| arch: auto | ||
| - python-version: '3.14' | ||
| install-extras: tests,optional | ||
| os: ubuntu-24.04-arm | ||
| arch: auto | ||
| - python-version: '3.11' | ||
| install-extras: tests,optional | ||
| os: windows-11-arm | ||
| arch: auto | ||
| - python-version: '3.12' | ||
| install-extras: tests,optional | ||
| os: windows-11-arm | ||
| arch: auto | ||
| - python-version: '3.13' | ||
| install-extras: tests,optional | ||
| os: windows-11-arm | ||
| arch: auto | ||
| - python-version: '3.14' | ||
| install-extras: tests,optional | ||
| os: windows-11-arm | ||
| arch: auto | ||
| steps: | ||
| - name: Checkout source | ||
| uses: actions/[email protected] | ||
| - name: Enable MSVC 64bit | ||
| uses: ilammy/msvc-dev-cmd@v1 | ||
| if: ${{ startsWith(matrix.os, 'windows-') }} | ||
| with: | ||
| arch: ${{ contains(matrix.os, 'arm') && 'arm64' || 'x64' }} | ||
| - name: Set up QEMU | ||
| uses: docker/[email protected] | ||
| if: runner.os == 'Linux' && matrix.arch != 'auto' | ||
| with: | ||
| platforms: all | ||
| - name: Setup Python | ||
| uses: actions/[email protected] | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
| - uses: actions/[email protected] | ||
| name: Download wheels | ||
| with: | ||
| pattern: wheels-* | ||
| merge-multiple: true | ||
| path: wheelhouse | ||
| - name: Install wheel ${{ matrix.install-extras }} | ||
| shell: bash | ||
| env: | ||
| INSTALL_EXTRAS: ${{ matrix.install-extras }} | ||
| run: |- | ||
| echo "Finding the path to the wheel" | ||
| ls wheelhouse || echo "wheelhouse does not exist" | ||
| echo "Installing helpers: update pip" | ||
| python -m pip install pip uv -U | ||
| echo "Installing helpers: setuptools" | ||
| python -m uv pip install setuptools>=0.8 setuptools_scm wheel build -U | ||
| echo "Installing helpers: tomli and pkginfo" | ||
| python -m uv pip install tomli pkginfo packaging | ||
| export WHEEL_FPATH=$(python -c "if 1: | ||
| import pathlib | ||
| from packaging import tags | ||
| from packaging.utils import parse_wheel_filename | ||
| dist_dpath = pathlib.Path('wheelhouse') | ||
| wheels = sorted(dist_dpath.glob('line_profiler*.whl')) | ||
| if wheels: | ||
| sys_tags = set(tags.sys_tags()) | ||
| matching = [] | ||
| for w in wheels: | ||
| try: | ||
| _, _, _, wheel_tags = parse_wheel_filename(w.name) | ||
| except Exception: | ||
| continue | ||
| if any(t in sys_tags for t in wheel_tags): | ||
| matching.append(w) | ||
| fpath = sorted(matching or wheels)[-1] | ||
| else: | ||
| sdists = sorted(dist_dpath.glob('line_profiler*.tar.gz')) | ||
| if not sdists: | ||
| raise SystemExit('No wheel artifacts found in wheelhouse') | ||
| fpath = sdists[-1] | ||
| print(str(fpath).replace(chr(92), chr(47))) | ||
| ") | ||
| echo "WHEEL_FPATH=$WHEEL_FPATH" | ||
| echo "INSTALL_EXTRAS=$INSTALL_EXTRAS" | ||
| echo "UV_RESOLUTION=$UV_RESOLUTION" | ||
| python -m pip install --prefer-binary "${WHEEL_FPATH}[${INSTALL_EXTRAS}]" | ||
| echo "Install finished." | ||
| - name: Test wheel ${{ matrix.install-extras }} | ||
| shell: bash | ||
| env: | ||
| CI_PYTHON_VERSION: py${{ matrix.python-version }} | ||
| COVERAGE_CORE: ctrace | ||
| run: |- | ||
| echo "Creating test sandbox directory" | ||
| export WORKSPACE_DNAME="testdir_${CI_PYTHON_VERSION}_${GITHUB_RUN_ID}_${RUNNER_OS}" | ||
| echo "WORKSPACE_DNAME=$WORKSPACE_DNAME" | ||
| mkdir -p $WORKSPACE_DNAME | ||
| echo "cd-ing into the workspace" | ||
| cd $WORKSPACE_DNAME | ||
| pwd | ||
| ls -altr | ||
| # Get the path to the installed package and run the tests | ||
| export MOD_DPATH=$(python -c "import line_profiler, os; print(os.path.dirname(line_profiler.__file__))") | ||
| export MOD_NAME=line_profiler | ||
| echo " | ||
| --- | ||
| MOD_DPATH = $MOD_DPATH | ||
| --- | ||
| running the pytest command inside the workspace | ||
| --- | ||
| " | ||
| python -m pytest --verbose -p pytester -p no:doctest --xdoctest --cov-config ../pyproject.toml --cov-report term --durations=100 --cov="$MOD_NAME" "$MOD_DPATH" ../tests | ||
| echo "pytest command finished, moving the coverage file to the repo root" | ||
| ls -al | ||
| # Move coverage file to a new name | ||
| mv .coverage "../.coverage.$WORKSPACE_DNAME" | ||
| echo "changing directory back to th repo root" | ||
| cd .. | ||
| ls -al | ||
| - name: Combine coverage Linux | ||
| if: runner.os == 'Linux' | ||
| run: |- | ||
| echo '############ PWD' | ||
| pwd | ||
| cp .wheelhouse/.coverage* . || true | ||
| ls -al | ||
| uv pip install coverage[toml] | pip install coverage[toml] | ||
| echo '############ combine' | ||
| coverage combine . || true | ||
| echo '############ XML' | ||
| coverage xml -o ./coverage.xml || true | ||
| echo '### The cwd should now have a coverage.xml' | ||
| ls -altr | ||
| pwd | ||
| - uses: codecov/[email protected] | ||
| name: Codecov Upload | ||
| with: | ||
| file: ./coverage.xml | ||
| token: ${{ secrets.CODECOV_TOKEN }} | ||