chore: Update CI/CD workflow #238
This file contains hidden or 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: Setup Fortran Conda CI/CD | |
| on: | |
| push: | |
| branches: [main, dev] | |
| paths-ignore: ['README.md','CHANGELOG.md','VERSION','LICENSE'] | |
| pull_request: | |
| branches: [main] | |
| paths-ignore: ['README.md','CHANGELOG.md','VERSION','LICENSE'] | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| test_fpm: | |
| if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }} | |
| name: ${{ matrix.os }}_${{ matrix.compiler }}_fpm | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - {os: ubuntu-latest, compiler: gfortran } | |
| - {os: ubuntu-latest, compiler: ifx } | |
| - {os: ubuntu-latest, compiler: flang-new} | |
| - {os: ubuntu-latest, compiler: nvfortran} | |
| - {os: windows-latest, compiler: gfortran } | |
| - {os: windows-latest, compiler: ifx, fpm-version: "0.12.0"} | |
| - {os: macos-latest, compiler: gfortran } | |
| steps: | |
| - name: Setup Fortran | |
| uses: gha3mi/setup-fortran-conda@latest | |
| with: | |
| compiler: ${{ matrix.compiler }} | |
| fpm-version: ${{ matrix.fpm-version }} | |
| - name: fpm test (debug) | |
| if: always() | |
| run: fpm @${{ matrix.os }}_${{ matrix.compiler }}_debug --verbose | |
| - name: fpm test (release) | |
| if: always() | |
| run: fpm @${{ matrix.os }}_${{ matrix.compiler }}_release --verbose | |
| test_cmake: | |
| if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }} | |
| name: ${{ matrix.os }}_${{ matrix.compiler }}_cmake | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - {os: ubuntu-latest, compiler: gfortran } | |
| - {os: ubuntu-latest, compiler: ifx } | |
| - {os: ubuntu-latest, compiler: flang-new} | |
| - {os: ubuntu-latest, compiler: nvfortran} | |
| - {os: windows-latest, compiler: gfortran } | |
| - {os: windows-latest, compiler: ifx } | |
| - {os: macos-latest, compiler: gfortran } | |
| steps: | |
| - name: Setup Fortran | |
| uses: gha3mi/setup-fortran-conda@latest | |
| with: | |
| compiler: ${{ matrix.compiler }} | |
| - name: cmake test (debug) | |
| if: always() | |
| run: | | |
| cmake -S . -B build/cmake/debug -DCMAKE_BUILD_TYPE=Debug -G Ninja -DFORCAD_BUILD_TESTS=ON -DCMAKE_Fortran_FLAGS="-DFOR_DEBUG" | |
| cmake --build build/cmake/debug --config Debug --verbose | |
| ctest --test-dir build/cmake/debug --output-on-failure -VV | |
| - name: cmake test (release) | |
| if: always() | |
| run: | | |
| cmake -S . -B build/cmake/release -DCMAKE_BUILD_TYPE=Release -G Ninja -DFORCAD_BUILD_TESTS=ON -DCMAKE_Fortran_FLAGS="-DFOR_DEBUG" | |
| cmake --build build/cmake/release --config Release --verbose | |
| ctest --test-dir build/cmake/release --output-on-failure -VV | |
| - name: cmake install (static) | |
| if: always() | |
| run: | | |
| cmake -S . -B build/cmake/static -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=. -G Ninja -DCMAKE_Fortran_FLAGS="-DFOR_DEBUG" | |
| cmake --build build/cmake/static --config Release | |
| cmake --install build/cmake/static --config Release --verbose | |
| - name: cmake uninstall | |
| if: always() | |
| run: cmake --build build/cmake/static --target uninstall | |
| - name: cmake install (shared) | |
| if: always() | |
| run: | | |
| cmake -S . -B build/cmake/shared -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=. -G Ninja -DCMAKE_Fortran_FLAGS="-DFOR_DEBUG" | |
| cmake --build build/cmake/shared --config Release | |
| cmake --install build/cmake/shared --config Release --verbose | |
| - name: cmake uninstall | |
| if: always() | |
| run: cmake --build build/cmake/shared --target uninstall | |
| doc_ford: | |
| if: ${{ (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') && !contains(github.event.head_commit.message, '[skip ci]') }} | |
| name: Generate FORD Documentation | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Setup and Generate FORD Documentation | |
| uses: gha3mi/setup-fortran-conda@latest | |
| with: | |
| compiler: gfortran | |
| generate-doc-ford: true | |
| ford-working-directory: . | |
| ford-config: README.md | |
| ford-output-directory: doc | |
| ford-branch: gh-pages | |
| ford-target-folder: . | |
| update_readme_table: | |
| if: ${{ always() && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') && github.ref == 'refs/heads/main' && !contains(github.event.head_commit.message, '[skip ci]') }} | |
| name: Update README.md status table | |
| needs: [test_fpm, test_cmake] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Update README status | |
| uses: gha3mi/setup-fortran-conda@latest | |
| with: | |
| update-readme-table: true | |
| update-readme-token: ${{ secrets.GH_PAT }} # Update with your GitHub personal access token | |
| update-readme-user-name: "Seyed Ali Ghasemi" # Update with your name | |
| update-readme-user-email: "info@gha3mi.com" # Update with your email | |
| linter_fortitude: | |
| if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }} | |
| name: Run Fortitude Linter | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Run Fortitude Linter | |
| uses: gha3mi/setup-fortran-conda@latest | |
| with: | |
| fortitude-check: true | |
| fortitude-settings: "--output-format github" |