From a55e80f4c02d443091f9a60bf7db20c65710b92a Mon Sep 17 00:00:00 2001 From: Nishka Mittal Date: Mon, 16 Sep 2024 13:44:34 -0500 Subject: [PATCH] added formatting workflows for JSON and python --- .../music-box-interactive-folder/prettier.yml | 32 +++++ .../music-box-interactive-folder/test.yml | 27 ++++ .github/workflows/musica/clang_format.yml | 54 +++++++ .github/workflows/musica/clang_tidy.yml | 59 ++++++++ .github/workflows/musica/docker.yml | 61 ++++++++ .../musica/fetch_content_integration.yml | 44 ++++++ .github/workflows/musica/gh_pages.yml | 134 ++++++++++++++++++ .github/workflows/musica/mac.yml | 99 +++++++++++++ .github/workflows/musica/pep8.yml | 45 ++++++ .github/workflows/musica/pip.yml | 37 +++++ .github/workflows/musica/release.yml | 85 +++++++++++ .github/workflows/musica/ubuntu.yml | 82 +++++++++++ .github/workflows/musica/windows.yml | 124 ++++++++++++++++ 13 files changed, 883 insertions(+) create mode 100644 .github/workflows/music-box-interactive-folder/prettier.yml create mode 100644 .github/workflows/music-box-interactive-folder/test.yml create mode 100644 .github/workflows/musica/clang_format.yml create mode 100644 .github/workflows/musica/clang_tidy.yml create mode 100644 .github/workflows/musica/docker.yml create mode 100644 .github/workflows/musica/fetch_content_integration.yml create mode 100644 .github/workflows/musica/gh_pages.yml create mode 100644 .github/workflows/musica/mac.yml create mode 100644 .github/workflows/musica/pep8.yml create mode 100644 .github/workflows/musica/pip.yml create mode 100644 .github/workflows/musica/release.yml create mode 100644 .github/workflows/musica/ubuntu.yml create mode 100644 .github/workflows/musica/windows.yml diff --git a/.github/workflows/music-box-interactive-folder/prettier.yml b/.github/workflows/music-box-interactive-folder/prettier.yml new file mode 100644 index 0000000..815a2a1 --- /dev/null +++ b/.github/workflows/music-box-interactive-folder/prettier.yml @@ -0,0 +1,32 @@ +name: Auto format javascript code with prettier + +on: + push: + branches: + - main + +jobs: + prettier: + runs-on: ubuntu-latest + steps: + + - name: Check out code + uses: actions/checkout@v3 + with: + ref: ${{ github.head_ref }} + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Install packages + run: npm install + + - name: Format code + run: npm run format + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + commit-message: prettier action fixes + title: Fixes by prettier action + body: This is an auto-generated PR with fixes by prettier. + branch: prettier-patches \ No newline at end of file diff --git a/.github/workflows/music-box-interactive-folder/test.yml b/.github/workflows/music-box-interactive-folder/test.yml new file mode 100644 index 0000000..5689ce7 --- /dev/null +++ b/.github/workflows/music-box-interactive-folder/test.yml @@ -0,0 +1,27 @@ +name: Run Tests + +on: + push: + branches: + - main + pull_request: + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Check out repository code + uses: actions/checkout@v2 + + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: 21 + + - name: Install dependencies + run: npm install + + - name: Run tests + run: npm run test \ No newline at end of file diff --git a/.github/workflows/musica/clang_format.yml b/.github/workflows/musica/clang_format.yml new file mode 100644 index 0000000..5b7c891 --- /dev/null +++ b/.github/workflows/musica/clang_format.yml @@ -0,0 +1,54 @@ +name: Clang-Format + +on: + push: + branches: + - main + workflow_dispatch: + +jobs: + format: + name: Run Clang-Format + runs-on: ubuntu-latest + + steps: + - name: Install Clang-Format + run: sudo apt-get update && sudo apt-get install clang-format && clang-format --version + + - name: Check out code, run clang format, push changes + uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Run clang-format + run: | + find include -type f \( -name '*.hpp' -or -name '*.h' \) -exec clang-format -i --style=file --verbose {} + + find src -type f \( -name '*.cpp' -or -name '*.c' \) -exec clang-format -i --style=file --verbose {} + + + - name: Check for changes + id: check-changes + run: git diff --exit-code + continue-on-error: true + + - name: Commit and push changes + # a failue of this step means changes were detected + if: steps.check-changes.outcome != 'success' + run: | + git config --global user.name "GitHub Actions" + git config --global user.email "actions@github.com" + git commit -am "Auto-format code using Clang-Format" || echo "No changes to commit" + + - name: Push changes to main-formatting branch + if: steps.check-changes.outcome != 'success' + run: git push origin HEAD:main-formatting + + - name: Create Pull Request + if: steps.check-changes.outcome != 'success' + uses: peter-evans/create-pull-request@v6 + with: + token: ${{ secrets.GITHUB_TOKEN }} + commit-message: "Auto-format code using Clang-Format" + title: "Auto-format code changes" + body: "This is an automated pull request to apply code formatting using Clang-Format." + branch: main-formatting \ No newline at end of file diff --git a/.github/workflows/musica/clang_tidy.yml b/.github/workflows/musica/clang_tidy.yml new file mode 100644 index 0000000..59e815a --- /dev/null +++ b/.github/workflows/musica/clang_tidy.yml @@ -0,0 +1,59 @@ +name: Clang-Tidy + +on: + push: + branches: + - main + workflow_dispatch: + +jobs: + format: + name: Run clang-tidy + runs-on: ubuntu-latest + + steps: + - name: Install clang-tidy + run: sudo apt-get update && sudo apt-get install clang-tidy && clang-tidy --version + + - name: Check out code, run clang-tidy, push changes + uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Run clang-tidy + # Currently disabled + if: false + run: | + find include -type f \( -name '*.hpp' -or -name '*.h' \) -exec clang-tidy --config-file="./.clang-tidy" --fix-errors {} + + find src -type f \( -name '*.cpp' -or -name '*.c' \) ! -path 'src/test/*' -exec clang-tidy --config-file="./.clang-tidy" --fix-errors {} + + find python -type f \( -name '*.cpp' -or -name '*.c' \) -exec clang-tidy --config-file="./.clang-tidy" --fix-errors {} + + + continue-on-error: true + + - name: Check for changes + id: check-changes + run: git diff --exit-code + continue-on-error: true + + - name: Commit and push changes + # a failue of this step means changes were detected + if: steps.check-changes.outcome != 'success' + run: | + git config --global user.name "GitHub Actions" + git config --global user.email "actions@github.com" + git commit -am "Auto-format code using clang-tidy" || echo "No changes to commit" + + - name: Push changes to clang-tidy-format branch + if: steps.check-changes.outcome != 'success' + run: git push origin HEAD:clang-tidy-format + + - name: Create Pull Request + if: steps.check-changes.outcome != 'success' + uses: peter-evans/create-pull-request@v6 + with: + token: ${{ secrets.GITHUB_TOKEN }} + commit-message: "Auto-format code using clang-tidy" + title: "Auto-format code changes" + body: "This is an automated pull request to apply code formatting using clang-tidy." + branch: clang-tidy-format \ No newline at end of file diff --git a/.github/workflows/musica/docker.yml b/.github/workflows/musica/docker.yml new file mode 100644 index 0000000..58ac3bb --- /dev/null +++ b/.github/workflows/musica/docker.yml @@ -0,0 +1,61 @@ +name: Docker + +on: + push: + branches: + - main + pull_request: + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref || github.run_id }} + cancel-in-progress: true + +jobs: + docker-build-and-test: + name: Build and Test - ${{ matrix.dockerfile }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + dockerfile: + - Dockerfile + - Dockerfile.memcheck + - Dockerfile.fortran-gcc + - Dockerfile.openmp + - Dockerfile.mpi + - Dockerfile.mpi_openmp + - Dockerfile.python + - Dockerfile.pip + build_type: [Release, Debug] + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Delete huge unnecessary tools folder + run: rm -rf /opt/hostedtoolcache + + - name: Build Docker image + run: docker build -t musica -f docker/${{ matrix.dockerfile }} . --build-arg MUSICA_GIT_TAG=${{ github.sha }} --build-arg BUILD_TYPE=${{ matrix.build_type }} + + - name: Run tests in container + if: matrix.dockerfile != 'Dockerfile.coverage' && matrix.dockerfile != 'Dockerfile.pip' + run: docker run --name test-container -t musica bash -c 'make test ARGS="--rerun-failed --output-on-failure -j8"' + + - name: Run coverage tests in container + if: matrix.dockerfile == 'Dockerfile.coverage' + run: docker run --name test-container -t musica bash -c 'make coverage ARGS="--rerun-failed --output-on-failure -j8"' + + - name: Copy coverage from container + if: matrix.dockerfile == 'Dockerfile.coverage' + run: docker cp test-container:build/coverage.info . + + - name: Upload coverage report + if: matrix.dockerfile == 'Dockerfile.coverage' + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: coverage.info \ No newline at end of file diff --git a/.github/workflows/musica/fetch_content_integration.yml b/.github/workflows/musica/fetch_content_integration.yml new file mode 100644 index 0000000..df04e84 --- /dev/null +++ b/.github/workflows/musica/fetch_content_integration.yml @@ -0,0 +1,44 @@ +name: FetchContentIntegration + +on: + push: + branches: + - main + pull_request: + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref || github.run_id }} + cancel-in-progress: true + +jobs: + docker-build-and-test: + name: Build and Test - ${{ matrix.dockerfile }} + runs-on: ubuntu-latest + env: + BRANCH_NAME: ${{ github.head_ref || github.ref_name }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + dockerfile: + - Dockerfile.fortran-intel + - Dockerfile.fortran-gcc.integration + - Dockerfile.fortran-nvhpc + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Print branch name + run: echo "Branch name is $BRANCH_NAME" + + - name: Delete huge unnecessary tools folder + run: rm -rf /opt/hostedtoolcache + + - name: Build Docker image + run: docker build -t musica --build-arg MUSICA_GIT_TAG=${BRANCH_NAME} -f docker/${{ matrix.dockerfile }} . + + - name: Run tests in container + run: docker run --name test-container -t musica bash -c 'make test ARGS="--rerun-failed --output-on-failure -j8"' \ No newline at end of file diff --git a/.github/workflows/musica/gh_pages.yml b/.github/workflows/musica/gh_pages.yml new file mode 100644 index 0000000..3bd46fd --- /dev/null +++ b/.github/workflows/musica/gh_pages.yml @@ -0,0 +1,134 @@ +# Build and deploy documentation to GitHub Pages +name: GitHub Pages + +on: [ push, pull_request ] + +env: + DEFAULT_BRANCH: "release" + +jobs: + build-and-deploy: + name: Build and deploy to gh-pages + runs-on: ubuntu-24.04 + strategy: + matrix: + gcc-version: [13] + env: + CXX: g++-${{ matrix.gcc-version }} + CC: gcc-${{ matrix.gcc-version }} + FC: gfortran-${{ matrix.gcc-version }} + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + lfs: true + + - name: Debugging information + run: | + echo "github.ref:" ${{github.ref}} + echo "github.event_name:" ${{github.event_name}} + echo "github.head_ref:" ${{github.head_ref}} + echo "github.base_ref:" ${{github.base_ref}} + set -x + git rev-parse --abbrev-ref HEAD + git branch + git branch -a + git remote -v + python -V + pip list --not-required + pip list + + # Clone and set up the old gh-pages branch + - name: Clone old gh-pages + if: ${{ github.event_name == 'push' }} + run: | + set -x + git fetch + ( git branch gh-pages remotes/origin/gh-pages && git clone . --branch=gh-pages _gh-pages/ ) || mkdir _gh-pages + rm -rf _gh-pages/.git/ + mkdir -p _gh-pages/branch/ + + # If a push and default branch, copy build to _gh-pages/ as the "main" + # deployment. + - name: Build and copy documentation (default branch) + if: | + contains(github.event_name, 'push') && + contains(github.ref, env.DEFAULT_BRANCH) + run: | + set -x + mkdir -p _build/html/versions + + # create two copies of the documentation + # 1. the frozen version, represented as vX.X in the version switcher + docker build -t musica -f docker/Dockerfile.docs . + id=$(docker create musica) + docker cp $id:/build/docs/sphinx tmpdocs + docker rm -v $id + version=$(sed -nr "s/^release = f'v(.+)\{suffix\}'.*$/\1/p" docs/source/conf.py) + mv tmpdocs _build/html/versions/${version} + + # 2. stable, represented as vX.X (stable) in the version switcher + # edit conf.py to produce a version string that looks like vX.X (stable) + docker build -t musica -f docker/Dockerfile.docs --build-arg SUFFIX=" (stable)" . + id=$(docker create musica) + docker cp $id:/build/docs/sphinx tmpdocs + docker rm -v $id + mv tmpdocs _build/html/versions/stable + # Delete everything under _gh-pages/ that is from the + # primary branch deployment. Excludes the other branches + # _gh-pages/branch-* paths, and not including + # _gh-pages itself. + find _gh-pages/ -mindepth 1 ! -path '_gh-pages/branch*' ! -path '_gh-pages/versions*' -delete + rsync -a _build/html/versions/stable/* _gh-pages/ + mkdir -p _gh-pages/versions + rsync -a _build/html/versions/* _gh-pages/versions + # mv docs/switcher.json _gh-pages + + # If a push and not on default branch, then copy the build to + # _gh-pages/branch/$brname (transforming '/' into '--') + - name: Build and copy documentation (branch) + if: | + contains(github.event_name, 'push') && + !contains(github.ref, env.DEFAULT_BRANCH) + run: | + set -x + docker build -t musica -f docker/Dockerfile.docs . + id=$(docker create musica) + docker cp $id:/build/docs/sphinx tmpdocs + docker rm -v $id + brname="${{github.ref}}" + brname="${brname##refs/heads/}" + brdir=${brname//\//--} # replace '/' with '--' + rm -rf _gh-pages/branch/${brdir} + rsync -a tmpdocs/ _gh-pages/branch/${brdir} + + # Go through each branch in _gh-pages/branch/, if it's not a + # ref, then delete it. + - name: Delete old feature branches + if: ${{ github.event_name == 'push' }} + run: | + set -x + for brdir in `ls _gh-pages/branch/` ; do + brname=${brdir//--/\/} # replace '--' with '/' + if ! git show-ref remotes/origin/$brname ; then + echo "Removing $brdir" + rm -r _gh-pages/branch/$brdir/ + fi + done + + # Add the .nojekyll file + - name: nojekyll + if: ${{ github.event_name == 'push' }} + run: | + touch _gh-pages/.nojekyll + + # Deploy + # https://github.com/peaceiris/actions-gh-pages + - name: Deploy + uses: peaceiris/actions-gh-pages@v3 + if: ${{ github.event_name == 'push' }} + with: + publish_branch: gh-pages + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: _gh-pages/ + force_orphan: true diff --git a/.github/workflows/musica/mac.yml b/.github/workflows/musica/mac.yml new file mode 100644 index 0000000..b6a006c --- /dev/null +++ b/.github/workflows/musica/mac.yml @@ -0,0 +1,99 @@ +name: Mac + +on: + push: + branches: + - main + pull_request: + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref || github.run_id }} + cancel-in-progress: true + +jobs: + c_cxx: + runs-on: macos-latest + continue-on-error: true + strategy: + matrix: + compiler: + - { cpp: g++-12, c: gcc-12, fc: gfortran-12} + - { cpp: g++-13, c: gcc-13, fc: gfortran-13} + - { cpp: g++-14, c: gcc-14, fc: gfortran-14} + - { cpp: clang++, c: clang, fc: gfortran-12} + - { cpp: g++-14, c: gcc-14, fc: gfortran-14} + build_type: [Release] + env: + CC: ${{ matrix.compiler.c }} + CXX: ${{ matrix.compiler.cpp }} + FC: ${{ matrix.compiler.fc }} + + steps: + - uses: actions/checkout@v4 + + - name: Install dependencies + run: brew install netcdf netcdf-fortran + + - uses: actions/setup-python@v5 + - run: pip install numpy --user + + - name: Run Cmake + if: matrix.compiler.cpp != 'g++-13' + run: | + PYTHON_PATH=$(which python) + cmake -S . -B build \ + -D CMAKE_CXX_FLAGS=-Wl,-ld_classic \ + -D CMAKE_BUILD_TYPE=${{ matrix.build_type }} \ + -D MUSICA_GIT_TAG=${{ github.sha }} \ + -D MUSICA_ENABLE_PYTHON_LIBRARY=ON \ + -D Python3_EXECUTABLE=$PYTHON_PATH + + - name: Run Cmake + if: matrix.compiler.cpp == 'g++-13' + run: | + PYTHON_PATH=$(which python) + # for some reason gcc 13 was having issues finding the correct osx sdk + # it seems it was a known issue: https://github.com/actions/runner-images/issues/9997 + # for some reason, passing in an empty string for the osx sysroot fixed the issue + cmake -S . -B build \ + -D CMAKE_CXX_FLAGS=-Wl,-ld_classic \ + -D CMAKE_BUILD_TYPE=${{ matrix.build_type }} \ + -D MUSICA_GIT_TAG=${{ github.sha }} \ + -D MUSICA_ENABLE_PYTHON_LIBRARY=ON \ + -D Python3_EXECUTABLE=$PYTHON_PATH \ + -D CMAKE_OSX_SYSROOT="" + + - name: Build + run: cmake --build build --verbose --parallel 10 + + - name: Run tests + run: | + cd build + ctest -C ${{ matrix.build_type }} --rerun-failed --output-on-failure . --verbose + + fortran: + runs-on: macos-latest + strategy: + matrix: + gcc_version: [13, 14] + build_type: [Release] + env: + FC: gfortran-${{ matrix.gcc_version }} + + steps: + - uses: actions/checkout@v4 + + - name: Install dependencies + run: brew install netcdf netcdf-fortran + + - name: Run Cmake + run: cmake -S . -B build -D CMAKE_CXX_FLAGS=-Wl,-ld_classic -D CMAKE_BUILD_TYPE=${{ matrix.build_type }} -D MUSICA_GIT_TAG=${{ github.sha }} -D MUSICA_BUILD_FORTRAN_INTERFACE=ON + + - name: Build + run: cmake --build build --verbose --parallel 10 + + - name: Run tests + run: | + cd build + ctest -E "tuvx_c_api|tuvx_fortran_api" -C ${{ matrix.build_type }} --rerun-failed --output-on-failure . --verbose -j 10 \ No newline at end of file diff --git a/.github/workflows/musica/pep8.yml b/.github/workflows/musica/pep8.yml new file mode 100644 index 0000000..8f0268b --- /dev/null +++ b/.github/workflows/musica/pep8.yml @@ -0,0 +1,45 @@ +name: Pep8 + +on: + push: + branches: + - main + +jobs: + autopep8: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: autopep8 + uses: peter-evans/autopep8@v2 + with: + args: --recursive --in-place --aggressive --aggressive --max-line-length 120 . + + - name: Check for changes + id: check-changes + run: git diff --exit-code + continue-on-error: true + + - name: Commit and push changes + # a failue of this step means changes were detected + if: steps.check-changes.outcome != 'success' + run: | + git config --global user.name "GitHub Actions" + git config --global user.email "actions@github.com" + git commit -am "Auto-format code using Clang-Format" || echo "No changes to commit" + + - name: Push changes to main-autopep8 branch + if: steps.check-changes.outcome != 'success' + run: git push origin HEAD:main-autopep8 + + - name: Create Pull Request + if: steps.check-changes.outcome != 'success' + uses: peter-evans/create-pull-request@v6 + with: + token: ${{ secrets.GITHUB_TOKEN }} + commit-message: "Auto-format code using autopep8" + title: "Auto-format code by autopep8" + body: "This is an auto-generated PR with fixes by autopep8." + branch: main-autopep8 \ No newline at end of file diff --git a/.github/workflows/musica/pip.yml b/.github/workflows/musica/pip.yml new file mode 100644 index 0000000..724bbc0 --- /dev/null +++ b/.github/workflows/musica/pip.yml @@ -0,0 +1,37 @@ +name: Pip + +on: + push: + branches: + - main + pull_request: + workflow_dispatch: + +jobs: + build: + strategy: + fail-fast: false + matrix: + platform: [windows-latest, macos-13, ubuntu-latest] + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] + # python versions: https://devguide.python.org/versions/ + + runs-on: ${{ matrix.platform }} + + steps: + - uses: actions/checkout@v4 + with: + submodules: true + + - uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Add requirements + run: python -m pip install --upgrade wheel setuptools + + - name: Build and install + run: pip install --verbose .[test] + + - name: Test + run: python -m unittest discover -v -s python/test \ No newline at end of file diff --git a/.github/workflows/musica/release.yml b/.github/workflows/musica/release.yml new file mode 100644 index 0000000..d3857ea --- /dev/null +++ b/.github/workflows/musica/release.yml @@ -0,0 +1,85 @@ +name: Publish Python Package + +on: + workflow_dispatch: + release: + types: + - published + +jobs: + build_sdist: + name: Build SDist + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + submodules: true + + - name: Build SDist + run: pipx run build --sdist + + - name: Check metadata + run: pipx run twine check dist/* + + - uses: actions/upload-artifact@v4 + with: + name: cibw-sdist + path: dist/*.tar.gz + + build_wheels: + name: Build wheels on ${{ matrix.os }} with Python ${{ matrix.python-version }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + python-version: ["3.12"] + + steps: + - uses: actions/checkout@v4 + with: + submodules: true + + - uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - uses: pypa/cibuildwheel@v2.17 + env: + CIBW_ARCHS_MACOS: arm64 x86_64 + CIBW_SKIP: cp27-* cp34-* cp35-* cp36-* *musllinux* + CIBW_BUILD: cp37-* cp38-* cp39-* cp310-* cp311-* cp312-* + + - name: Verify clean directory + run: git diff --exit-code + shell: bash + + - name: Upload wheels + uses: actions/upload-artifact@v4 + with: + name: cibw-wheels-${{ matrix.os }}-py${{ matrix.python-version }} + path: wheelhouse/*.whl + + upload_all: + name: Upload release + needs: [build_wheels, build_sdist] + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/musica + permissions: + id-token: write + + steps: + - uses: actions/setup-python@v5 + with: + python-version: "3.x" + + - uses: actions/download-artifact@v4 + with: + pattern: cibw-* + path: dist + merge-multiple: true + + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/musica/ubuntu.yml b/.github/workflows/musica/ubuntu.yml new file mode 100644 index 0000000..7f28cc1 --- /dev/null +++ b/.github/workflows/musica/ubuntu.yml @@ -0,0 +1,82 @@ +name: Ubuntu + +on: + push: + branches: + - main + pull_request: + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref || github.run_id }} + cancel-in-progress: true + +jobs: + c_cxx: + runs-on: ubuntu-24.04 + continue-on-error: true + strategy: + matrix: + compiler: + - { cpp: g++-12, c: gcc-12, fc: gfortran-12} + - { cpp: g++-13, c: gcc-13, fc: gfortran-13} + - { cpp: g++-14, c: gcc-14, fc: gfortran-14} + - { cpp: clang++, c: clang, fc: gfortran-12} + options: + - {python: ON, tuvx: OFF} + - {python: OFF, tuvx: ON} + build_type: [Release] + env: + CC: ${{ matrix.compiler.c }} + CXX: ${{ matrix.compiler.cpp }} + FC: ${{ matrix.compiler.fc }} + + steps: + - uses: actions/checkout@v4 + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y liblapack-dev libblas-dev build-essential libnetcdf-dev libnetcdff-dev + sudo apt-get install -y python3-numpy + + - name: Run Cmake + run: cmake -S . -B build -D CMAKE_BUILD_TYPE=${{ matrix.build_type }} -D MUSICA_GIT_TAG=${{ github.sha }} -D MUSICA_ENABLE_PYTHON_LIBRARY=${{ matrix.options.python }} -D MUSICA_ENABLE_TUVX=${{ matrix.matrix.options.tuvx }} + + - name: Build + run: cmake --build build --verbose + + - name: Run tests + run: | + cd build + ctest -C ${{ matrix.build_type }} --rerun-failed --output-on-failure . --verbose + fortran: + runs-on: ubuntu-24.04 + continue-on-error: true + strategy: + matrix: + gcc_version: [14] + build_type: [Debug, Release] + env: + CXX: g++-${{ matrix.gcc_version }} + CC: gcc-${{ matrix.gcc_version }} + FC: gfortran-${{ matrix.gcc_version }} + + steps: + - uses: actions/checkout@v4 + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y libnetcdf-dev netcdf-bin libnetcdff-dev liblapack-dev libblas-dev + + - name: Run Cmake + run: cmake -S . -B build -D CMAKE_BUILD_TYPE=${{ matrix.build_type }} -D MUSICA_GIT_TAG=${{ github.sha }} -D MUSICA_BUILD_FORTRAN_INTERFACE=ON + + - name: Build + run: cmake --build build --verbose --parallel 1 + + - name: Run tests + run: | + cd build + ctest -C ${{ matrix.build_type }} --rerun-failed --output-on-failure . --verbose -j 10 \ No newline at end of file diff --git a/.github/workflows/musica/windows.yml b/.github/workflows/musica/windows.yml new file mode 100644 index 0000000..db8ebc4 --- /dev/null +++ b/.github/workflows/musica/windows.yml @@ -0,0 +1,124 @@ +name: Windows + +on: + push: + branches: + - main + pull_request: + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref || github.run_id }} + cancel-in-progress: true + +jobs: + mingw: + runs-on: windows-2019 + strategy: + matrix: + architecture: [x64] + + steps: + - uses: actions/checkout@v4 + - name: Set up MinGW + uses: egor-tensin/setup-mingw@v2 + with: + platform: ${{ matrix.architecture }} + version: 12.2.0 # https://github.com/egor-tensin/setup-mingw/issues/14 + + - uses: actions/setup-python@v5 + - run: pip install numpy + + - name: Run Cmake + run: cmake -S . -B build -G "MinGW Makefiles" -D MUSICA_GIT_TAG=${{ github.sha }} -D MUSICA_ENABLE_TUVX=OFF -D MUSICA_ENABLE_PYTHON_LIBRARY=ON + + - name: Build + run: cmake --build build --parallel + + - name: Run tests + run: | + cd build + ctest -C Debug --rerun-failed --output-on-failure . --verbose + + msvc2022: + runs-on: windows-2022 + continue-on-error: true + strategy: + matrix: + build_type: [Release] + architecture: [Win32, x64] + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + if: ${{ matrix.architecture == 'Win32' }} + with: + python-version: '3.x' + architecture: x86 + + - run: pip install numpy + + - name: Run CMake + run: cmake -S . -B build -G "Visual Studio 17 2022" -A ${{ matrix.architecture }} -D MUSICA_GIT_TAG=${{ github.sha }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -D MUSICA_ENABLE_TUVX=OFF -D MUSICA_ENABLE_PYTHON_LIBRARY=ON + + - name: Build + run: cmake --build build --config ${{ matrix.build_type }} --parallel + + - name: Test + run: cd build ; ctest -C ${{ matrix.build_type }} --output-on-failure --verbose + + clang: + runs-on: windows-2019 + continue-on-error: true + strategy: + matrix: + version: [11, 12, 13, 14, 15] + + steps: + - uses: actions/checkout@v4 + + - name: Install Clang + run: curl -fsSL -o LLVM${{ matrix.version }}.exe https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ matrix.version }}.0.0/LLVM-${{ matrix.version }}.0.0-win64.exe ; 7z x LLVM${{ matrix.version }}.exe -y -o"C:/Program Files/LLVM" + + - uses: actions/setup-python@v5 + - run: pip install numpy + + - name: Run CMake + run: cmake -S . -B build -DCMAKE_CXX_COMPILER="C:/Program Files/LLVM/bin/clang++.exe" -DCMAKE_C_COMPILER="C:/Program Files/LLVM/bin/clang.exe" -G"MinGW Makefiles" -D MUSICA_GIT_TAG=${{ github.sha }} -D MUSICA_ENABLE_TUVX=OFF -D MUSICA_ENABLE_PYTHON_LIBRARY=ON + + - name: Build + run: cmake --build build --parallel + + - name: Test + run: cd build ; ctest -C Debug --output-on-failure --verbose + + clang-cl-11: + runs-on: windows-2019 + continue-on-error: true + strategy: + matrix: + architecture: [Win32, x64] + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v4 + if: ${{ matrix.architecture == 'Win32' }} + with: + python-version: '3.x' + architecture: x86 + + - uses: actions/setup-python@v5 + - run: pip install numpy + + - name: Run CMake + run: cmake -S . -B build -G "Visual Studio 16 2019" -A ${{ matrix.architecture }} -T ClangCL -D MUSICA_GIT_TAG=${{ github.sha }} -D MUSICA_ENABLE_TUVX=OFF -D MUSICA_ENABLE_PYTHON_LIBRARY=ON + + - name: Build + run: cmake --build build --config Debug --parallel + + - name: Test + run: cd build ; ctest -C Debug --output-on-failure --verbose