Skip to content

Commit

Permalink
CI: cache python deps
Browse files Browse the repository at this point in the history
  • Loading branch information
daywalker90 committed Jun 29, 2024
1 parent 54f918e commit 458a1c6
Showing 1 changed file with 29 additions and 8 deletions.
37 changes: 29 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,43 @@ jobs:
sudo mkdir /usr/local/libexec/c-lightning/plugins
sudo chown -R $USER /usr/local/libexec
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Extract exact python and os version
id: exact_versions
run: |
PYTHON_VERSION=$(python --version 2>&1 | grep -oP '(?<=Python )\d+\.\d+(\.\d+)?')
echo "Python version: $PYTHON_VERSION"
echo "python_version=$PYTHON_VERSION" >> "$GITHUB_OUTPUT"
OS_VERSION=$(lsb_release -rs)
echo "OS version: $OS_VERSION"
echo "os_version=$OS_VERSION" >> $GITHUB_OUTPUT
- name: Cache CLN
id: cache-cln
uses: actions/cache@v4
with:
path: |
/usr/local/bin/lightning*
/usr/local/libexec/c-lightning
key: cache-cln-${{ inputs.cln-version }}-${{ runner.os }}
key: cache-cln-${{ inputs.cln-version }}-${{ steps.exact_versions.outputs.os_version }}

- name: Cache bitcoind
id: cache-bitcoind
uses: actions/cache@v4
with:
path: /usr/local/bin/bitcoin*
key: cache-bitcoind-${{ matrix.bitcoind-version }}-${{ runner.os }}
key: cache-bitcoind-${{ matrix.bitcoind-version }}-${{ steps.exact_versions.outputs.os_version }}

- name: Cache python dependencies
id: cache-python
uses: actions/cache@v4
with:
path: venv
key: cache-python-${{ matrix.bitcoind-version }}-${{ steps.exact_versions.outputs.python_version }}-${{ steps.exact_versions.outputs.os_version }}-${{ inputs.pyln-version }}-${{ hashFiles('tests/requirements.txt') }}

- name: Download Bitcoin ${{ matrix.bitcoind-version }} & install binaries
if: ${{ steps.cache-bitcoind.outputs.cache-hit != 'true' }}
Expand Down Expand Up @@ -94,11 +116,6 @@ jobs:
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Checkout Core Lightning ${{ inputs.cln-version }}
if: ${{ contains(matrix.os, 'macos') && steps.cache-cln.outputs.cache-hit != 'true' }}
uses: actions/checkout@v4
Expand All @@ -108,11 +125,15 @@ jobs:
ref: ${{ inputs.cln-version }}
submodules: 'recursive'

- name: Install Python and System dependencies
- name: Install System dependencies
run: |
if [[ "${{ matrix.os }}" =~ "macos" ]]; then
brew install autoconf automake libtool gnu-sed gettext libsodium sqlite
fi
- name: Install Python dependencies
if: ${{ steps.cache-python.outputs.cache-hit != 'true' }}
run: |
python -m venv venv
source venv/bin/activate
python -m pip install -U pip poetry wheel
Expand Down

0 comments on commit 458a1c6

Please sign in to comment.