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

Make Action usable inside a Docker container #121

Closed
wants to merge 17 commits into from
12 changes: 9 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,18 @@ jobs:
main:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- {python: '3.7', debug: true}
- {python: '3.11-dev', debug: false}
- {python: '3.12-dev', debug: false}
- {python: '3.7', debug: true, image: null}
- {python: '3.11', debug: false, image: 'ubuntu:latest'}
- {python: '3.11-dev', debug: false, image: null}
- {python: '3.12-dev', debug: false, image: null}
container: ${{ matrix.image }}
steps:
- name: Install Dependencies in Container
if: ${{ matrix.image }}
run: DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y sudo software-properties-common python3 tzdata
- uses: actions/checkout@v3
- uses: ./.
with:
Expand Down
10 changes: 9 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,13 @@ runs:
using: composite
steps:
- name: add deadsnakes ppa and install ${{ inputs.python-version }} ${{ inputs.debug == 'true' && '(debug)' || '' }}
run: ${{ github.action_path }}/bin/install-python ${{ inputs.python-version }} ${{ inputs.debug == 'true' && '--debug' || '' }}
shell: bash
run: |
# The `github.action_path` path is incorrectly set if the action is executed inside a Docker container
# So one has to use `GITHUB_ACTION_PATH` instead
# e.g.: https://github.com/actions/runner/issues/2185 & https://github.com/actions/runner/pull/1762#issuecomment-1105843659
if [[ -f "${{ github.action_path }}/bin/install-python" ]]; then
${{ github.action_path }}/bin/install-python ${{ inputs.python-version }} ${{ inputs.debug == 'true' && '--debug' || '' }}
elif [[ -f "$GITHUB_ACTION_PATH/bin/install-python" ]]; then
$GITHUB_ACTION_PATH/bin/install-python ${{ inputs.python-version }} ${{ inputs.debug == 'true' && '--debug' || '' }}
fi