1---
2name: Mac OS pytest
3on: [pull_request]
4jobs:
5  smoke-test:
6    name: Smoke Test macOS
7    runs-on: macos-latest
8    env:
9      DEVELOPER: 1
10      VALGRIND: 0
11      EXPERIMENTAL_FEATURES: 1
12      COMPAT: 0
13    strategy:
14      fail-fast: true
15    steps:
16      - name: Checkout
17        uses: actions/checkout@v2.0.0
18
19      - name: Fetch tags for auto versioning
20        run: git fetch --prune --unshallow --tags
21
22      - name: Set up Python 3.6
23        uses: actions/setup-python@v2
24        with:
25          python-version: 3.6
26
27      - name: Install dependencies
28        run: |
29          export BITCOIN_VERSION=0.20.1
30          brew install wget python autoconf automake libtool python3 gmp gnu-sed gettext libsodium
31
32          (
33            cd /tmp/
34            wget https://storage.googleapis.com/c-lightning-tests/bitcoin-$BITCOIN_VERSION-osx64.tar.gz -O bitcoin.tar.gz
35            tar -xvzf bitcoin.tar.gz
36            sudo mv bitcoin-$BITCOIN_VERSION/bin/* /usr/local/bin
37          )
38
39          pip install --upgrade mako pip
40          ln -s /usr/local/Cellar/gettext/0.20.1/bin/xgettext /usr/local/opt
41          export PATH="/usr/local/opt:$PATH"
42
43      - name: Build
44        env:
45          VALGRIND: ${{ matrix.VALGRIND }}
46          DEVELOPER: ${{ matrix.DEVELOPER }}
47          EXPERIMENTAL_FEATURES: ${{ matrix.EXPERIMENTAL_FEATURES }}
48          COMPILER: ${{ matrix.COMPILER }}
49          COMPAT: ${{ matrix.COMPAT }}
50          PYTEST_PAR: ${{ matrix.PYTEST_PAR }}
51          PYTEST_OPTS: ${{ matrix.PYTEST_OPTS }}
52          NO_PYTHON: ${{ matrix.NO_PYTHON }}
53          COPTFLAGS: ${{ matrix.COPTFLAGS }}
54          NETWORK: ${{ matrix.NETWORK }}
55          TEST_CMD: ${{ matrix.TEST_CMD }}
56          TEST_GROUP_COUNT: ${{ matrix.TEST_GROUP_COUNT }}
57          TEST_GROUP: ${{ matrix.TEST_GROUP }}
58        run: |
59          export PATH="/usr/local/opt:/Users/runner/.local/bin:$PATH"
60          export LDFLAGS="-L/usr/local/opt/sqlite/lib"
61          export CPPFLAGS="-I/usr/local/opt/sqlite/include"
62
63          pip3 install --user -U \
64            -r requirements.lock
65
66          pip3 install --user --no-index \
67            --use-feature=in-tree-build \
68            ./contrib/pyln-spec/bolt7 \
69            ./contrib/pyln-client \
70            ./contrib/pyln-proto \
71            ./contrib/pyln-testing
72
73          # Install utilities that aren't dependencies, but make
74          # running tests easier/feasible on CI (and pytest which
75          # keeps breaking the rerunfailures plugin).
76          pip3 install --user -U \
77            blinker \
78            flake8 \
79            flaky \
80            mako \
81            pytest-sentry \
82            pytest-test-groups==1.0.3 \
83            pytest-custom-exit-code==0.3.0 \
84            pytest-json-report
85
86          cat << EOF > pytest.ini
87          [pytest]
88          addopts=-p no:logging --color=yes --timeout=600 --timeout-method=thread --test-group-random-seed=42 --force-flaky --no-success-flaky-report --max-runs=3 --junitxml=report.xml --json-report --json-report-file=report.json --json-report-indent=2
89          markers =
90              slow_test: marks tests as slow (deselect with '-m "not slow_test"')
91          EOF
92
93          ./configure
94          make
95
96      - name: Upload Unit Test Results
97        if: always()
98        uses: actions/upload-artifact@v2
99        with:
100          name: Junit Report ${{ github.run_number }}.${{ matrix.cfg }}
101          path: report.*
102          if-no-files-found: ignore
103