Skip to content

Update GitHub Actions checkout and setup-python #391

Update GitHub Actions checkout and setup-python

Update GitHub Actions checkout and setup-python #391

Workflow file for this run

name: Lint, test, and publish
on: [push]
jobs:
lint-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
pip install .
- name: Lint with flake8
run: flake8 mitreattack/ --count --exit-zero --statistics
# should turn these back on once they take less than 10 minutes to run
# - name: Run pytest
# run: |
# cd tests
# pytest --cov=mitreattack --cov-report html
publish:
needs: lint-test
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
pip install .
- name: Run pytest
run: |
cd tests
pytest --cov=mitreattack --cov-report html
cd ..
- name: Build package
run: python setup.py sdist bdist_wheel
- name: Publish package
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}