forked from zenml-io/mlstacks
-
Notifications
You must be signed in to change notification settings - Fork 0
114 lines (101 loc) · 3.32 KB
/
lint-unit-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
name: Lint, Unit Test & Upload Coverage
on:
workflow_call:
inputs:
os:
description: 'OS'
type: string
required: true
python-version:
description: 'Python version'
type: string
required: true
enable_tmate:
description: 'Enable tmate session for debugging'
type: string
required: false
default: "never"
workflow_dispatch:
inputs:
os:
description: 'OS'
type: choice
options:
- ubuntu-latest
- macos-latest
- windows-latest
required: false
default: 'ubuntu-latest'
python-version:
description: 'Python version'
type: choice
options:
- '3.8'
- '3.9'
- '3.10'
- '3.11'
required: false
default: '3.8'
enable_tmate:
description: 'Enable tmate session for debugging'
type: choice
options:
- 'no'
- 'on-failure'
- 'always'
- 'before-tests'
required: false
default: 'no'
jobs:
lint-unit-tests:
name: lint-unit-tests
runs-on: ${{ inputs.os }}
env:
PYTHONIOENCODING: "utf-8"
# on MAC OS, we need to set this environment variable
# to fix problems with the fork() calls (see this thread
# for more information: http://sealiesoftware.com/blog/archive/2017/6/5/Objective-C_and_fork_in_macOS_1013.html)
OBJC_DISABLE_INITIALIZE_FORK_SAFETY: "YES"
# Exit if it's a commit from Gitbook
if: ${{ ! startsWith(github.event.head_commit.message, 'GitBook:') }}
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v3
- name: Setup environment
uses: ./.github/actions/setup_environment
with:
python-version: ${{ inputs.python-version }}
os: ${{ inputs.os }}
- name: Setup tmate session before tests
if: ${{ inputs.enable_tmate == 'before-tests' }}
uses: mxschmitt/action-tmate@v3
- name: Lint check
run: |
bash scripts/lint.sh
- name: Docstring check
run: bash scripts/docstring.sh
# Only run the docstring check on ubuntu-latest and python 3.8
if: ${{ inputs.os == 'ubuntu-latest' && inputs.python-version == '3.8' }}
# - name: Markdown link check
# uses: gaurav-nelson/github-action-markdown-link-check@v1
# with:
# use-quiet-mode: 'yes'
# use-verbose-mode: 'no'
# folder-path: './examples, ./docs/book, ./src'
# file-path: './README.md, ./LICENSE, ./RELEASE_NOTES.md, CODE-OF-CONDUCT.md, CONTRIBUTING.md, CLA.md, RELEASE_NOTES.md, ROADMAP.md'
# config-file: .github/workflows/markdown_check_config.json
# continue-on-error: true
# # Only run the markdown link check on ubuntu-latest and python 3.8
# if: ${{ inputs.os == 'ubuntu-latest' && inputs.python-version == '3.8' }}
- name: Run unit tests
run: |
bash scripts/run-tests.sh
- name: Setup tmate session after tests
if: ${{ inputs.enable_tmate == 'always' || (inputs.enable_tmate == 'on-failure' && failure()) }}
uses: mxschmitt/action-tmate@v3
- name: Verify Python Env unaffected
run: |
pip list
pip check || true