Skip to content

Commit

Permalink
made the dev install run the dev container after it's made
Browse files Browse the repository at this point in the history
  • Loading branch information
evalott100 committed Mar 1, 2024
1 parent 2774498 commit 1b9a371
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 18 deletions.
22 changes: 11 additions & 11 deletions .github/actions/install_requirements/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,31 @@ description: Install a version of python then call pip install and report what w
inputs:
python-version:
description: Python version to install, default is from Dockerfile
default: "dev"
default: "dev_container"
pip-install:
description: Parameters to pass to pip install
default: "$([ -f dev-requirements.txt ] && echo '-c dev-requirements.txt') -e .[dev]"
docker-image:
description: The docker image used on a dev install
default: ""

runs:
using: composite
steps:
- name: Get version of python
run: |
PYTHON_VERSION="${{ inputs.python-version }}"
if [ $PYTHON_VERSION == "dev" ]; then
PYTHON_VERSION="3.11"
fi
echo "PYTHON_VERSION=$PYTHON_VERSION" >> "$GITHUB_ENV"
shell: bash

- name: Setup python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
python-version: ${{ inputs.python-version }}
if: inputs.python-version != 'dev_container'

- name: Install packages
run: pip install ${{ inputs.pip-install }}
shell: bash
if: inputs.python-version != 'dev_container'

- name: Run docker container
run: docker run -d --name my-container ${{ inputs.docker-image }}
if: inputs.python-version == 'dev_container'

- name: Report what was installed
run: pip freeze
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/_container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,5 @@ jobs:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
outputs:
docker-image: ghcr.io/${{ github.repository }}:${{ steps.meta.outputs.tags }}
12 changes: 7 additions & 5 deletions .github/workflows/_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,24 @@ jobs:
# Need this to get version number from last tag
fetch-depth: 0

- if: inputs.python-version == 'dev'
name: Install dev versions of python packages
- if: inputs.python-version == 'dev_container'
name: Install dev_container versions of python packages
uses: ./.github/actions/install_requirements
with:
docker-image: : ${{ github.event.inputs.docker-image }}

- if: inputs.python-version == 'dev'
- if: inputs.python-version == 'dev_container'
name: Write the requirements as an artifact
run: pip freeze --exclude-editable > /tmp/dev-requirements.txt

- if: inputs.python-version == 'dev'
- if: inputs.python-version == 'dev_container'
name: Upload dev-requirements.txt
uses: actions/upload-artifact@v4
with:
name: dev-requirements
path: /tmp/dev-requirements.txt

- if: inputs.python-version != 'dev'
- if: inputs.python-version != 'dev_container'
name: Install latest versions of python packages
uses: ./.github/actions/install_requirements
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ jobs:
runs-on: ["ubuntu-latest"] # can add windows-latest, macos-latest
python-version: ["3.10", "3.11"]
include:
# Include one that runs in the dev environment
# Include one that runs in the dev container environment
- runs-on: "ubuntu-latest"
python-version: "dev"
python-version: "dev_container"
fail-fast: false
uses: ./.github/workflows/_test.yml
with:
Expand Down

0 comments on commit 1b9a371

Please sign in to comment.