-
Notifications
You must be signed in to change notification settings - Fork 143
132 lines (114 loc) · 3.83 KB
/
ci.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
name: CI
on:
pull_request:
types: [opened, synchronize]
push:
branches:
- master
env:
PYTHON_VERSION: '3.9'
jobs:
code-quality:
runs-on: ubuntu-latest
env:
SKIP: no-commit-to-branch # skips commit to main check
PRE_COMMIT_CONFIG: code_quality/.pre-commit-config.yaml
VENV: venv
VENV_ACTIVATE: venv/bin/activate
steps:
- name: Check out code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # V4.1.7
with:
token: ${{ github.token }}
- name: Cache pre-commit dependencies
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # V4.0.2
id: cache
with:
path: ~/.cache/pre-commit
key: ${{ runner.os }}-pre-commit-${{ hashFiles(env.PRE_COMMIT_CONFIG) }}
restore-keys: |
${{ runner.os }}-pre-commit-
- name: Install Requirements
run: python3 -m pip install docstr-coverage==2.3.2 pre-commit==3.7.1
- name: Code Quality
run: |
pre-commit run --config ${{ env.PRE_COMMIT_CONFIG }} --all-files
- name: Docstring Coverage
run: |
mkdir -p docs/badges/ docstr
mv code_quality/.docstr.yaml . # --config option didn't work
docstr-coverage 2>&1 | tee docstr/docstring_coverage.txt
ls docs/badges
commitlint:
runs-on: ubuntu-latest
name: Commitlint
steps:
- name: Run commitlint
uses: opensource-nepal/commitlint@v1
smoketest:
runs-on: ${{ matrix.os }}
name: Smoke Test
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
fail-fast: false
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Cache Poetry Install
id: cache-poetry
uses: actions/cache@v4
with:
path: |
~/.cache/pypoetry
.venv
${{ runner.os == 'windows-latest' && 'C:\\opt\\poetry' || (runner.os == 'macos-latest' && '$HOME/.poetry') || '/opt/poetry' }}
key: ${{ matrix.os }}-poetry-${{ hashFiles('**/poetry.lock') }}-${{ hashFiles('**/pyproject.toml')
}}
- name: Install Poetry on macOS
if: steps.cache-poetry.outputs.cache-hit != 'true' && runner.os == 'macOS'
run: |
export POETRY_HOME=$HOME/.poetry
python3 -m venv $POETRY_HOME
$POETRY_HOME/bin/pip install poetry==1.8.2
$POETRY_HOME/bin/poetry --version
shell: bash
- name: Install Poetry on Linux/macOS
if: steps.cache-poetry.outputs.cache-hit != 'true' && runner.os == 'Linux'
run: |
if [ $RUNNER_OS = 'macOS' ]; then
export POETRY_HOME=$HOME/.poetry
python3 -m venv $POETRY_HOME
$POETRY_HOME/bin/pip install poetry==1.8.2
$POETRY_HOME/bin/poetry --version
else
export POETRY_HOME=/opt/poetry
python3 -m venv $POETRY_HOME
$POETRY_HOME/bin/pip install poetry==1.8.2
$POETRY_HOME/bin/poetry --version
fi
- name: Install Poetry on Windows
if: steps.cache-poetry.outputs.cache-hit != 'true' && runner.os == 'Windows'
shell: pwsh
run: |
$POETRY_HOME = "C:\\opt\\poetry"
python -m venv $POETRY_HOME
$env:POETRY_HOME\Scripts\pip install poetry==1.8.2
$env:POETRY_HOME\Scripts\poetry --version
- name: Add Poetry to PATH
run: |
if [ $RUNNER_OS = 'Windows' ]; then
echo "C:\\opt\\poetry\\Scripts" >> $GITHUB_PATH
elif [ $RUNNER_OS = 'macOS' ]; then
echo "$HOME/.poetry/bin" >> $GITHUB_PATH
else
echo "/opt/poetry/bin" >> $GITHUB_PATH
fi
- name: Install Package
run: poetry install --no-interaction --no-ansi
- name: Verify Install
run: poetry run pikaraoke --help