Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[actions] push poetry containers to gcr
- Loading branch information
Showing
1 changed file
with
32 additions
and
59 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,41 @@ | ||
name: push-poetry-container | ||
description: Push a poetry container for use in CI. | ||
|
||
on: | ||
pull_request: | ||
workflow_dispatch: # manually trigger | ||
env: | ||
POETRY_VERSION: 1.3.2 | ||
PYTHON_PRIMARY_VERSION: 3.8.16 | ||
PYTHON_SECONDARY_VERSION: 3.10.9 | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
pre-merge: | ||
push-poetry-container: | ||
runs-on: ubuntu-22.04 | ||
strategy: | ||
matrix: | ||
python-version: ["3.8", "3.10"] | ||
include: | ||
- python-version: "3.8" | ||
python-py-version: "py38" | ||
- python-version: "3.10" | ||
python-py-version: "py310" | ||
container: | ||
# NB: Github actions always force user=root | ||
# https://docs.github.com/en/actions/creating-actions/dockerfile-support-for-github-actions#user | ||
image: arene-driving-docker-local-internal.artifactory-ha.tmc-stargate.com/python-zen:${{ matrix.python-py-version }}-poetry-bullseye | ||
credentials: | ||
username: ${{ secrets.USG_ARTIFACTORY_API_USER }} | ||
password: ${{ secrets.USG_ARTIFACTORY_API_KEY }} | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Find the Poetry Cache | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Login to GCR | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Echo | ||
run: | | ||
echo "POETRY_CACHE_DIR=$(poetry config virtualenvs.path)" >> $GITHUB_ENV | ||
echo "Config ${POETRY_CACHE_DIR}" | ||
- name: Cache the Poetry Cache | ||
id: cache-deps | ||
uses: actions/cache@v2 | ||
echo "USER: ${{ github.actor }}" | ||
echo "REPOSITORY: ${{ github.repository }}" | ||
echo "POETRY_VERSION: ${POETRY_VERSION}" | ||
echo "PYTHON_PRIMARY_VERSION: ${PYTHON_PRIMARY_VERSION}" | ||
echo "PYTHON_SECONDARY_VERSION: ${PYTHON_SECONDARY_VERSION}" | ||
- name: Build Image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
path: ${POETRY_CACHE_DIR} | ||
# bump the suffix to force-refresh the cache | ||
key: dependencies-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}-1 | ||
|
||
# Install all deps, sans the project (--no-root) | ||
- name: (poetry-zen) Install Dependencies | ||
run: cd poetry_zen && poetry install --no-interaction --no-root | ||
if: steps.cache-deps.outputs.cache-hit != 'true' | ||
|
||
# Project is installed separately to avoid always invalidating the cache | ||
- name: (poetry-zen) Install Project | ||
run: cd poetry_zen && poetry install --no-interaction | ||
|
||
# TODO: Caching above doesn't make sense when tox effectively re-installs deps | ||
- name: (poetry-zen) Tests | ||
run: cd poetry_zen && poetry run tox -e ${{ matrix.python-py-version }} | ||
- name: (poetry-zen) Formatters, Linters, Mypy | ||
run: cd poetry_zen && poetry run tox -e check | ||
|
||
# Only verifying the static pathway | ||
- name: (poetry-bindings) Install System Dependencies | ||
run: apt install -y build-essential make unzip zip | ||
- name: (poetry-bindings) Build libadd.a | ||
run: cd poetry_bindings/adder && make static | ||
- name: (poetry-bindings) Build poetry_pybind11_example | ||
run: cd poetry_bindings/poetry_pybind11_example && poetry build | ||
- name: (poetry-bindings) Install Tox | ||
run: cd poetry_bindings/poetry_pybind11_example && poetry install --no-interaction --no-root | ||
- name: (poetry-bindings) Run Tox Tests | ||
run: cd poetry_bindings/poetry_pybind11_example && poetry run tox -e ${{ matrix.python-py-version }} | ||
file: ./.devcontainer/Dockerfile | ||
push: true | ||
build-args: | | ||
POETRY_VERSION=${{ env.POETRY_VERSION }} | ||
PYTHON_VERSION=${{ env.PYTHON_PRIMARY_VERSION }} | ||
tags: ${{ github.repository }}:${{ env.PYTHON_PRIMARY_VERSION }} |