Skip to content

Commit

Permalink
clean github workflow files
Browse files Browse the repository at this point in the history
  • Loading branch information
Ouziel committed Feb 12, 2025
1 parent 3e1b8e1 commit dad28a4
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 48 deletions.
93 changes: 53 additions & 40 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,63 +9,76 @@ concurrency:
cancel-in-progress: true

jobs:

mainnet-tests:
if: github.ref == 'refs/heads/develop'
Test:
strategy:
fail-fast: false
# define the matrix
matrix:

# Units tests

name: ["Units And Functionals Test"]
python-version: ["3.10", "3.11", "3.12", "3.13"]
os: ["ubuntu-22.04", "macos-14"]
test-path: ["units counterpartycore/test/functionals"]
include:
- test-path: integrations/load_test.py

# Mainnet tests

- name: Mainnet API Load
test-path: integrations/load_test.py
os: Linux-Large-1
- test-path: integrations/main_test.py
run_coveralls: false
only_on_develop: true

- name: Mainnet Bootstrap And Catchup
test-path: integrations/main_test.py
os: Linux-Large-2
uses: ./.github/workflows/pytest_action.yml
with:
os: ${{ matrix.os }}
test-path: ${{ matrix.test-path }}
run_coveralls: false
secrets: inherit
run_coveralls: false
only_on_develop: true

ubuntu-test:
strategy:
fail-fast: false
matrix:
include:
- test-path: integrations/regtest/scenarios_test.py
# Regtest tests

- name: Regtest Scenarios
test-path: integrations/regtest/scenarios_test.py
install_bitcoin: true
- test-path: integrations/regtest/property_test.py

- name: Property Test
test-path: integrations/regtest/property_test.py
install_bitcoin: true
- test-path: integrations/testnet4_test.py
- test-path: integrations/reparse_test.py
- test-path: integrations/dockercompose_test.py
- test-path: integrations/comparehashes_test.py
- test-path: integrations/testnet4sync_test.py
uses: ./.github/workflows/pytest_action.yml
with:
test-path: ${{ matrix.test-path }}
install_bitcoin: ${{ matrix.install_bitcoin || false }}
secrets: inherit

multiplaform-test:
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
os: ["ubuntu-22.04", "macos-14"]
test-path:
- units counterpartycore/test/functionals
# Testnet4 tests

- name: Testnet4 Bootstrap And Catchup
test-path: integrations/testnet4_test.py

- name: Testnet4 Full Sync
test-path: integrations/testnet4sync_test.py

# Other tests

- name: Docker Compose
test-path: integrations/dockercompose_test.py

- name: Compare Hashes
test-path: integrations/comparehashes_test.py

# run pytest_action.yml for the matrix
uses: ./.github/workflows/pytest_action.yml
with:
python-version: ${{ matrix.python-version }}
name: ${{ matrix.name }} (${{ matrix.os }} - Python ${{ matrix.python-version }})
test-path: ${{ matrix.test-path }}
os: ${{ matrix.os || 'ubuntu-22.04' }}
python-version: ${{ matrix.python-version || '3.11' }}
install_bitcoin: ${{ matrix.install_bitcoin || false }}
run_coveralls: ${{ matrix.run_coveralls || true }}
only_on_develop: ${{ matrix.only_on_develop || false }}
secrets: inherit

# finish the coveralls
coveralls:
if: ${{ always() }}
needs:
- ubuntu-test
- multiplaform-test
- Test
runs-on: ubuntu-latest
container: python:3-slim
steps:
Expand Down
19 changes: 15 additions & 4 deletions .github/workflows/pytest_action.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
name: Base Test Configuration
name: Pytest Action

on:
workflow_call:
inputs:
name:
type: string
default: "Pytest"
python-version:
type: string
default: "3.11"
Expand All @@ -18,10 +21,15 @@ on:
run_coveralls:
type: boolean
default: true
only_on_develop:
type: boolean
default: false

jobs:
pytest:
name: ${{ inputs.name }}
runs-on: ${{ inputs.os }}
if: ${{ !inputs.only_on_develop || github.ref == 'refs/heads/develop' }}
steps:
- uses: actions/checkout@v4

Expand All @@ -41,6 +49,8 @@ jobs:
run: |
# pip install --upgrade pytest hatchling==1.25.0 hatch==1.13.0 pytest-cov coveralls
pip install --upgrade pytest hatchling hatch pytest-cov coveralls
cd counterparty-rs && pip install -e . && cd ..
cd counterparty-core && pip install -e . && cd ..
- name: Install Bitcoin & Electrs
if: inputs.install_bitcoin
Expand All @@ -57,15 +67,16 @@ jobs:
- name: Run tests
run: |
cd counterparty-core
hatch run pytest counterpartycore/test/${{ inputs.test-path }} \
--cov=../counterparty-core/counterpartycore/lib --cov-report=
mv .coverage* ../
COV_CORE_SOURCE=counterpartycore/lib pytest counterpartycore/test/${{ inputs.test-path }} \
--cov=counterpartycore/lib --cov-report=term-missing --cov-report=
mv .coverage ../
- name: Upload coverage
if: inputs.run_coveralls
run: |
ls -al
coveralls debug --service=github
coveralls --service=github --verbose --srcdir=counterparty-core/counterparty-core/
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_SERVICE_NAME: github
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/scanners.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ concurrency:
cancel-in-progress: true

jobs:
licenses:
uses: ./.github/workflows/_scanner_licenses.yml

ruff:
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion counterparty-core/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["hatchling==1.14.0", "hatch-requirements-txt==0.4.0"]
requires = ["hatchling", "hatch-requirements-txt"]
build-backend = "hatchling.build"

[project]
Expand Down

0 comments on commit dad28a4

Please sign in to comment.