11# yamllint disable rule:line-length
2- name : tests
2+ name : ci
33on : # yamllint disable-line rule:truthy
44 push :
55 branches :
@@ -52,14 +52,14 @@ jobs:
5252 echo $matrix
5353 echo $matrix | jq .
5454 echo $matrix | json2yaml
55- test :
56- name : python- ${{ matrix.python }} (${{ matrix.os }})
55+ lint :
56+ name : lint py ${{ matrix.python }} (${{ matrix.os }})
5757 runs-on : ${{ matrix.os }}
5858 needs : matrix
59- timeout-minutes : 120 # default is 360
59+ timeout-minutes : 30
6060 strategy :
6161 fail-fast : false
62- matrix : ${{fromJson(needs.matrix.outputs.matrix)}}
62+ matrix : ${{ fromJson(needs.matrix.outputs.matrix) }}
6363 steps :
6464 - name : Checkout
6565 uses : actions/checkout@v4
@@ -79,10 +79,105 @@ jobs:
7979 ${{ runner.os }}-py${{ matrix.python }}-mypy-
8080 - name : Run linters
8181 run : poetry run make check
82- - name : Run tests
83- run : poetry run make tests
82+ test-cli :
83+ name : test-cli py${{ matrix.python }} (${{ matrix.os }})
84+ runs-on : ${{ matrix.os }}
85+ needs : matrix
86+ timeout-minutes : 30
87+ strategy :
88+ fail-fast : false
89+ matrix : ${{ fromJson(needs.matrix.outputs.matrix) }}
90+ steps :
91+ - name : Checkout
92+ uses : actions/checkout@v4
93+ - uses : ./.github/actions/setup-hathor-env
94+ name : Setup Hathor node environment
95+ with :
96+ python : ${{ matrix.python }}
97+ os : ${{ matrix.os }}
98+ - name : Run CLI tests
99+ run : poetry run make tests-cli
84100 - name : Upload coverage
85101 uses : codecov/codecov-action@v4
86102 if : matrix.python == 3.12 && startsWith(matrix.os, 'ubuntu')
103+ with :
104+ flags : test-cli
87105 env :
88106 CODECOV_TOKEN : ${{ secrets.CODECOV_TOKEN }}
107+ test-lib :
108+ name : test-lib py${{ matrix.python }} (${{ matrix.os }})
109+ runs-on : ${{ matrix.os }}
110+ needs : matrix
111+ timeout-minutes : 120
112+ strategy :
113+ fail-fast : false
114+ matrix : ${{ fromJson(needs.matrix.outputs.matrix) }}
115+ steps :
116+ - name : Checkout
117+ uses : actions/checkout@v4
118+ - uses : ./.github/actions/setup-hathor-env
119+ name : Setup Hathor node environment
120+ with :
121+ python : ${{ matrix.python }}
122+ os : ${{ matrix.os }}
123+ - name : Run lib tests
124+ run : poetry run make tests-lib
125+ - name : Upload coverage
126+ uses : codecov/codecov-action@v4
127+ if : matrix.python == 3.12 && startsWith(matrix.os, 'ubuntu')
128+ with :
129+ flags : test-lib
130+ env :
131+ CODECOV_TOKEN : ${{ secrets.CODECOV_TOKEN }}
132+ test-other :
133+ name : test-other py${{ matrix.python }} (${{ matrix.os }})
134+ runs-on : ${{ matrix.os }}
135+ needs : matrix
136+ timeout-minutes : 30
137+ strategy :
138+ fail-fast : false
139+ matrix : ${{ fromJson(needs.matrix.outputs.matrix) }}
140+ steps :
141+ - name : Checkout
142+ uses : actions/checkout@v4
143+ - uses : ./.github/actions/setup-hathor-env
144+ name : Setup Hathor node environment
145+ with :
146+ python : ${{ matrix.python }}
147+ os : ${{ matrix.os }}
148+ - name : Run genesis tests
149+ run : |
150+ HATHOR_TEST_CONFIG_YAML='./hathor/conf/mainnet.yml' poetry run pytest -n0 --cov=hathor hathor_tests/tx/test_genesis.py
151+ HATHOR_TEST_CONFIG_YAML='./hathor/conf/testnet.yml' poetry run pytest -n0 --cov=hathor --cov-append hathor_tests/tx/test_genesis.py
152+ HATHOR_TEST_CONFIG_YAML='./hathor/conf/nano_testnet.yml' poetry run pytest -n0 --cov=hathor --cov-append hathor_tests/tx/test_genesis.py
153+ - name : Run custom tests
154+ run : poetry run bash ./extras/custom_tests.sh
155+ - name : Run CI tests
156+ run : poetry run pytest --cov=hathor --cov-append extras/github/
157+ - name : Upload coverage
158+ uses : codecov/codecov-action@v4
159+ if : matrix.python == 3.12 && startsWith(matrix.os, 'ubuntu')
160+ with :
161+ flags : test-other
162+ env :
163+ CODECOV_TOKEN : ${{ secrets.CODECOV_TOKEN }}
164+ all-checks :
165+ name : all-checks
166+ runs-on : ubuntu-latest
167+ if : always()
168+ needs : [lint, test-cli, test-lib, test-other]
169+ steps :
170+ - name : Check job results
171+ run : |
172+ if [[ "${{ needs.lint.result }}" != "success" ||
173+ "${{ needs.test-cli.result }}" != "success" ||
174+ "${{ needs.test-lib.result }}" != "success" ||
175+ "${{ needs.test-other.result }}" != "success" ]]; then
176+ echo "One or more jobs failed or were cancelled:"
177+ echo " lint: ${{ needs.lint.result }}"
178+ echo " test-cli: ${{ needs.test-cli.result }}"
179+ echo " test-lib: ${{ needs.test-lib.result }}"
180+ echo " test-other: ${{ needs.test-other.result }}"
181+ exit 1
182+ fi
183+ echo "All checks passed!"
0 commit comments