-
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.
- Loading branch information
0 parents
commit cafcaab
Showing
4 changed files
with
128 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Branch | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- '*' | ||
branches-ignore: | ||
- 'main' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
id-token: write | ||
contents: read | ||
|
||
steps: | ||
- name: Action Lint | ||
id: action-lint | ||
uses: raven-actions/actionlint@v2 | ||
with: | ||
files: 'action.yml' | ||
pyflakes: false |
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,22 @@ | ||
name: Main | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- 'main' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
id-token: write | ||
contents: read | ||
|
||
steps: | ||
- name: Action Lint | ||
id: action-lint | ||
uses: raven-actions/actionlint@v2 | ||
with: | ||
files: 'action.yml' | ||
pyflakes: false |
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,37 @@ | ||
# gha-setup-python | ||
This GitHub Action sets up a Python environment for use in workflows. | ||
|
||
_*NOTE: This workflow is opinionated and meets the needs of its author. It is provided publicly as a reference for others to use and modify as needed.*_ | ||
|
||
This action will perform the following actions: | ||
* Install Python | ||
* Install Pipenv | ||
* Generate Pipfile.lock if does not exist (only to be used in that run) | ||
* Install dependencies | ||
|
||
## Usage | ||
To use this action, add the following step to your workflow: | ||
|
||
```yaml | ||
steps: | ||
- name: Checkout code | ||
uses: serverlessopsio/gha-setup-workspace@v1 | ||
|
||
- name: Setup Python enviornment | ||
uses: serverlessopsio/gha-setup-python@v1 | ||
``` | ||
## Inputs | ||
* python-version (_optional_): The version of Python to use. This action uses the version resolution employed by [actions/setup-python](https://github.com/actions/setup-python) | ||
## Outputs | ||
* python-version: he installed Python or PyPy version. Useful when given a version range as input. | ||
* cache-hit: A boolean value to indicate a cache entry was found | ||
* python-path: The absolute path to the Python or PyPy executable. | ||
## Contributing | ||
Contributions are welcome! Please open an issue or submit a pull request for any changes. | ||
## Contact | ||
For any questions or support, please open an issue in this repository. | ||
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,45 @@ | ||
|
||
name: setup-python | ||
description: Installs Python and project dependencies | ||
|
||
inputs: | ||
python_version: | ||
description: Python version | ||
|
||
runs: | ||
using: composite | ||
|
||
steps: | ||
- name: Setup Python | ||
id: install-python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '${{ inputs.python_version }}' | ||
cache: pipenv | ||
|
||
- name: Install pipenv | ||
id: install-pipenv | ||
shell: bash | ||
run: pip install --user --upgrade pipenv | ||
|
||
# This is to ensure that all jobs in a workflow will resolve the same dependencies | ||
- name: Check Pipfile.lock | ||
id: check-pipfile-lock | ||
shell: bash | ||
run: | | ||
if [ -f Pipfile.lock ]; \ | ||
then \ | ||
echo "has-lock=true" >> $GITHUB_OUTPUT; \ | ||
else \ | ||
echo "has-lock=false" >> $GITHUB_OUTPUT; \ | ||
fi | ||
- name: Install dependencies | ||
id: install-python-deps | ||
shell: bash | ||
run: pipenv install --dev | ||
|
||
outputs: | ||
python-version: ${{ steps.install-python.outputs.python-version }} | ||
python-path: ${{ steps.install-python.outputs.python-path }} | ||
cache-hit: ${{ steps.install-python.outputs.cache-hit }} |