Skip to content

Commit 4b9982a

Browse files
committed
add github workflow for unit tests and linting
1 parent ed3c831 commit 4b9982a

File tree

2 files changed

+44
-1
lines changed

2 files changed

+44
-1
lines changed

.github/workflows/ci.yml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Run Python Tests
2+
on:
3+
push:
4+
branches:
5+
- main
6+
tags:
7+
- '*'
8+
pull_request:
9+
branches:
10+
- main
11+
# schedule:
12+
# # Run on Tuesdays at 5:59
13+
# - cron: '59 5 * * 2'
14+
workflow_dispatch:
15+
jobs:
16+
build-n-test:
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
os: [ubuntu-latest]
21+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
22+
runs-on: ${{ matrix.os }}
23+
steps:
24+
- uses: actions/checkout@v4
25+
- name: Set up Python ${{ matrix.python-version }}
26+
uses: actions/setup-python@v5
27+
with:
28+
python-version: ${{ matrix.python-version }}
29+
- name: Install dependencies
30+
run: |
31+
python -m ensurepip --upgrade
32+
python -m pip install --upgrade setuptools
33+
python -m pip install --upgrade pip
34+
python -m pip install flake8
35+
python -m pip install .[test]
36+
- name: Lint with flake8
37+
run: |
38+
# stop the build if there are Python syntax errors or undefined names
39+
python -m flake8 --count --select=E9,F63,F7,F82 --show-source --statistics
40+
# exit-zero treats all errors as warnings
41+
python -m flake8 --count --exit-zero --statistics
42+
- name: Run tests with pytest
43+
run: python -m pytest

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"swa_gaussian>=0.1.6"
2424
],
2525
extras_require={
26-
"test": ["datasets", "nose", "sentencepiece"]
26+
"test": ["datasets", "pytest", "sentencepiece"]
2727
},
2828
classifiers=[
2929
"Development Status :: 3 - Alpha",

0 commit comments

Comments
 (0)