Skip to content

Commit

Permalink
chore(ci): move Python version into a file (#230)
Browse files Browse the repository at this point in the history
We were already specifying a Python version for setup-python actions in
this repo, but this moves the Python version declaration to an external
file. This isn't urgent but it does make it easier to keep the Python
version coordinated across CI workflows and it also enables developers
to know what version of Python is recommended for local development. To
come out of draft, this PR needs to include README updates that document
the existence and potential usage of the `.python-version` file.
  • Loading branch information
ctreatma authored Oct 17, 2024
1 parent 4538829 commit 9c0fa56
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 14 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/docs-generation-test-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,19 @@ permissions:
pull-requests: read
contents: read

env:
COLLECTION_PATH: .ansible/collections/ansible_collections/equinix/cloud

jobs:
integration-test-pr:
runs-on: ubuntu-latest
defaults:
run:
working-directory: .ansible/collections/ansible_collections/equinix/cloud
working-directory: ${{ env.COLLECTION_PATH }}
steps:
- uses: actions/checkout@v4
with:
path: .ansible/collections/ansible_collections/equinix/cloud
path: ${{ env.COLLECTION_PATH }}
ref: ${{ github.event.pull_request.head.sha || github.ref }}

- name: update packages
Expand All @@ -33,7 +36,7 @@ jobs:
- name: setup python 3
uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version-file: ${{ env.COLLECTION_PATH }}/.python-version

- name: install dependencies
run: pip3 install -r requirements-dev.txt -r requirements.txt
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ permissions:
pull-requests: read
contents: read

env:
COLLECTION_PATH: .ansible/collections/ansible_collections/equinix/cloud

jobs:
authorize:
environment:
Expand All @@ -41,11 +44,11 @@ jobs:
concurrency: 'e2e-test'
defaults:
run:
working-directory: .ansible/collections/ansible_collections/equinix/cloud
working-directory: ${{ env.COLLECTION_PATH }}
steps:
- uses: actions/checkout@v4
with:
path: .ansible/collections/ansible_collections/equinix/cloud
path: ${{ env.COLLECTION_PATH }}
ref: ${{ github.event.pull_request.head.sha || github.ref }}

- name: update packages
Expand All @@ -57,7 +60,7 @@ jobs:
- name: setup python 3
uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version-file: ${{ env.COLLECTION_PATH }}/.python-version

- name: install dependencies
run: pip3 install -r requirements-dev.txt -r requirements.txt
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ name: Semantic Release to GitHub and Ansible Galaxy
on:
workflow_dispatch: null

env:
COLLECTION_PATH: .ansible/collections/ansible_collections/equinix/cloud


jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -15,7 +19,7 @@ jobs:
- name: checkout repo
uses: actions/checkout@v4
with:
path: .ansible/collections/ansible_collections/equinix/cloud
path: ${{ env.COLLECTION_PATH }}
fetch-depth: 0
ssh-key: ${{ secrets.DEPLOY_KEY }}

Expand All @@ -28,15 +32,15 @@ jobs:
- name: setup python 3
uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version-file: ${{ env.COLLECTION_PATH }}/.python-version

- name: install dependencies
run: pip3 install -r requirements-dev.txt -r requirements.txt

- name: Do GitHub release
uses: cycjimmy/semantic-release-action@v4
with:
working_directory: .ansible/collections/ansible_collections/equinix/cloud
working_directory: ${{ env.COLLECTION_PATH }}
semantic_version: 19.0.5
extra_plugins: |
@semantic-release/[email protected]
Expand Down
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ flycheck_*.el
# network security
/network-security.data


### Git ###
# Created by git for backups. To disable backups in Git:
# $ git config --global mergetool.keepBackup false
Expand Down Expand Up @@ -245,9 +244,6 @@ docs/_build/
# PyBuilder
target/

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
Expand Down
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.10
2 changes: 1 addition & 1 deletion DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

## 0. <a name="Developmentenvironmentsetup"></a>Development environment setup

We use Python 3.8 for the collection development.
We use Python for collection development. The Python version that is currently used in GitHub Actions workflows is tracked in the `.python-version` file in the root of this repository. We recommend using the same Python version for local development. Some tools, such as `pyenv`, may reference the `.python-version` file automatically, but in other cases you may have to manually install the specified Python version and add it to your path.

Development of the collection is best done if your repository is located in a path that concludes with `ansible_collections/equinix/cloud`. This is a requirement specific to Ansible. You can clone the repository using the following command:

Expand Down

0 comments on commit 9c0fa56

Please sign in to comment.