11name : Lint, test, and publish
22
3- on : [ push]
3+ on : push
44
55jobs :
6- lint-test :
6+ lint-format :
77 runs-on : ubuntu-latest
88 steps :
99 - uses : actions/checkout@v4
@@ -12,29 +12,24 @@ jobs:
1212 uses : actions/setup-python@v5
1313 with :
1414 python-version : " 3.11"
15+ cache : " poetry"
1516
1617 - name : Install dependencies
17- run : |
18- python -m pip install --upgrade pip
19- pip install -r requirements-dev.txt
20- pip install .
18+ run : poetry install --with=dev
2119
22- - name : Lint with flake8
23- run : flake8 mitreattack/ --count -- exit-zero --statistics
20+ - name : Lint with ruff
21+ run : ruff check --exit-zero --output-format github
2422
25- # should turn these back on once they take less than 10 minutes to run
26- # - name: Run pytest
27- # run: |
28- # cd tests
29- # pytest --cov=mitreattack --cov-report html
23+ - name : Check ruff format
24+ run : ruff format --check
3025
3126 publish :
32- needs : lint-test
27+ needs : lint-format
3328 if : github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
3429 runs-on : ubuntu-latest
35- # required for PyPI Trusted Publisher setup
36- # https://docs.pypi.org/trusted-publishers/using-a-publisher/
3730 environment : release
31+ # this permission is required for PyPI Trusted Publisher setup
32+ # https://docs.pypi.org/trusted-publishers/using-a-publisher/
3833 permissions :
3934 id-token : write
4035 steps :
@@ -44,22 +39,16 @@ jobs:
4439 uses : actions/setup-python@v5
4540 with :
4641 python-version : " 3.11"
42+ cache : " poetry"
4743
4844 - name : Install dependencies
49- run : |
50- python -m pip install --upgrade pip
51- pip install -r requirements-dev.txt
52- pip install .
45+ run : poetry install --with=dev
5346
5447 - name : Run pytest
55- run : |
56- cd tests
57- pytest --cov=mitreattack --cov-report html
58- cd ..
48+ run : poetry run pytest --cov=mitreattack
5949
6050 - name : Build package
61- run : python setup.py sdist bdist_wheel
51+ run : poetry build
6252
6353 - name : Publish package
64- if : github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
6554 uses : pypa/gh-action-pypi-publish@release/v1
0 commit comments