CI: Add nightly workflow for CLN master; update main workflow to use latest CLN release #1925
Workflow file for this run
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
name: Integration Tests (latest) | |
# Cancel duplicate jobs | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
jobs: | |
build-and-test: | |
name: Test PY=${{ matrix.python-version }}, BCD=${{ matrix.bitcoind-version }}, EXP=${{ matrix.experimental }}, DEP=${{ matrix.deprecated }} | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
bitcoind-version: ["26.0"] | |
experimental: [1] | |
deprecated: [0] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Download Bitcoin ${{ matrix.bitcoind-version }} & install binaries | |
run: | | |
export BITCOIND_VERSION=${{ matrix.bitcoind-version }} | |
wget https://bitcoincore.org/bin/bitcoin-core-${BITCOIND_VERSION}/bitcoin-${BITCOIND_VERSION}-x86_64-linux-gnu.tar.gz | |
tar -xzf bitcoin-${BITCOIND_VERSION}-x86_64-linux-gnu.tar.gz | |
sudo mv bitcoin-${BITCOIND_VERSION}/bin/* /usr/local/bin | |
rm -rf bitcoin-${BITCOIND_VERSION}-x86_64-linux-gnu.tar.gz bitcoin-${BITCOIND_VERSION} | |
- name: Download Core Lightning latest & install binaries | |
id: cln-latest-install | |
run: | | |
url=$(curl -s https://api.github.com/repos/ElementsProject/lightning/releases/latest \ | |
| jq '.assets[] | select(.name | contains("22.04")) | .browser_download_url' \ | |
| tr -d '\"') | |
wget $url | |
sudo tar -xvf ${url##*/} -C /usr/local --strip-components=2 | |
echo "CLN_VERSION=$(lightningd --version)" >> "$GITHUB_OUTPUT" | |
- name: Checkout Core Lightning latest | |
uses: actions/checkout@v4 | |
with: | |
repository: 'ElementsProject/lightning' | |
path: 'lightning' | |
ref: ${{ steps.cln-latest-install.outputs.CLN_VERSION }} | |
fetch-depth: 0 # Fetch all history for all branches and tags | |
submodules: 'recursive' | |
- name: Install Core Lightning Python package dependencies | |
run: | | |
sudo apt-get install -y \ | |
python3 \ | |
python3-pip \ | |
cd lightning | |
pip3 install --user -U \ | |
pip \ | |
poetry \ | |
wheel \ | |
blinker \ | |
pytest-custom-exit-code==0.3.0 \ | |
pytest-json-report | |
poetry install | |
poetry update | |
poetry export --without-hashes -f requirements.txt --output requirements.txt | |
pip install --user -U -r requirements.txt | |
pip install --user contrib/pyln-client contrib/pyln-testing flaky | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Run pytest tests | |
run: | | |
export CLN_PATH=${{ github.workspace }}/lightning | |
export COMPAT=${{ matrix.deprecated }} | |
export EXPERIMENTAL_FEATURES=${{ matrix.experimental }} | |
export SLOW_MACHINE=1 | |
export TEST_DEBUG=1 | |
export TRAVIS=1 | |
export VALGRIND=0 | |
pip3 install --upgrade pip | |
pip3 install --user -U virtualenv pip > /dev/null | |
# Fetch and checkout branches to permit the 'git diff' below. | |
git fetch && git checkout ${{ github.base_ref }} | |
# In the case of a pull request, `git fetch` the source repository, but only if it is an external one. | |
source_repo="${{ github.event.pull_request.head.repo.full_name }}" | |
if [[ $source_repo != '' && $source_repo != ${{ github.repository }} ]]; then | |
echo "Source repository name is $source_repo" | |
git fetch https://github.com/$source_repo.git ${{ github.head_ref }}:${{ github.head_ref }} | |
fi | |
git checkout ${{ github.head_ref }} | |
# In the case of a pull request, collect the plugins that have changed by doing a `git diff` between | |
# the target branch and the source branch. | |
plugin_dirs='' | |
if [[ ${{ github.event_name }} == 'pull_request' ]]; then | |
echo "Using 'git diff ${{ github.base_ref }} ${{ github.head_ref }}' to check which plugin(s) changed." | |
plugin_dirs=$(git diff --name-only ${{ github.base_ref }} ${{ github.head_ref }} \ | |
| cut -d "/" -f1 \ | |
| uniq \ | |
| grep -v '^\.' \ | |
| grep -v 'archived' \ | |
| while read -r line; do [ -d "$line" ] && echo $line; done) | |
fi | |
# Run the tests | |
# In the case of a 'push' event `plugin_dirs` will be empty and all plugins are going to be tested. | |
python3 .ci/test.py $(echo "$plugin_dirs") | |
gather: | |
# A dummy task that depends on the full matrix of tests, and | |
# signals successful completion. Used for the PR status to pass | |
# before merging. | |
name: CI completion | |
runs-on: ubuntu-22.04 | |
needs: | |
- build-and-test | |
steps: | |
- name: Complete | |
run: | | |
echo CI completed successfully |