update docs
[MACS.git] / .github / workflows / build-and-test-MACS3-macos.yml
blob2dc60dbd4fcf164f043520df575b094f583f581a
1 # This workflow will install Python dependencies, run tests and lint with a single version of Python
2 # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
4 name: MACS3 CI Mac OS
6 on: 
7   push:
8     paths-ignore:
9       - 'docs/**'
10       - '**.md'
11       - '.github/workflows/**'
12       - '!.github/workflows/build-and-test-MACS3-macos.yml'
13   pull_request:
14     paths-ignore:
15       - 'docs/**'
16       - '**.md'
17       - '.github/workflows/**'
18       - '!.github/workflows/build-and-test-MACS3-macos.yml'
19       
20 jobs:
21   build:
22     strategy:
23       matrix:
24         os: [macos-13]
25         python-version: ["3.9", "3.10", "3.11", "3.12"]
26     runs-on: ${{ matrix.os }}
27     name: Build on ${{ matrix.os }} with Python ${{ matrix.python-version }}
29     steps:
30       - name: Checkout MACS
31         uses: actions/checkout@v4
32         with:
33           submodules: 'true'
34       - name: Set up Python ${{ matrix.python-version }}
35         uses: actions/setup-python@v5
36         with:
37           python-version: ${{ matrix.python-version }}
38       - name: Cache pip
39         uses: actions/cache@v4
40         with:
41           # This path is specific to Ubuntu
42           path: ~/.cache/pip
43           # Look to see if there is a cache hit for the corresponding requirements file
44           key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
45           restore-keys: |
46             ${{ runner.os }}-pip-
47             ${{ runner.os }}-
48       - name: Setup venv
49         run: |
50           # create venv
51           python3 -m venv macs3venv
52       - name: Install dependencies
53         run: |
54           # make sure pip is the lastest
55           source macs3venv/bin/activate
56           python3 -m pip install --upgrade pip
57           python3 -m pip install pytest
58           if [ -f requirements.txt ]; then python3 -m pip install --upgrade -r requirements.txt; fi
59       - name: Install MACS
60         run: |
61           # we use pip install instead of old fashion setup.py install
62           source macs3venv/bin/activate
63           python3 -m pip install .
64       - name: Output versions of installed libraries
65         run: |
66           source macs3venv/bin/activate
67           python3 -m pip freeze
68       - name: Test with pytest
69         run: |
70           source macs3venv/bin/activate
71           pytest --runxfail && cd test && ./cmdlinetest macs3
72       - name: Build sdist
73         run: |
74           source macs3venv/bin/activate
75           python3 setup.py sdist
76       - name: Archive sdist
77         uses: actions/upload-artifact@v4
78         with:
79           name: sdist-${{ matrix.os }}-${{ matrix.python-version }}
80           path: |
81             dist/*.tar.gz