Skip to content

Latest commit

 

History

History
77 lines (66 loc) · 3.33 KB

package-build.md

File metadata and controls

77 lines (66 loc) · 3.33 KB

package-build.yml

This workflow will build the package using the hynek/build-and-inspect-python-package action, and then verify that the package can be installed on each combination of Python version and operating system specified.

Note

When building the Python package, this workflow will run in the package-build GitHub Actions environment. This environment will be created in the repository that calls this workflow. No additional setup is required.

Important

When calling this reusable workflow, the permissions must be set as follows:

permissions:
  contents: read
  id-token: write
  attestations: write

Note

This workflow uses concurrency to limit the number of builds that can run at the same time to a single build. For builds on the main branch, the workflow will simply create a queue. For builds on other branches (or builds triggered by Pull Requests), the workflow will cancel any currently running builds for the same branch (or Pull Request).

Note

This workflow uses the following GitHub Actions:

See the Workflow file for the currently used versions of each GitHub Action.

Tip

See the Workflow file for implementation details.

Inputs

Input variable Necessity Description Default
package-name required The name of the package to build, install, and import (this must be the package's importable name).
python-versions-array required A valid JSON array of Python versions to validate the package can be installed with.
operating-systems-array optional A valid JSON array of operating system names to validate the package can be installed on. '["ubuntu", "windows", "macos"]'

Example

name: Package Build
on:
  push:
    branches: [main]
    tags: ['*']
  pull_request:
    branches: [main]
# Cancel running jobs for the same workflow and branch.
concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
  package-build:
    uses: tektronix/python-package-ci-cd/.github/workflows/[email protected]
    with:
      package-name: my_package  # required
      python-versions-array: '["3.9", "3.10", "3.11", "3.12"]'  # required
      operating-systems-array: '["ubuntu", "windows", "macos"]'  # optional
    permissions:
      contents: read
      id-token: write
      attestations: write