forked from Chia-Network/chia-blockchain
-
Notifications
You must be signed in to change notification settings - Fork 1
153 lines (134 loc) · 4.77 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
name: 🧪 test
on:
push:
branches:
- long_lived/**
- main
- release/**
tags:
- '**'
pull_request:
branches:
- '**'
workflow_dispatch: null
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}--${{ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/heads/long_lived/')) && github.sha || '' }}
cancel-in-progress: true
jobs:
configure:
name: Configure matrix
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Python environment
uses: Chia-Network/actions/setup-python@main
with:
python-version: '3.9'
- name: Generate matrix configuration
id: configure
run: |
python tests/build-job-matrix.py --per directory --verbose > matrix.json
cat matrix.json
echo configuration=$(cat matrix.json) >> $GITHUB_OUTPUT
echo matrix_mode=${{ ( github.repository_owner == 'Chia-Network' && github.repository != 'Chia-Network/chia-blockchain' ) && 'limited' || 'all' }} >> $GITHUB_OUTPUT
outputs:
configuration: ${{ steps.configure.outputs.configuration }}
matrix_mode: ${{ steps.configure.outputs.matrix_mode }}
macos:
uses: ./.github/workflows/test-single.yml
needs: configure
with:
emoji: 🍎
matrix: macos
name: macOS
file_name: macos
concurrency_name: macos
configuration: ${{ needs.configure.outputs.configuration }}
matrix_mode: ${{ needs.configure.outputs.matrix_mode }}
runs-on: macos-latest
ubuntu:
uses: ./.github/workflows/test-single.yml
needs: configure
with:
emoji: 🐧
matrix: ubuntu
name: Ubuntu
file_name: ubuntu
concurrency_name: ubuntu
configuration: ${{ needs.configure.outputs.configuration }}
matrix_mode: ${{ needs.configure.outputs.matrix_mode }}
runs-on: ubuntu-latest
windows:
uses: ./.github/workflows/test-single.yml
needs: configure
with:
emoji: 🪟
matrix: windows
name: Windows
file_name: windows
concurrency_name: windows
configuration: ${{ needs.configure.outputs.configuration }}
matrix_mode: ${{ needs.configure.outputs.matrix_mode }}
runs-on: windows-latest
coverage:
name: ${{ matrix.os.emoji }} Coverage - ${{ matrix.python.name }}
runs-on: ${{ matrix.os.runs-on }}
needs:
- macos
- ubuntu
- windows
strategy:
fail-fast: false
matrix:
os:
- emoji: 🐧
matrix: ubuntu
name: Ubuntu
runs-on: ubuntu-latest
python:
- name: '3.9'
action: '3.9'
apt: '3.9'
install_sh: '3.9'
matrix: '3.9'
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Download Coverage
uses: actions/download-artifact@v3
with:
name: coverage-data
path: coverage-data
- name: Set up ${{ matrix.python.name }}
uses: Chia-Network/actions/setup-python@main
with:
python-version: ${{ matrix.python.action }}
- uses: ./.github/actions/install
with:
python-version: ${{ matrix.python.action }}
development: true
- uses: chia-network/actions/activate-venv@main
- name: Coverage Processing
run: |
coverage combine --rcfile=.coveragerc --data-file coverage-reports/.coverage coverage-data/
coverage xml --rcfile=.coveragerc --data-file coverage-reports/.coverage -o coverage-reports/coverage.xml
coverage html --rcfile=.coveragerc --data-file coverage-reports/.coverage --directory coverage-reports/html/
- name: Coverage report (chia/)
run: |
coverage report --rcfile=.coveragerc --data-file coverage-reports/.coverage --include='chia/*' --show-missing | tee coverage-reports/coverage-chia-stdout
- name: Coverage report (tests/)
run: |
coverage report --rcfile=.coveragerc --data-file coverage-reports/.coverage --include='tests/*' --show-missing | tee coverage-reports/coverage-tests-stdout
# needs some debugging since it just reports no changes
# - name: Coverage report (diff)
# run: |
# diff-cover --compare-branch=${{ fromJSON(format('[{0}, {1}]', toJSON(github.event.before), toJSON(format('origin/{0}', github.base_ref))))[github.base_ref != ''] }} coverage-reports/coverage.xml | tee coverage-reports/diff-cover-stdout
- name: Publish coverage reports
if: always()
uses: actions/upload-artifact@v3
with:
name: coverage-reports
path: coverage-reports/*
if-no-files-found: error