Merge pull request #228 from Chia-Network/develop #223
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: Tests | |
on: | |
push: | |
branches: | |
- main | |
- stage | |
pull_request: | |
branches: | |
- "**" | |
jobs: | |
test: | |
name: Python tests | |
runs-on: ubuntu-latest | |
env: | |
CHIA_ROOT: ${{ github.workspace }}/.chia/mainnet | |
CHIA_SIMULATOR_ROOT: ${{ github.workspace }}/.chia/simulator | |
BLOCKS_AND_PLOTS_VERSION: 0.35.0 | |
steps: | |
- name: Clean workspace | |
uses: Chia-Network/actions/clean-workspace@main | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Setup Python | |
uses: Chia-Network/actions/setup-python@main | |
with: | |
python-version: "3.10" | |
- name: Create virtual environment | |
uses: Chia-Network/actions/create-venv@main | |
id: create-venv | |
- name: Activate virtual environment | |
uses: Chia-Network/actions/activate-venv@main | |
with: | |
directories: ${{ steps.create-venv.outputs.activate-venv-directories }} | |
- name: Run poetry install | |
uses: Chia-Network/actions/poetry@main | |
with: | |
poetry-command: "install --with dev" | |
- name: Cache test blocks and plots | |
uses: actions/cache@v3 | |
env: | |
SEGMENT_DOWNLOAD_TIMEOUT_MIN: 1 | |
id: test-blocks-plots | |
with: | |
path: | | |
${{ github.workspace }}/.chia/blocks | |
${{ github.workspace }}/.chia/test-plots | |
key: ${{ env.BLOCKS_AND_PLOTS_VERSION }} | |
- name: Checkout test blocks and plots | |
if: steps.test-blocks-plots.outputs.cache-hit != 'true' | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
gh release download ${{ env.BLOCKS_AND_PLOTS_VERSION }} -R Chia-Network/test-cache --archive=tar.gz -O - | tar xzf - | |
mkdir "${GITHUB_WORKSPACE}/.chia" | |
mv "${GITHUB_WORKSPACE}/test-cache-${{ env.BLOCKS_AND_PLOTS_VERSION }}/"* "${GITHUB_WORKSPACE}/.chia" | |
- name: Run Python tests | |
env: | |
MODE: dev | |
PYTHONPATH: ".:./chia-blockchain" | |
run: | | |
chia init | |
chia version | |
python -m pytest tests |