mt3d-usgs checks #151
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: mt3d-usgs checks | |
| on: | |
| # run at 6 AM UTC every day | |
| schedule: | |
| - cron: '0 6 * * *' | |
| push: | |
| pull_request: | |
| branches: | |
| - main | |
| - develop | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| PIXI_BETA_WARNING_OFF: true | |
| DIST: dist-path | |
| PROGRAM_NAME: mt3dusgs | |
| jobs: | |
| build: | |
| name: Build and Test on ${{ matrix.os }} with ${{ matrix.compiler }} ${{ matrix.version }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # test latest gcc | |
| - {os: ubuntu-latest, compiler: gcc, version: 15, shell: bash, release: no} | |
| - {os: macos-14, compiler: gcc, version: 15, shell: bash, release: yes} | |
| - {os: macos-15-intel, compiler: gcc, version: 15, shell: bash, release: yes} | |
| - {os: windows-latest, compiler: gcc, version: 15, shell: pwsh, release: no} | |
| # test intel-classic | |
| - {os: ubuntu-22.04, compiler: intel-classic, version: 2021.7, shell: bash, release: no} | |
| # test previous gcc | |
| - {os: ubuntu-latest, compiler: gcc, version: 14, shell: bash, release: no} | |
| - {os: ubuntu-latest, compiler: gcc, version: 13, shell: bash, release: no} | |
| # test ifx | |
| - {os: ubuntu-22.04, compiler: intel, version: "2025.0", shell: bash, release: yes} | |
| - {os: windows-2022, compiler: intel, version: "2025.0", shell: pwsh, release: yes} | |
| defaults: | |
| run: | |
| shell: ${{ matrix.shell }} | |
| steps: | |
| - name: Checkout ${{ env.PROGRAM_NAME }} | |
| uses: actions/checkout@v6 | |
| with: | |
| path: ${{ env.PROGRAM_NAME }} | |
| - name: Setup ${{ matrix.compiler }} ${{ matrix.version }} on ${{ matrix.os }} | |
| uses: fortran-lang/setup-fortran@v1 | |
| with: | |
| compiler: ${{ matrix.compiler}} | |
| version: ${{ matrix.version }} | |
| - name: Setup pixi | |
| uses: prefix-dev/setup-pixi@v0.9.6 | |
| with: | |
| pixi-version: v0.41.4 | |
| manifest-path: "${{ env.PROGRAM_NAME }}/pixi.toml" | |
| - name: Set ostag | |
| shell: bash | |
| working-directory: ${{ env.PROGRAM_NAME }} | |
| id: ostag | |
| run: | | |
| echo "ostag=$(pixi run get-ostag)" >> $GITHUB_ENV | |
| - name: Create source zip file on Linux | |
| if: ${{ matrix.release == 'yes' && runner.os == 'Linux' }} | |
| working-directory: ${{ env.PROGRAM_NAME }} | |
| run: | | |
| zip -r ${{ env.PROGRAM_NAME }}_source.zip meson.build src/ | |
| ls -lha *.zip | |
| # static link gfortran libs | |
| - name: Hide dylibs (macOS) | |
| if: runner.os == 'macOS' | |
| working-directory: ${{ env.PROGRAM_NAME }} | |
| run: | | |
| version="${{ matrix.version }}" | |
| brew_prefix="$(brew --prefix)" | |
| libpath="$brew_prefix/opt/gcc@$version/lib/gcc/$version" | |
| mv $libpath/libgcc_s.1.1.dylib $libpath/libgcc_s.1.1.dylib.bak | |
| mv $libpath/libgfortran.5.dylib $libpath/libgfortran.5.dylib.bak | |
| mv $libpath/libquadmath.0.dylib $libpath/libquadmath.0.dylib.bak | |
| mv $libpath/libstdc++.6.dylib $libpath/libstdc++.6.dylib.bak | |
| # static link libgcc | |
| - name: Set LDFLAGS (macOS) | |
| if: runner.os == 'macOS' | |
| run: | | |
| ldflags="$LDFLAGS -static-libgcc" | |
| echo "LDFLAGS=$ldflags" >> $GITHUB_ENV | |
| - name: Build single precision version of ${{ env.PROGRAM_NAME }} | |
| working-directory: ${{ env.PROGRAM_NAME }} | |
| run: | | |
| pixi run setup builddir | |
| pixi run build builddir | |
| - name: Show build log | |
| if: failure() | |
| working-directory: ${{ env.PROGRAM_NAME }} | |
| run: cat builddir/meson-logs/meson-log.txt | |
| - name: Upload build log | |
| if: failure() | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: ${{ matrix.os }}-${{ matrix.compiler}}-${{ matrix.version }}-meson-log.txt | |
| path: ${{ env.PROGRAM_NAME }}/builddir/meson-logs/meson-log.txt | |
| - name: Build double precision version of ${{ env.PROGRAM_NAME }} | |
| working-directory: ${{ env.PROGRAM_NAME }} | |
| run: | | |
| pixi run setup builddir-dble -Ddouble=true | |
| pixi run build builddir-dble | |
| - name: Show build log | |
| if: failure() | |
| working-directory: ${{ env.PROGRAM_NAME }} | |
| run: cat builddir-dble/meson-logs/meson-log.txt | |
| - name: Upload build log | |
| if: failure() | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: ${{ matrix.os }}-${{ matrix.compiler}}-${{ matrix.version }}-meson-log.txt | |
| path: ${{ env.PROGRAM_NAME }}/builddir-dble/meson-logs/meson-log.txt | |
| - name: Unit test ${{ env.PROGRAM_NAME }} | |
| if: success() | |
| working-directory: ${{ env.PROGRAM_NAME }} | |
| run: | | |
| pixi run test builddir | |
| pixi run test builddir-dble | |
| - name: Check architecture (macOS) | |
| working-directory: ${{ env.PROGRAM_NAME }}/bin | |
| if: runner.os == 'macOS' | |
| run: | | |
| otool -L mt3dusgs | |
| otool -L mt3dusgsdbl | |
| lipo -info mt3dusgs | |
| lipo -info mt3dusgsdbl | |
| - name: Create source zip file on Linux | |
| if: ${{ matrix.release == 'yes' && runner.os == 'Linux' }} | |
| working-directory: ${{ env.PROGRAM_NAME }} | |
| run: | | |
| zip -r ${{ env.PROGRAM_NAME }}_source.zip meson.build src/ | |
| ls -lha *.zip | |
| - name: Create zip file on MacOS and Linux | |
| if: ${{ matrix.release == 'yes' && runner.os != 'Windows' }} | |
| working-directory: ${{ env.PROGRAM_NAME }} | |
| run: | | |
| zip -r -j ${ostag}.zip bin/ | |
| ls -lha *.zip | |
| - name: Create zip file on Windows | |
| if: ${{ matrix.release == 'yes' && runner.os == 'Windows' }} | |
| working-directory: ${{ env.PROGRAM_NAME }} | |
| run: | | |
| $ZipFileName = "$env:ostag.zip" | |
| Compress-Archive -Path "bin\*" -DestinationPath $ZipFileName | |
| ls *.zip | |
| - name: Upload distribution archive | |
| if: matrix.release == 'yes' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: ${{ env.DIST }}-${{ matrix.os }} | |
| path: ${{ env.PROGRAM_NAME }}/*.zip | |
| release: | |
| name: Make release | |
| needs: build | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| shell: bash | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v6 | |
| with: | |
| path: ${{ env.PROGRAM_NAME }} | |
| - name: Extract version number from the main meson.build file | |
| working-directory: ${{ env.PROGRAM_NAME }} | |
| run: | | |
| echo "PROGRAM_VERSION=$(grep -oE "([0-9]{1,}\.)+[0-9]{1,}" meson.build | head -n 1)" >> $GITHUB_ENV | |
| - name: Download distribution | |
| uses: actions/download-artifact@v8 | |
| with: | |
| pattern: ${{ env.DIST }}* | |
| merge-multiple: true | |
| path: ${{ env.DIST }} | |
| - name: List distribution files | |
| run: ls -l ${{ env.DIST }} | |
| # create new release if manual trigger | |
| - name: Create release | |
| if: github.event_name == 'workflow_dispatch' | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| tag: v${{ env.PROGRAM_VERSION }} | |
| name: "${{ env.PROGRAM_NAME }} executables" | |
| artifacts: "${{ env.DIST }}/*" | |
| draft: false | |
| allowUpdates: true | |
| token: ${{ secrets.GITHUB_TOKEN }} |