mirror of
https://github.com/daywalker90/cln-nip47.git
synced 2026-08-13 12:33:43 +02:00
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 6 to 7. - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](https://github.com/actions/setup-python/compare/v6...v7) --- updated-dependencies: - dependency-name: actions/setup-python dependency-version: '7' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
181 lines
6.5 KiB
YAML
181 lines
6.5 KiB
YAML
name: CI
|
|
|
|
# Cancel duplicate jobs
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
cln-version:
|
|
required: true
|
|
type: string
|
|
pyln-version:
|
|
required: true
|
|
type: string
|
|
tagged-release:
|
|
required: true
|
|
type: boolean
|
|
python-version-1:
|
|
required: true
|
|
type: string
|
|
python-version-2:
|
|
required: true
|
|
type: string
|
|
|
|
jobs:
|
|
build:
|
|
name: Test CLN=${{ inputs.cln-version }}, OS=${{ matrix.os }}, PY=${{ matrix.python-version }}, BCD=${{ matrix.bitcoind-version }}, EXP=${{ matrix.experimental }}, DEP=${{ matrix.deprecated }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
bitcoind-version: ["31.0"]
|
|
experimental: [1]
|
|
deprecated: [0]
|
|
python-version: [ "${{ inputs.python-version-1 }}", "${{ inputs.python-version-2 }}"]
|
|
os: ["ubuntu-latest"]
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v7
|
|
|
|
- name: Create cache paths
|
|
run: |
|
|
sudo mkdir /usr/local/libexec
|
|
sudo mkdir /usr/local/libexec/c-lightning
|
|
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@v7
|
|
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: Restore CLN cache
|
|
id: cache-cln
|
|
uses: actions/cache/restore@v6
|
|
with:
|
|
path: |
|
|
/usr/local/bin/lightning*
|
|
/usr/local/libexec/c-lightning
|
|
key: cache-cln-${{ inputs.cln-version }}-${{ steps.exact_versions.outputs.os_version }}
|
|
|
|
- name: Restore bitcoind cache
|
|
id: cache-bitcoind
|
|
uses: actions/cache/restore@v6
|
|
with:
|
|
path: /usr/local/bin/bitcoin*
|
|
key: cache-bitcoind-${{ matrix.bitcoind-version }}-${{ steps.exact_versions.outputs.os_version }}
|
|
|
|
- name: Install uv
|
|
uses: astral-sh/setup-uv@v7
|
|
with:
|
|
enable-cache: true
|
|
cache-dependency-glob: "**/pyproject.toml"
|
|
|
|
- name: Download Bitcoin ${{ matrix.bitcoind-version }} & install binaries
|
|
if: ${{ steps.cache-bitcoind.outputs.cache-hit != 'true' }}
|
|
run: |
|
|
export BITCOIND_VERSION=${{ matrix.bitcoind-version }}
|
|
export TARGET_ARCH="x86_64-linux-gnu"
|
|
wget --tries=5 --waitretry=5 --retry-connrefused --timeout=20 --continue https://bitcoincore.org/bin/bitcoin-core-${BITCOIND_VERSION}/bitcoin-${BITCOIND_VERSION}-${TARGET_ARCH}.tar.gz
|
|
tar -xzf bitcoin-${BITCOIND_VERSION}-${TARGET_ARCH}.tar.gz
|
|
sudo mv bitcoin-${BITCOIND_VERSION}/bin/* /usr/local/bin
|
|
rm -rf bitcoin-${BITCOIND_VERSION}-${TARGET_ARCH}.tar.gz bitcoin-${BITCOIND_VERSION}
|
|
|
|
- name: Save bitcoind cache
|
|
id: save-cache-bitcoind
|
|
if : ${{ success() && steps.cache-bitcoind.outputs.cache-hit != 'true'}}
|
|
uses: actions/cache/save@v6
|
|
with:
|
|
path: /usr/local/bin/bitcoin*
|
|
key: ${{ steps.cache-bitcoind.outputs.cache-primary-key }}
|
|
|
|
- name: Download Core Lightning ${{ inputs.cln-version }} & install binaries
|
|
if: ${{ contains(matrix.os, 'ubuntu') && steps.cache-cln.outputs.cache-hit != 'true' }}
|
|
run: |
|
|
url=$(curl -f --retry 3 --retry-delay 3 -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/ElementsProject/lightning/releases/tags/${{ inputs.cln-version }} \
|
|
| jq '.assets[] | select(.name | contains("24.04")) | .browser_download_url' \
|
|
| tr -d '\"')
|
|
wget --tries=5 --waitretry=5 --retry-connrefused --timeout=20 --continue $url
|
|
sudo tar -xvf ${url##*/} -C /usr/local --strip-components=2
|
|
echo "CLN_VERSION=$(lightningd --version)" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Save CLN cache
|
|
id: save-cache-cln
|
|
if : ${{ success() && steps.cache-cln.outputs.cache-hit != 'true' }}
|
|
uses: actions/cache/save@v6
|
|
with:
|
|
path: |
|
|
/usr/local/bin/lightning*
|
|
/usr/local/libexec/c-lightning
|
|
key: ${{ steps.cache-cln.outputs.cache-primary-key }}
|
|
|
|
- name: Set up Rust
|
|
if: ${{ inputs.tagged-release == false }}
|
|
uses: dtolnay/rust-toolchain@stable
|
|
|
|
- name: Install cargo-binstall
|
|
if: ${{ inputs.tagged-release == false }}
|
|
uses: taiki-e/install-action@cargo-binstall
|
|
|
|
- name: Install cargo-msrv
|
|
if: ${{ inputs.tagged-release == false }}
|
|
env:
|
|
GITHUB_TOKEN: ${{ github.token }}
|
|
run: cargo binstall --no-confirm cargo-msrv
|
|
|
|
- name: Verify MSRV
|
|
if: ${{ inputs.tagged-release == false }}
|
|
run: cargo msrv verify
|
|
|
|
- name: Get plugin binary
|
|
run: |
|
|
if ${{ inputs.tagged-release }}; then
|
|
cd tests
|
|
./setup.sh
|
|
cd ..
|
|
else
|
|
if [ -d "proto" ]; then
|
|
uv run python -m grpc_tools.protoc --proto_path="proto" --python_out="tests" --grpc_python_out="tests" proto/*.proto
|
|
fi
|
|
|
|
url=$(curl -f --retry 3 --retry-delay 3 -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/BoltzExchange/hold/releases/latest \
|
|
| jq '.assets[] | select(.name | endswith("linux-amd64.tar.gz")) | .browser_download_url' \
|
|
| tr -d '\"')
|
|
wget $url
|
|
tar -xvf ${url##*/} -C tests
|
|
mv "tests/build/hold-linux-amd64" "tests/hold"
|
|
|
|
cargo build
|
|
cargo test
|
|
fi
|
|
|
|
- name: Run 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
|
|
export PYTEST_TIMEOUT=600
|
|
|
|
cd tests
|
|
tar -xf nostr-rs-relay.tar.gz
|
|
uv add --dev pyln-testing==${{ inputs.pyln-version }} pyln-client==${{ inputs.pyln-version }} pyln-proto==${{ inputs.pyln-version }}
|
|
uv run -v pytest -n=10
|