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
11 - '.github/workflows/**'
12 - '!.github/workflows/build-and-test-MACS3-macos.yml'
17 - '.github/workflows/**'
18 - '!.github/workflows/build-and-test-MACS3-macos.yml'
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 }}
31 uses: actions/checkout@v4
34 - name: Set up Python ${{ matrix.python-version }}
35 uses: actions/setup-python@v5
37 python-version: ${{ matrix.python-version }}
39 uses: actions/cache@v4
41 # This path is specific to Ubuntu
43 # Look to see if there is a cache hit for the corresponding requirements file
44 key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
51 python3 -m venv macs3venv
52 - name: Install dependencies
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
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
66 source macs3venv/bin/activate
68 - name: Test with pytest
70 source macs3venv/bin/activate
71 pytest --runxfail && cd test && ./cmdlinetest macs3
74 source macs3venv/bin/activate
75 python3 setup.py sdist
77 uses: actions/upload-artifact@v4
79 name: sdist-${{ matrix.os }}-${{ matrix.python-version }}