From a918831238b736b5325b18b6273276dfa8f6b838 Mon Sep 17 00:00:00 2001 From: Sylwester Arabas Date: Wed, 29 Mar 2023 22:32:21 +0200 Subject: [PATCH] group all readme-related workflows in one yml file. closes #1032 (#1034) --- .github/workflows/julia.yml | 30 ---------- .github/workflows/matlab.yml | 45 -------------- .github/workflows/python.yml | 37 ------------ .github/workflows/readme_snippets.yml | 84 +++++++++++++++++++++++++++ 4 files changed, 84 insertions(+), 112 deletions(-) delete mode 100644 .github/workflows/julia.yml delete mode 100644 .github/workflows/matlab.yml delete mode 100644 .github/workflows/python.yml create mode 100644 .github/workflows/readme_snippets.yml diff --git a/.github/workflows/julia.yml b/.github/workflows/julia.yml deleted file mode 100644 index 7f29e4e8c..000000000 --- a/.github/workflows/julia.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: PySDM-readme.jl - -defaults: - run: - shell: bash - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - schedule: - - cron: '0 13 * * 4' - -jobs: - 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 diff --git a/.github/workflows/matlab.yml b/.github/workflows/matlab.yml deleted file mode 100644 index 3edea39c0..000000000 --- a/.github/workflows/matlab.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: PySDM-readme.m - -defaults: - run: - shell: bash - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - schedule: - - cron: '0 13 * * 4' - -jobs: - 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 - diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml deleted file mode 100644 index e935f82aa..000000000 --- a/.github/workflows/python.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: PySDM-readme.py - -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 diff --git a/.github/workflows/readme_snippets.yml b/.github/workflows/readme_snippets.yml new file mode 100644 index 000000000..ed9423f55 --- /dev/null +++ b/.github/workflows/readme_snippets.yml @@ -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 +