|
| 1 | +# yamllint disable rule:line-length |
| 2 | +name: sandbox-tests |
| 3 | +on: # yamllint disable-line rule:truthy |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + - dev |
| 8 | + tags: |
| 9 | + - v* |
| 10 | + pull_request: |
| 11 | +concurrency: |
| 12 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 13 | + cancel-in-progress: true |
| 14 | +jobs: |
| 15 | + test: |
| 16 | + runs-on: ubuntu-22.04 |
| 17 | + timeout-minutes: 180 # Building Python takes time |
| 18 | + steps: |
| 19 | + - name: Checkout hathor-core |
| 20 | + uses: actions/checkout@v4 |
| 21 | + |
| 22 | + - name: Install build dependencies |
| 23 | + run: | |
| 24 | + sudo apt-get -qy update |
| 25 | + sudo apt-get -qy install build-essential libssl-dev zlib1g-dev \ |
| 26 | + libbz2-dev libreadline-dev libsqlite3-dev libncurses5-dev \ |
| 27 | + libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev \ |
| 28 | + graphviz librocksdb-dev libsnappy-dev liblz4-dev |
| 29 | +
|
| 30 | + - name: Cache custom Python build |
| 31 | + uses: actions/cache@v4 |
| 32 | + id: python-cache |
| 33 | + with: |
| 34 | + path: ~/cpython-sandbox |
| 35 | + key: cpython-sandbox-${{ hashFiles('.github/workflows/sandbox-tests.yml') }} |
| 36 | + |
| 37 | + - name: Clone and build custom Python |
| 38 | + if: steps.python-cache.outputs.cache-hit != 'true' |
| 39 | + run: | |
| 40 | + git clone --depth 1 -b msbrogli/sandbox https://github.com/msbrogli/cpython.git ~/cpython-build |
| 41 | + cd ~/cpython-build |
| 42 | + ./configure --prefix=$HOME/cpython-sandbox --enable-optimizations |
| 43 | + make -j$(nproc) |
| 44 | + make install |
| 45 | +
|
| 46 | + - name: Setup custom Python in PATH |
| 47 | + run: | |
| 48 | + echo "$HOME/cpython-sandbox/bin" >> $GITHUB_PATH |
| 49 | +
|
| 50 | + - name: Install Poetry |
| 51 | + run: | |
| 52 | + $HOME/cpython-sandbox/bin/python3 -m pip install --upgrade pip |
| 53 | + $HOME/cpython-sandbox/bin/python3 -m pip install poetry |
| 54 | +
|
| 55 | + - name: Cache mypy |
| 56 | + uses: actions/cache@v4 |
| 57 | + with: |
| 58 | + path: .mypy_cache |
| 59 | + key: ${{ runner.os }}-sandbox-mypy-${{ github.head_ref || github.ref }} |
| 60 | + restore-keys: | |
| 61 | + ${{ runner.os }}-sandbox-mypy-refs/heads/dev- |
| 62 | + ${{ runner.os }}-sandbox-mypy- |
| 63 | +
|
| 64 | + - name: Install dependencies |
| 65 | + run: | |
| 66 | + poetry env use $HOME/cpython-sandbox/bin/python3 |
| 67 | + poetry install -n --no-root |
| 68 | +
|
| 69 | + - name: Run linters |
| 70 | + run: poetry run make check |
| 71 | + |
| 72 | + - name: Run tests |
| 73 | + run: poetry run make tests |
0 commit comments