Skip to content

Commit

Permalink
Upload wheel as artifact
Browse files Browse the repository at this point in the history
  • Loading branch information
Spacetown committed Aug 14, 2024
1 parent 121cc05 commit 1cd36be
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 10 deletions.
27 changes: 19 additions & 8 deletions .github/workflows/job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ on:
type: string
description: 'The Python version to use'
required: false # Only needed if not in container
upload-wheel:
type: boolean
description: 'Upload the wheel file'
default: false
upload-app:
type: boolean
description: 'Upload the standalone application'
Expand Down Expand Up @@ -135,6 +139,21 @@ jobs:
fi
exit 0
- name: Build wheel
run: |
nox --non-interactive${{ inputs.container && format(' --session "docker_run_compiler({0})" --', inputs.gcc) || '' }} --session build_wheel
- name: Check wheel
run: |
nox --non-interactive${{ inputs.container && format(' --session "docker_run_compiler({0})" --', inputs.gcc) || '' }} --session check_wheel
- name: Upload wheel
if: ${{ inputs.upload-wheel == true }}
uses: actions/upload-artifact@v4
with:
name: gcovr.whl
path: dist/*.whl

- name: Test bundle of app
if: ${{ (!inputs.container && !startsWith(inputs.python-version,'pypy')) || (inputs.container && (inputs.gcc != 'gcc-5') && (inputs.gcc != 'gcc-6')) }}
run: |
Expand All @@ -146,11 +165,3 @@ jobs:
with:
name: app-${{ inputs.os }}
path: artifacts/gcovr*

- name: Build wheel
run: |
nox --non-interactive${{ inputs.container && format(' --session "docker_run_compiler({0})" --', inputs.gcc) || '' }} --session build_wheel
- name: Check wheel
run: |
nox --non-interactive${{ inputs.container && format(' --session "docker_run_compiler({0})" --', inputs.gcc) || '' }} --session check_wheel
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ jobs:
- os: ubuntu-22.04
gcc: gcc-11
python-version: '3.12'
upload-wheel: true
upload-app: true

# Test minimum and maximum Python version on Windows.
Expand Down
9 changes: 7 additions & 2 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#
# ****************************************************************************

import glob
import io
import os
import platform
Expand Down Expand Up @@ -308,14 +307,20 @@ def check_wheel(session: nox.Session) -> None:
session.install("wheel", "twine")
with session.chdir(f"{session.cache_dir}/dist"):
session.run("twine", "check", "*", external=True)
session.install(glob.glob("*.whl")[0])
wheel = list(Path().glob("*.whl"))[0].absolute()
session.install(wheel)
session.run("python", "-m", "gcovr", "--help", external=True)
session.run("gcovr", "--help", external=True)
session.log("Run all transformations to check if all the modules are packed")
with session.chdir(session.create_tmp()):
for format in OUTPUT_FORMATS:
session.run("gcovr", f"--{format}", f"out.{format}", external=True)

if CI_RUN:
dest_path = Path() / "dist" / wheel.name
dest_path.parent.mkdir(parents=True, exist_ok=True)
wheel.rename(dest_path)


@nox.session
def upload_wheel(session: nox.Session) -> None:
Expand Down

0 comments on commit 1cd36be

Please sign in to comment.