forked from arduino/compile-sketches
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request arduino#105 from per1234/uses-setup
Use `actions/setup-python` action to install Python for action
- Loading branch information
Showing
5 changed files
with
29 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,11 +5,13 @@ on: | |
paths: | ||
- '.github/workflows/lint-python.yml' | ||
- 'compilesketches/**.py' | ||
- '.python-version' | ||
|
||
push: | ||
paths: | ||
- '.github/workflows/lint-python.yml' | ||
- 'compilesketches/**.py' | ||
- '.python-version' | ||
|
||
# Scheduled trigger checks for workflow failures resulting from updates to the linting tools | ||
schedule: | ||
|
@@ -32,6 +34,11 @@ jobs: | |
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install Python | ||
uses: actions/[email protected] | ||
with: | ||
python-version-file: .python-version | ||
|
||
- name: Run the set up script | ||
id: setup | ||
run: | | ||
|
@@ -40,7 +47,7 @@ jobs: | |
- name: Install flake8 | ||
run: | | ||
source "${{ steps.setup.outputs.python-venv-activate-script-path }}" | ||
"${{ steps.setup.outputs.python-command }}" \ | ||
python \ | ||
-m \ | ||
pip install \ | ||
flake8 \ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,12 +4,14 @@ on: | |
pull_request: | ||
paths: | ||
- '.github/workflows/test-python.yml' | ||
- '.python-version' | ||
- 'action-setup.sh' | ||
- 'compilesketches/**' | ||
|
||
push: | ||
paths: | ||
- '.github/workflows/test-python.yml' | ||
- '.python-version' | ||
- 'action-setup.sh' | ||
- 'compilesketches/**' | ||
|
||
|
@@ -39,6 +41,11 @@ jobs: | |
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install Python | ||
uses: actions/[email protected] | ||
with: | ||
python-version-file: .python-version | ||
|
||
- name: Run the set up script | ||
id: setup | ||
run: | | ||
|
@@ -47,7 +54,7 @@ jobs: | |
- name: Install test dependencies | ||
run: | | ||
source "${{ steps.setup.outputs.python-venv-activate-script-path }}" | ||
"${{ steps.setup.outputs.python-command }}" \ | ||
python \ | ||
-m \ | ||
pip install \ | ||
--requirement "${{ env.PYTHON_PROJECT_TESTS_PATH }}/requirements.txt" | ||
|
@@ -56,7 +63,7 @@ jobs: | |
run: | | ||
source "${{ steps.setup.outputs.python-venv-activate-script-path }}" | ||
export PYTHONPATH="${{ env.PYTHON_PROJECT_PATH }}" | ||
"${{ steps.setup.outputs.python-command }}" \ | ||
python \ | ||
-m \ | ||
coverage run \ | ||
--rcfile="${{ env.PYTHON_PROJECT_TESTS_PATH }}/.coveragerc" \ | ||
|
@@ -65,15 +72,15 @@ jobs: | |
pytest "${{ env.PYTHON_PROJECT_TESTS_PATH }}" | ||
# Generate coverage data file for consumption by `codecov/codecov-action`. | ||
# Otherwise that action generates the file using the system Python environment, which doesn't work. | ||
"${{ steps.setup.outputs.python-command }}" \ | ||
python \ | ||
-m \ | ||
coverage xml \ | ||
-o "${{ github.workspace }}/${{ env.COVERAGE_DATA_FILENAME }}" | ||
- name: Display code coverage report | ||
run: | | ||
source "${{ steps.setup.outputs.python-venv-activate-script-path }}" | ||
"${{ steps.setup.outputs.python-command }}" \ | ||
python \ | ||
-m \ | ||
coverage report | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3.8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,6 +49,11 @@ inputs: | |
runs: | ||
using: composite | ||
steps: | ||
- name: Install Python | ||
uses: actions/[email protected] | ||
with: | ||
python-version-file: ${{ github.action_path }}/.python-version | ||
|
||
- name: Run the set up script | ||
id: setup | ||
shell: bash | ||
|
@@ -74,4 +79,4 @@ runs: | |
INPUT_SKETCHES-REPORT-PATH: ${{ inputs.sketches-report-path }} | ||
run: | | ||
source "${{ steps.setup.outputs.python-venv-activate-script-path }}" | ||
"${{ steps.setup.outputs.python-command }}" "${{ github.action_path }}/compilesketches/compilesketches.py" | ||
python "${{ github.action_path }}/compilesketches/compilesketches.py" |