Skip to content

Commit

Permalink
group all readme-related workflows in one yml file. closes #1032 (#1034)
Browse files Browse the repository at this point in the history
  • Loading branch information
slayoo authored Mar 29, 2023
1 parent eb4c52b commit a918831
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 112 deletions.
30 changes: 0 additions & 30 deletions .github/workflows/julia.yml

This file was deleted.

45 changes: 0 additions & 45 deletions .github/workflows/matlab.yml

This file was deleted.

37 changes: 0 additions & 37 deletions .github/workflows/python.yml

This file was deleted.

84 changes: 84 additions & 0 deletions .github/workflows/readme_snippets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: readme_snippets

defaults:
run:
shell: bash

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
- cron: '0 13 * * 4'

jobs:
python:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
with:
python-version: 3.9
- run: pip install -e .
- run: pip install -r test-time-requirements.txt
- run: pip install pytest-codeblocks pytest
- run: python -c "import pytest_codeblocks; code=pytest_codeblocks.extract_from_file('README.md'); f=open('readme.py', 'w'); f.writelines(block.code for block in code if block.syntax=='Python'); f.close()"
- run: python -We readme.py
- run: sed -i 's/CPU/GPU/g' readme.py
- run: python -We readme.py

- name: artefacts
if: github.ref == 'refs/heads/main'
uses: eine/tip@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
files: |
readme.png
julia:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
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
- run: cat -n readme.jl
- run: julia readme.jl
- run: sed -i 's/CPU/GPU/g' readme.jl
- run: julia readme.jl

matlab:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
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@v0
with:
release: R2021a
- uses: matlab-actions/run-command@v0
with:
command: readme
- run: sed -i 's/CPU/GPU/g' readme.m
- uses: matlab-actions/run-command@v0
with:
command: readme

- name: artefacts
if: github.ref == 'refs/heads/main'
uses: eine/tip@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
files: |
parcel.png

0 comments on commit a918831

Please sign in to comment.