use setup-python action also on Apple silicon CI runs (since the action now supports ARM Python) #1756
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: readme_snippets | |
defaults: | |
run: | |
shell: bash | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
schedule: | |
- cron: '0 13 * * 4' | |
jobs: | |
python: | |
strategy: | |
matrix: | |
platform: [ubuntu-latest, macos-12, macos-14, windows-latest] | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- uses: actions/checkout@v4.1.6 | |
- if: matrix.platform != 'macos-14' | |
uses: actions/setup-python@v5.0.0 | |
with: | |
python-version: 3.9 | |
- if: matrix.platform == 'macos-14' | |
run: | | |
sudo ln -s `which python3` /usr/local/bin/python | |
echo "PIP_INSTALL_ARGS=--break-system-packages" >> $GITHUB_ENV | |
python -m pip install --break-system-packages setuptools packaging # Python 3.12 workaround | |
- run: python -m pip install $PIP_INSTALL_ARGS -e . | |
- run: python -m pip install $PIP_INSTALL_ARGS pytest-codeblocks pytest | |
- run: python -m pip install $PIP_INSTALL_ARGS "pyparsing<3.0.0" # https://github.com/matplotlib/matplotlib/issues/25204 | |
- run: | | |
python -c "import os,pytest_codeblocks; code=pytest_codeblocks.extract_from_file('README.md'); f=open('readme.py', 'w', encoding='utf-8'); f.write('# coding: utf-8'+os.linesep); f.writelines(block.code for block in code if block.syntax=='Python'); f.close()" | |
- run: cat -n readme.py | |
- if: matrix.platform == 'macos-14' | |
run: | | |
python readme.py | |
sed -i -e 's/CPU/GPU/g' readme.py | |
python readme.py | |
- if: matrix.platform != 'macos-14' | |
run: | | |
python -We readme.py | |
sed -i -e 's/CPU/GPU/g' readme.py | |
python -We readme.py | |
- name: artefacts | |
if: github.ref == 'refs/heads/main' && matrix.platform == 'ubuntu-latest' | |
uses: eine/tip@master | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
files: | | |
readme.png | |
julia: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4.1.6 | |
- uses: actions/setup-python@v5.0.0 | |
with: | |
python-version: 3.9 | |
- run: pip install -e . | |
- run: pip install pytest-codeblocks pytest | |
- run: python -c "import pytest_codeblocks; code=pytest_codeblocks.extract_from_file('README.md'); f=open('readme.jl', 'w'); f.writelines(block.code for block in code if block.syntax=='Julia'); f.close()" | |
- uses: julia-actions/setup-julia@v1.9.6 | |
- run: cat -n readme.jl | |
- run: julia readme.jl | |
- run: sed -i -e 's/CPU/GPU/g' readme.jl | |
- run: julia readme.jl | |
matlab: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4.1.6 | |
- uses: actions/setup-python@v5.0.0 | |
with: | |
python-version: 3.8 | |
- run: pip install -e . | |
- run: pip install pytest-codeblocks pytest | |
- run: python -c "import pytest_codeblocks; code=pytest_codeblocks.extract_from_file('README.md'); f=open('readme.m', 'w'); f.writelines(block.code for block in code if block.syntax=='Matlab'); f.close()" | |
- run: cat -n readme.m | |
- uses: matlab-actions/setup-matlab@v2.1.0 | |
with: | |
release: R2021a | |
- uses: matlab-actions/run-command@v2.1.0 | |
with: | |
command: readme | |
- run: sed -i -e 's/CPU/GPU/g' readme.m | |
- uses: matlab-actions/run-command@v2.1.0 | |
with: | |
command: readme | |
- name: artefacts | |
if: github.ref == 'refs/heads/main' | |
uses: eine/tip@master | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
files: | | |
parcel.png | |