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

Remove symbolic link and venv activation #560

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 13 additions & 43 deletions composite/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -166,22 +166,19 @@ runs:
exit 1
fi

interpreter="$(which python)"
if [[ ! -e "${interpreter}3" ]]
then
mkdir -p "$RUNNER_TEMP/bin/"
ln -s "$interpreter" "$RUNNER_TEMP/bin/python3"
echo "$RUNNER_TEMP/bin" >> $GITHUB_PATH
fi
echo "PYTHON=$(which python)" >> $GITHUB_ENV
echo "version=$(python -V)" >> $GITHUB_OUTPUT
else
echo "PYTHON=$(which python3)" >> $GITHUB_ENV
echo "version=$(python3 -V)" >> $GITHUB_OUTPUT
fi
echo "version=$(python3 -V)" >> $GITHUB_OUTPUT
echo '##[endgroup]'
shell: bash

- name: Check for venv package
id: check-venv
run: |
python3 >> $GITHUB_OUTPUT << EOF
${PYTHON} >> $GITHUB_OUTPUT << EOF
try:
import virtualenv
print("venv=virtualenv")
Expand Down Expand Up @@ -230,56 +227,29 @@ runs:
# create virtual environment
if [ "${{ steps.check-venv.outputs.venv }}" == "none" ]
then
python3 -m pip install $PIP_OPTIONS virtualenv
python3 -m virtualenv enricomi-publish-action-venv
${PYTHON} -m pip install $PIP_OPTIONS virtualenv
${PYTHON} -m virtualenv enricomi-publish-action-venv
else
python3 -m "${{ steps.check-venv.outputs.venv }}" enricomi-publish-action-venv
${PYTHON} -m "${{ steps.check-venv.outputs.venv }}" enricomi-publish-action-venv
fi

# test activating virtualenv
case "$RUNNER_OS" in
Linux*|macOS*)
source enricomi-publish-action-venv/bin/activate;;
Windows*)
source enricomi-publish-action-venv\\Scripts\\activate;;
esac
which python3
echo "VENV_PYTHON=$(cd enricomi-publish-action-venv; cd bin; $(find . -name python3) -c 'import sys; print(sys.executable)')" >> $GITHUB_ENV
echo '##[endgroup]'
shell: bash

- name: Install Python dependencies
run: |
echo '##[group]Install Python dependencies'
if [ "${{ steps.venv.outcome }}" == "success" ]
then
# activate virtualenv
case "$RUNNER_OS" in
Linux*|macOS*)
source enricomi-publish-action-venv/bin/activate;;
Windows*)
source enricomi-publish-action-venv\\Scripts\\activate;;
esac
fi
which python3

# make sure wheel is installed, which improves installing our dependencies
python3 -m pip install wheel
python3 -m pip install -r $GITHUB_ACTION_PATH/../python/requirements.txt
${VENV_PYTHON} -m pip install wheel
${VENV_PYTHON} -m pip install -r $GITHUB_ACTION_PATH/../python/requirements.txt
echo '##[endgroup]'
shell: bash

- name: Publish Test Results
id: test-results
run: |
echo '##[group]Publish Test Results'
# activate virtualenv
case "$RUNNER_OS" in
Linux*|macOS*)
source enricomi-publish-action-venv/bin/activate;;
Windows*)
source enricomi-publish-action-venv\\Scripts\\activate;;
esac
python3 $GITHUB_ACTION_PATH/../python/publish_test_results.py
${VENV_PYTHON} $GITHUB_ACTION_PATH/../python/publish_test_results.py
echo '##[endgroup]'
env:
GITHUB_TOKEN: ${{ inputs.github_token }}
Expand Down
Loading