Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 0 additions & 2 deletions .github/actions/python_requirements/save_pip_cache/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ inputs:
runs:
using: "composite"
steps:
# TODO non posso usare l'hash del file perchè quando vado ad aggiornare i requirements
# l'hash cambia e sicuramente non trovo la cache salvata
- name: Generate random UUID
id: generate_random_uuid
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/_release_and_tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
- name: Create Tag and Release
id: create-release
if: steps.check-tag.outputs.match == 'true'
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.event.pull_request.title }}
name: Version ${{ github.event.pull_request.title }}
Expand All @@ -97,7 +97,7 @@ jobs:
with:
fetch-depth: 0 # otherwise, you do not retrieve the tags

- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
if: steps.check-tag.outputs.match == 'true' && (inputs.publish_on_pypi || inputs.publish_on_test_pypi)
with:
python-version: "3.x"
Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/create_apt_cache.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ on:
# Path to APT requirements file
- '.github/test/python_test/packages.txt'

# discard previous execution if you commit to a branch that is already running
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
create-cache:
Expand All @@ -25,15 +29,15 @@ jobs:
- name: Install APT dependencies
run: |
sudo apt-get update
sudo apt-get -y install --no-install-recommends $(tr '\n' ' ' < apt_packages.txt)
sudo apt-get -y install --no-install-recommends $(tr '\n' ' ' < .github/test/python_test/packages.txt)

- name: Compute apt_packages.txt SHA256 hash
id: compute_apt_packages_sha256_hash
run: |
COMPUTED_HASH=$(sha256sum apt_packages.txt | cut -d ' ' -f 1)
echo "cache_key=$COMPUTED_HASH" >> $GITHUB_OUTPUT
uses: ./.github/actions/misc/compute_files_hash
with:
file_paths: .github/test/python_test/packages.txt

- uses: actions/cache/save@v4
with:
path: /var/cache/apt/archives/*.deb
key: ${{ github.ref_name }}-${{ steps.compute_apt_packages_sha256_hash.outputs.cache_key }}
key: ${{ github.ref_name }}-${{ steps.compute_apt_packages_sha256_hash.outputs.computed_hash }}
50 changes: 50 additions & 0 deletions .github/workflows/create_python_cache.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Create Python cache

# GitHub will remove any cache entries that have not been accessed in over 7 days.

# Only project dependencies will be cached here

on:
push:
branches:
- main
- master
- develop
- dev
paths:
- '.github/test/python_test/requirements.txt'

# discard previous execution if you commit to a branch that is already running
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
create-python-cache:
name: Create cache for Python dependencies
runs-on: ubuntu-latest
steps:
- name: Check out latest commit
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Set up Python's virtual environment
uses: ./.github/actions/python_requirements/create_virtualenv

- name: Install Python dependencies
run: |
pip install -r .github/test/python_test/requirements.txt
working-directory: "."

- name: Save pip cache
uses: ./.github/actions/python_requirements/save_pip_cache

- name: Create virtual environment cache
uses: ./.github/actions/python_requirements/save_virtualenv
with:
requirements_paths: .github/test/python_test/requirements.txt

3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,6 @@
* Removed `setup-python-dependencies` from `codeql/action.yml` since it has no effect anymore. See [this](https://github.blog/changelog/2024-01-23-codeql-2-16-python-dependency-installation-disabled-new-queries-and-bug-fixes/) for more information.
* Linters versions in step `Create requirements-linters.txt` of `_python.yml` action are now computed according to `configurations/python_linters/requirements-linters.txt`. As of now, linter updates are only required in `configurations/python_linters/requirements-linters.txt`.
* Reworked Python requirements caching.
* Updated some Github actions:
* setup-python v4 -> v5
* action-gh-release v1 -> v2
2 changes: 0 additions & 2 deletions actions/python_requirements/save_pip_cache/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ inputs:
runs:
using: "composite"
steps:
# TODO non posso usare l'hash del file perchè quando vado ad aggiornare i requirements
# l'hash cambia e sicuramente non trovo la cache salvata
- name: Generate random UUID
id: generate_random_uuid
run: |
Expand Down
4 changes: 2 additions & 2 deletions workflows/_release_and_tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
- name: Create Tag and Release
id: create-release
if: steps.check-tag.outputs.match == 'true'
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.event.pull_request.title }}
name: Version ${{ github.event.pull_request.title }}
Expand All @@ -97,7 +97,7 @@ jobs:
with:
fetch-depth: 0 # otherwise, you do not retrieve the tags

- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
if: steps.check-tag.outputs.match == 'true' && (inputs.publish_on_pypi || inputs.publish_on_test_pypi)
with:
python-version: "3.x"
Expand Down
Loading