Skip to content

Commit

Permalink
use a python venv
Browse files Browse the repository at this point in the history
adheres to PEP668 and addresses #171
  • Loading branch information
2bndy5 committed Dec 7, 2023
1 parent e163f22 commit a3cbf51
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,17 @@ outputs:
runs:
using: "composite"
steps:
- name: Install action dependencies
- name: Install python
uses: actions/setup-python@v4
id: setup-python
with:
python-version: '3.11'
update-environment: false

- name: Install Linux clang dependencies
shell: bash
run: |
if [[ "${{runner.os}}" == "Linux" ]]; then
if [[ "${{ runner.os }}" == 'Linux' ]]; then
sudo apt-get update
# First try installing from default Ubuntu repositories before trying LLVM script
if ! sudo apt-get install -y clang-format-${{ inputs.version }} clang-tidy-${{ inputs.version }}; then
Expand All @@ -127,19 +134,27 @@ runs:
fi
fi
fi
if [[ "${{runner.os}}" == "macOS" ]]; then
python3 -m venv "$GITHUB_ACTION_PATH/venv"
- name: Setup python venv
shell: bash
run: |
${{ steps.setup-python.outputs.python-path }} -m venv "$GITHUB_ACTION_PATH/venv"
if [[ "${{ runner.os }}" == "macOS" || "${{ runner.os }}" == "Linux" ]]; then
source "$GITHUB_ACTION_PATH/venv/bin/activate"
else
"$GITHUB_ACTION_PATH/venv/Scripts/activate"
fi
python3 -m pip install -r "$GITHUB_ACTION_PATH/requirements.txt"
pip install -r "$GITHUB_ACTION_PATH/requirements.txt"
clang-tools -i ${{ inputs.version }} -b
- name: Run cpp-linter
id: cpp-linter
shell: bash
run: |
if [[ "${{runner.os}}" == "macOS" ]]; then
if [[ "${{ runner.os }}" == "macOS" || "${{ runner.os }}" == "Linux" ]]; then
source "$GITHUB_ACTION_PATH/venv/bin/activate"
else
"$GITHUB_ACTION_PATH/venv/Scripts/activate"
fi
cpp-linter \
--style="${{ inputs.style }}" \
Expand Down

0 comments on commit a3cbf51

Please sign in to comment.