[mod] readme #81
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: CI | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- src/** | |
- include/** | |
- docs/source/example/typical/data/** | |
- docs/source/example/energy/data/** | |
workflow_dispatch: | |
jobs: | |
extract-nd: | |
name: Create branch 2D and 3D which only contains the dimension and compile each | |
permissions: | |
contents: write | |
strategy: | |
matrix: | |
dimension: [2, 3] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@main | |
with: | |
repository: "NaokiHori/SimpleTCSolver" | |
ref: "main" | |
submodules: "recursive" | |
- name: Install dependencies | |
run: | | |
sudo apt-get -y update && \ | |
sudo apt-get -y install make libopenmpi-dev libfftw3-dev | |
- name: Remove another dimension | |
run: | | |
set -x | |
set -e | |
python .github/workflows/extract_nd.py ${{ matrix.dimension }} | |
- name: Modify Makefile | |
run: | | |
set -x | |
set -e | |
sed -i "s/DNDIMS=2/DNDIMS=${{ matrix.dimension }}/g" Makefile | |
- name: Compile | |
run: | | |
make all | |
- name: Commit and push change | |
run: | | |
set -x | |
set -e | |
git switch -c ${{ matrix.dimension }}d | |
git config --local user.email "[email protected]" | |
git config --local user.name "NaokiHori" | |
# add, commit, and push | |
git add Makefile | |
git add src | |
git add include | |
git commit -m "Extract ${{ matrix.dimension }}d sources" -a || true | |
git push -f origin ${{ matrix.dimension }}d | |
example-typical: | |
name: Build library and try example - typical | |
runs-on: ubuntu-latest | |
needs: [extract-nd] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@main | |
with: | |
repository: 'NaokiHori/SimpleTCSolver' | |
ref: '3d' | |
submodules: "recursive" | |
- name: Install dependencies | |
run: | | |
sudo apt-get -y update && \ | |
sudo apt-get -y install make libopenmpi-dev libfftw3-dev | |
- name: Install python dependencies for post-processings | |
run: | | |
python -m pip install --upgrade pip | |
pip install numpy matplotlib | |
- name: Pre-process, execute, and post-process | |
run: | | |
bash docs/source/example/typical/data/exec.sh | |
- name: Upload artifacts | |
uses: actions/upload-artifact@main | |
with: | |
name: typical | |
path: artifacts | |
example-energy: | |
name: Build library and try example - energy | |
runs-on: ubuntu-latest | |
needs: [extract-nd] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@main | |
with: | |
repository: 'NaokiHori/SimpleTCSolver' | |
ref: '3d' | |
submodules: "recursive" | |
- name: Install dependencies | |
run: | | |
sudo apt-get -y update && \ | |
sudo apt-get -y install make libopenmpi-dev libfftw3-dev | |
- name: Install python dependencies for post-processings | |
run: | | |
python -m pip install --upgrade pip | |
pip install numpy matplotlib | |
- name: Pre-process, execute, and post-process | |
run: | | |
bash docs/source/example/energy/data/exec.sh | |
- name: Upload artifacts | |
uses: actions/upload-artifact@main | |
with: | |
name: energy | |
path: artifacts | |
unify-and-push-artifacts: | |
name: Gather artifacts and push them to a branch | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
needs: [example-energy, example-typical] | |
env: | |
BRANCH_NAME: artifacts | |
DIRECTORY_NAME: artifacts | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@main | |
with: | |
repository: 'NaokiHori/SimpleTCSolver' | |
ref: ${{ github.ref_name }} | |
- name: Download artifacts | |
uses: actions/download-artifact@main | |
with: | |
path: ${{ env.DIRECTORY_NAME }} | |
- name: Check artifacts | |
run: | | |
ls -R ${{ env.DIRECTORY_NAME }} | |
- name: Push artifacts | |
run: | | |
set -x | |
set -e | |
git config --local user.email "[email protected]" | |
git config --local user.name "NaokiHori" | |
git switch -c ${{ env.BRANCH_NAME }} | |
git add ${{ env.DIRECTORY_NAME }} | |
git commit -m "Update artifacts" -a || true | |
git push -f origin ${{ env.BRANCH_NAME }} | |