Merge pull request #664 from macs3-project/feat/macs3/python_style_cy… #182
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
# This workflow will install Python dependencies, run tests and lint with a single version of Python | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
name: MACS3 CI Mac OS | |
on: | |
push: | |
paths-ignore: | |
- 'docs/**' | |
- '**.md' | |
- 'ChangeLog' | |
- '.github/workflows/**' | |
- '!.github/workflows/build-and-test-MACS3-macos.yml' | |
pull_request: | |
paths-ignore: | |
- 'docs/**' | |
- '**.md' | |
- 'ChangeLog' | |
- '.github/workflows/**' | |
- '!.github/workflows/build-and-test-MACS3-macos.yml' | |
jobs: | |
build: | |
strategy: | |
matrix: | |
os: [macos-13] | |
python-version: ["3.9", "3.10", "3.11", "3.12"] | |
runs-on: ${{ matrix.os }} | |
name: Build on ${{ matrix.os }} with Python ${{ matrix.python-version }} | |
steps: | |
- name: Checkout MACS | |
uses: actions/checkout@v4 | |
with: | |
submodules: 'true' | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Cache pip | |
uses: actions/cache@v4 | |
with: | |
# This path is specific to Ubuntu | |
path: ~/.cache/pip | |
# Look to see if there is a cache hit for the corresponding requirements file | |
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
${{ runner.os }}- | |
- name: Setup venv | |
run: | | |
# create venv | |
python3 -m venv macs3venv | |
- name: Install dependencies | |
run: | | |
# make sure pip is the lastest | |
source macs3venv/bin/activate | |
python3 -m pip install --upgrade pip | |
python3 -m pip install pytest | |
if [ -f requirements.txt ]; then python3 -m pip install --upgrade -r requirements.txt; fi | |
- name: Install MACS | |
run: | | |
# we use pip install instead of old fashion setup.py install | |
source macs3venv/bin/activate | |
python3 -m pip install . | |
- name: Output versions of installed libraries | |
run: | | |
source macs3venv/bin/activate | |
python3 -m pip freeze | |
- name: Test with pytest | |
run: | | |
source macs3venv/bin/activate | |
pytest --runxfail && cd test && ./cmdlinetest macs3 | |
- name: Build sdist | |
run: | | |
source macs3venv/bin/activate | |
python3 setup.py sdist | |
- name: Archive sdist | |
uses: actions/upload-artifact@v4 | |
with: | |
name: sdist-${{ matrix.os }}-${{ matrix.python-version }} | |
path: | | |
dist/*.tar.gz | |