workflows/test-n-publish: fix perms in publish job #103
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Unit tests | |
on: | |
push: | |
paths-ignore: | |
- "docs/**" | |
- "*.md" | |
- ".github/workflows/*publish*.yml" | |
pull_request: | |
paths-ignore: | |
- "docs/**" | |
- "*.md" | |
- ".github/workflows/*publish*.yml" | |
jobs: | |
format: | |
if: | | |
(github.event_name == 'push' || github.event.pull_request.head.repo.fork) && | |
(!contains(github.event.head_commit.message, 'skip ci')) | |
strategy: | |
matrix: | |
python-version: ["3.10", "3.11", "3.12"] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
allow-prereleases: true | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install black toml | |
- name: Format source w/ black | |
# fail when file(s) would be formatted | |
run: black --check orchestra tests | |
lint: | |
if: | | |
(github.event_name == 'push' || github.event.pull_request.head.repo.fork) && | |
(!contains(github.event.head_commit.message, 'skip ci')) | |
strategy: | |
matrix: | |
pyver: ["py310", "py311", "py312"] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Ruff with Python target version ${{ matrix.pyver }} | |
uses: chartboost/ruff-action@v1 | |
with: | |
src: orchestra | |
args: "check --target-version ${{ matrix.pyver }}" | |
test: | |
if: | | |
(github.event_name == 'push' || github.event.pull_request.head.repo.fork) && | |
(!contains(github.event.head_commit.message, 'skip ci')) | |
needs: [format, lint] | |
strategy: | |
matrix: | |
python-version: ["3.10", "3.11", "3.12"] | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
autocrlf: ["true", "false"] | |
exclude: | |
- os: ubuntu-latest | |
autocrlf: "true" | |
- os: macos-latest | |
autocrlf: "true" | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Disable autocrlf so that we can test preserve LE on Windows | |
if: matrix.os == 'windows-latest' | |
run: git config --global core.autocrlf ${{ matrix.autocrlf }} | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
allow-prereleases: true | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install . | |
- name: Run pytest | |
run: | | |
pytest -vv tests | |
type-hints: | |
if: | | |
(github.event_name == 'push' || github.event.pull_request.head.repo.fork) && | |
(!contains(github.event.head_commit.message, 'skip ci')) | |
strategy: | |
matrix: | |
python-version: ["3.10", "3.11", "3.12"] | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
allow-prereleases: true | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install mypy{,_extensions} | |
- name: Type check w/ mypy | |
run: echo y | mypy --install-types --check-untyped-defs --pretty orchestra tests |