Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multiple Python versions #19

Merged
merged 5 commits into from
Nov 28, 2020
Merged

Support multiple Python versions #19

merged 5 commits into from
Nov 28, 2020

Conversation

br3ndonland
Copy link
Owner

@br3ndonland br3ndonland commented Nov 28, 2020

Description

This project started with Python 3.8. Python 3.9 is now available, so the Dockerfile and GitHub Actions workflows have been updated to Python 3.9.

It is helpful to retain support for Python 3.8, as some Python packages and software stacks have not yet been updated for Python 3.9. For example, some macOS developers (like me) are transitioning to Macs with Apple Silicon M1 ARM processors. The easiest and safest way to install Python for the new processor architecture is to use the xcode-select command-line tools. The Python version included with xcode-select is still 3.8.

This PR will add support for multiple Python versions, starting with 3.8.

Changes

  • Add Python version matrices for GitHub Actions (1a7a5ad)
  • Add Python version build argument to Dockerfile (69ebc5f)
  • Build Docker images for multiple Python versions (dc8da18)
  • Add info on specifying Python version to README (c14de7f)
  • Use Python version matrix in Docker job (465c923)

Related

d9734b4
6f01d75

- Output Python version from Python job to Docker job in GitHub Actions
- Use Python version build argument when building Docker images
- Build Docker images in each workflow run to test Docker builds, but
  only push images to registry if run is triggered by a Git tag or
  long-running branch (develop, master)
- Push Docker images without Python version tag if the latest Python
  version is being used
- Add Python version tag to Docker images
- Add Python version tag and Git tag to Docker images when workflow is
  triggered by pushing a Git tag
@codecov
Copy link

codecov bot commented Nov 28, 2020

Codecov Report

Merging #19 (465c923) into develop (d651a92) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##           develop       #19   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            8         8           
  Lines          219       219           
=========================================
  Hits           219       219           
Flag Coverage Δ
unittests 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d651a92...465c923. Read the comment docs.

#19

Commit dc8da18 updated the builds.yml GitHub Actions workflow to build
Docker images for multiple Python versions. The initial strategy was to
output the Python version used to the Docker job, so that the Docker job
depends on the success of the Python job with the same version.

This may not be possible. If it is, it's unclear how to set a downstream
job to depend on one specific matrix job (for example, 3.8 in the python
job, instead of just the python job in general).

https://docs.github.com/en/free-pro-team@latest/actions/reference/context-and-expression-syntax-for-github-actions#needs-context
@br3ndonland br3ndonland merged commit b033732 into develop Nov 28, 2020
@br3ndonland br3ndonland deleted the python-versions branch November 28, 2020 21:03
br3ndonland added a commit that referenced this pull request Feb 14, 2021
#19
https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions

inboard provides a variety of Docker tags. The least specific tags are:

- ghcr.io/br3ndonland/inboard
- ghcr.io/br3ndonland/inboard:base
- ghcr.io/br3ndonland/inboard:fastapi
- ghcr.io/br3ndonland/inboard:starlette

Images with these tags should only be pushed if they are built with the
latest Python version and the Git ref is either a tag, develop, or main.
Docker images built with Python 3.8 were still being pushed with these
tags, because the syntax evaluated to true if only one of the conditions
was true.

This commit will add a logical grouping to the if statement to correct
the Docker push behavior.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant