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 5ee38ae
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 24 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
17 changes: 9 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,17 @@ 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:
runs-on: ${{ matrix.runs-on }}
python-version: ${{ matrix.python-version }}
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
steps:
- uses: ./.github/workflows/_test.yml
with:
runs-on: ${{ matrix.runs-on }}
python-version: ${{ matrix.python-version }}
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

container:
needs: check
Expand Down

0 comments on commit 5ee38ae

Please sign in to comment.