Skip to content

Commit

Permalink
ci: Cache apt packages
Browse files Browse the repository at this point in the history
To (marginally) increase build times...
  • Loading branch information
Forty-Bot committed Nov 17, 2023
1 parent c1b8422 commit 0c81725
Showing 1 changed file with 28 additions and 6 deletions.
34 changes: 28 additions & 6 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,33 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Calculate apt sources hash
id: apt-cache
run: |
echo -n hash= >> $GITHUB_OUTPUT
tar -cf - --sort=name /var/lib/apt/lists | sha256sum | cut -f 1 -d ' ' >> $GITHUB_OUTPUT
- name: Restore apt archives
uses: actions/cache/restore@v3
with:
path: apt-archives
key: ${{ env.ImageOS }}-apt-${{ steps.apt-cache.outputs.hash }}
restore-keys: |
${{ env.ImageOS }}-apt-
- name: Install OS dependencies
run: |
env
sudo mkdir -p /etc/postgresql-common/createcluster.d/
echo "create_main_cluster = false" | \
sudo tee /etc/postgresql-common/createcluster.d/override.conf
mkdir -p apt-archives
sudo cp -a apt-archives /var/cache/apt/archives
sudo apt-get install -y python3-dev postgresql
cp -a /var/cache/apt/archives/*.deb apt-archives
- name: Save apt archives
uses: actions/cache/save@v3
with:
path: apt-archives
key: ${{ env.ImageOS }}-apt-${{ steps.apt-cache.outputs.hash }}
- name: Get pip cache dir
id: pip-cache
run: |
Expand All @@ -19,13 +46,8 @@ jobs:
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt', 'requirements_test.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
- name: Install OS dependencies
run: |
echo "$HOME/.local/bin" >> $GITHUB_PATH
sudo mkdir -p /etc/postgresql-common/createcluster.d/
echo "create_main_cluster = false" | \
sudo tee /etc/postgresql-common/createcluster.d/override.conf
sudo apt-get update
sudo apt-get install -y python3-dev postgresql
pip install -r requirements.txt -r requirements_test.txt
- run: pytest

0 comments on commit 0c81725

Please sign in to comment.