-
Notifications
You must be signed in to change notification settings - Fork 288
138 lines (124 loc) · 4.57 KB
/
main.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
# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [master]
pull_request:
branches: [master]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
lint:
# The type of runner that the job will run on
runs-on: ubuntu-latest
steps:
- name: checkout repo
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.11
#----------------------------------------------
# ----- install & configure poetry -----
#----------------------------------------------
- name: Install and configure Poetry
uses: snok/install-poetry@v1
with:
version: 1.8.4
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Install dependencies
run: poetry install --no-interaction --no-root
#----------------------------------------------
# install your root project
#----------------------------------------------
- name: Install library
run: poetry install --no-interaction
- name: Run linters
run: |
make lint
tests:
# The type of runner that the job will run on
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# first list entry: lower bound, second list entry: upper bound
# of the supported python versions, versions in between are assumed
# to be supported as well without further testing
python-version: [3.9, 3.13]
os: [ubuntu-latest, windows-latest, macos-latest]
defaults:
run:
shell: bash
steps:
- name: checkout repo
uses: actions/checkout@v4
- name: Set up Python 3.9
id: setup-python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
#----------------------------------------------
# ----- install & configure poetry -----
#----------------------------------------------
- name: Install and configure Poetry
uses: snok/install-poetry@v1
with:
version: 1.8.4
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
#----------------------------------------------
# load cached venv if cache exists
#----------------------------------------------
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
#----------------------------------------------
# install dependencies if cache does not exist
#----------------------------------------------
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
#----------------------------------------------
# install your root project
#----------------------------------------------
- name: Install library
run: poetry install --no-interaction
- name: Run all tests
if: matrix.os == 'ubuntu-latest'
run: |
make tests-parallel
- name: Run unit tests
if: matrix.os != 'ubuntu-latest'
run: |
make unit-tests
- name: Upload html coverage
uses: actions/upload-artifact@v4
with:
name: coverage-html-${{ runner.os }}-${{ matrix.python-version }}
path: htmlcov
include-hidden-files: true
if-no-files-found: error
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
# Do not upload/fail for PRs in forks
if: github.repository == 'michaelhly/solana-py'
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: ${{ runner.os }},${{ runner.arch }},${{ matrix.python-version }}
# Specify whether or not CI build should fail if Codecov runs into an error during upload
fail_ci_if_error: true
test:
# https://github.community/t/is-it-possible-to-require-all-github-actions-tasks-to-pass-without-enumerating-them/117957/4?u=graingert
runs-on: ubuntu-latest
needs: tests
steps:
- name: note that all tests succeeded
run: echo "🎉"