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

use a python venv #173

Merged
merged 4 commits into from
Dec 11, 2023
Merged
Changes from 2 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
72 changes: 45 additions & 27 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,33 +134,44 @@ runs:
fi
fi
fi
if [[ "${{runner.os}}" == "macOS" ]]; then
python3 -m venv "$GITHUB_ACTION_PATH/venv"
source "$GITHUB_ACTION_PATH/venv/bin/activate"
fi
python3 -m pip install -r "$GITHUB_ACTION_PATH/requirements.txt"

- name: Setup python venv
shell: pwsh
run: |
${{ steps.setup-python.outputs.python-path }} -m venv "$env:GITHUB_ACTION_PATH/venv"
if ("${{ runner.os }}" -ceq "macOS" -or "${{ runner.os }}" -ceq "Linux") {
Invoke-Expression -Command "$env:GITHUB_ACTION_PATH/venv/bin/Activate.ps1"
}
else {
Invoke-Expression -Command "$env:GITHUB_ACTION_PATH/venv/Scripts/Activate.ps1"
}
pip install -r "$env:GITHUB_ACTION_PATH/requirements.txt"
clang-tools -i ${{ inputs.version }} -b

- name: Run cpp-linter
id: cpp-linter
shell: bash
shell: pwsh
run: |
if [[ "${{runner.os}}" == "macOS" ]]; then
source "$GITHUB_ACTION_PATH/venv/bin/activate"
fi
cpp-linter \
--style="${{ inputs.style }}" \
--extensions=${{ inputs.extensions }} \
--tidy-checks="${{ inputs.tidy-checks }}" \
--repo-root=${{ inputs.repo-root }} \
--version=${{ inputs.version }} \
--verbosity=${{ inputs.verbosity }} \
--lines-changed-only=${{ inputs.lines-changed-only }} \
--files-changed-only=${{ inputs.files-changed-only }} \
--thread-comments=${{ inputs.thread-comments }} \
--no-lgtm=${{ inputs.no-lgtm }} \
--step-summary=${{ inputs.step-summary }} \
--ignore="${{ inputs.ignore }}" \
--database=${{ inputs.database }} \
--file-annotations=${{ inputs.file-annotations }} \
--extra-arg="${{ inputs.extra-args }}"
if ("${{ runner.os }}" -ceq "macOS" -or "${{ runner.os }}" -ceq "Linux") {
Invoke-Expression -Command "$env:GITHUB_ACTION_PATH/venv/bin/Activate.ps1"
}
else {
Invoke-Expression -Command "$env:GITHUB_ACTION_PATH/venv/Scripts/Activate.ps1"
}
$app = 'cpp-linter' +
' --style="${{ inputs.style }}"' +
' --extensions=${{ inputs.extensions }}' +
' --tidy-checks="${{ inputs.tidy-checks }}"' +
' --repo-root=${{ inputs.repo-root }}' +
' --version=${{ inputs.version }}' +
' --verbosity=${{ inputs.verbosity }}' +
' --lines-changed-only=${{ inputs.lines-changed-only }}' +
' --files-changed-only=${{ inputs.files-changed-only }}' +
' --thread-comments=${{ inputs.thread-comments }}' +
' --no-lgtm=${{ inputs.no-lgtm }}' +
' --step-summary=${{ inputs.step-summary }}' +
' --ignore="${{ inputs.ignore }}"' +
' --database=${{ inputs.database }}' +
' --file-annotations=${{ inputs.file-annotations }}' +
' --extra-arg="${{ inputs.extra-args }}"'
Invoke-Expression -Command $app
Loading