Skip to content

Potential fix for code scanning alert no. 3: Workflow does not contain permissions #159

Potential fix for code scanning alert no. 3: Workflow does not contain permissions

Potential fix for code scanning alert no. 3: Workflow does not contain permissions #159

Workflow file for this run

name: Tests
on:
push:
branches: [ master, main, develop ]
pull_request:
branches: [ master, main, develop ]
schedule:
# Run tests daily at 2 AM UTC to catch any dependency issues
- cron: '0 2 * * *'
permissions:
contents: read
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
exclude:
- os: windows-latest
python-version: '3.8'
- os: windows-latest
python-version: '3.9'
- os: windows-latest
python-version: '3.10'
- os: windows-latest
python-version: '3.11'
- os: windows-latest
python-version: '3.13'
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
pip install numpy scipy
pip install -e ".[dev]"
- name: Cache pip wheels
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: pip-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}
restore-keys: |
pip-${{ runner.os }}-${{ matrix.python-version }}-
- name: Install OpenBabel
run: pip install openbabel-wheel
continue-on-error: true
- name: Run tests with pytest
run: |
if [[ "${{ matrix.os }}" == "ubuntu-latest" && "${{ matrix.python-version }}" == "3.12" ]]; then
pytest -v --cov=chempy --cov-report=xml
else
pytest -q
fi
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
with:
files: ./coverage.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
quality:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.12', '3.13']
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
- name: Check formatting with black
run: black --check chempy unittest
continue-on-error: true
- name: Check import sorting with isort
run: isort --check-only chempy unittest
continue-on-error: true
- name: Lint with flake8
run: |
flake8 chempy unittest --max-line-length=100 --extend-ignore=E203,W503,E501
continue-on-error: true
- name: Type check with mypy
run: mypy chempy --ignore-missing-imports
continue-on-error: true