Skip to content

Commit 6c88920

Browse files
committed
feat: update github workflow for poetry
1 parent 439f717 commit 6c88920

1 file changed

Lines changed: 15 additions & 26 deletions

File tree

.github/workflows/lint-publish.yml

Lines changed: 15 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
name: Lint, test, and publish
22

3-
on: [push]
3+
on: push
44

55
jobs:
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

Comments
 (0)