diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8f25c04eac..6d8fc1f2a2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,30 +5,13 @@ on: branches: ["master"] pull_request: branches: ["**"] - types: [opened, reopened, synchronize, labeled, unlabeled] + types: [opened, reopened, synchronize] workflow_dispatch: jobs: - require-label: - name: Require Run CI label - runs-on: ubuntu-latest - if: github.event_name == 'pull_request' - steps: - - name: Ensure Run CI label is present - env: - HAS_LABEL: ${{ contains(github.event.pull_request.labels.*.name, 'Run CI') }} - run: | - if [ "${HAS_LABEL}" != "true" ]; then - echo "::error::Add the 'Run CI' label to this pull request to trigger CI." - exit 1 - fi - shell: bash - build-and-check: name: Build & Check (${{ matrix.os }}-${{ matrix.mpi }}) runs-on: ${{ matrix.os }} - needs: [require-label] - if: github.event_name != 'pull_request' || needs.require-label.result == 'success' strategy: matrix: include: @@ -136,8 +119,6 @@ jobs: code-formatting: name: Check Code Formatting runs-on: ubuntu-latest - needs: [require-label] - if: github.event_name != 'pull_request' || needs.require-label.result == 'success' steps: - name: Checkout sources uses: actions/checkout@v6 @@ -171,8 +152,6 @@ jobs: mixed-precision-check: name: Check Mixed-Precision Code runs-on: ubuntu-latest - needs: [require-label] - if: github.event_name != 'pull_request' || needs.require-label.result == 'success' steps: - name: Checkout sources uses: actions/checkout@v6 @@ -200,8 +179,6 @@ jobs: headers-check: name: Check Headers runs-on: ubuntu-latest - needs: [require-label] - if: github.event_name != 'pull_request' || needs.require-label.result == 'success' steps: - name: Checkout sources uses: actions/checkout@v6 @@ -228,8 +205,6 @@ jobs: code-checks: name: Code Checks (${{ matrix.check }}) runs-on: ubuntu-latest - needs: [require-label] - if: github.event_name != 'pull_request' || needs.require-label.result == 'success' strategy: fail-fast: false matrix: diff --git a/.github/workflows/conda-release.yml b/.github/workflows/conda-release.yml new file mode 100644 index 0000000000..8016e63da2 --- /dev/null +++ b/.github/workflows/conda-release.yml @@ -0,0 +1,116 @@ +name: Conda Release Publish + +on: + release: + types: [published] + workflow_dispatch: + inputs: + release_tag: + description: Release tag to publish (for example v3.1.0) + required: true + type: string + +jobs: + build-and-publish: + name: Publish (${{ matrix.os }} | mpi=${{ matrix.mpi }}, openmp=${{ matrix.openmp }}) + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest] + mpi: [nompi, openmpi, mpich] + openmp: [on, off] + + steps: + - name: Checkout sources + uses: actions/checkout@v6 + with: + ref: ${{ github.event.release.tag_name || github.event.inputs.release_tag }} + + - name: Resolve package version from release tag + id: version + shell: bash + env: + RELEASE_TAG: ${{ github.event.release.tag_name || github.event.inputs.release_tag }} + run: | + set -euo pipefail + if [ -z "${RELEASE_TAG:-}" ]; then + echo "::error::Release tag is empty." + exit 1 + fi + + version="${RELEASE_TAG#refs/tags/}" + version="${version#v}" + + if ! [[ "${version}" =~ ^[0-9]+(\.[0-9]+){1,3}([A-Za-z0-9._-]+)?$ ]]; then + echo "::error::Unsupported release tag '${RELEASE_TAG}'. Use tags like v3.1.0 or 3.1.0." + exit 1 + fi + + echo "version=${version}" >> "${GITHUB_OUTPUT}" + echo "Using package version ${version}" + + - name: Setup Miniconda + uses: conda-incubator/setup-miniconda@v3 + with: + activate-environment: conda-build-env + auto-update-conda: false + channels: conda-forge + channel-priority: strict + python-version: "3.12" + + - name: Install conda tooling + shell: bash -el {0} + run: | + conda install -n conda-build-env -y conda-build anaconda-client + + - name: Build package variant + shell: bash -el {0} + env: + CONDA_BLD_PATH: ${{ runner.temp }}/conda-bld + HYPRE_VERSION: ${{ steps.version.outputs.version }} + run: | + set -euo pipefail + echo "Building version=${HYPRE_VERSION}, mpi=${{ matrix.mpi }}, openmp=${{ matrix.openmp }}" + variant_json=$(printf '{"mpi":["%s"],"openmp":["%s"]}' "${{ matrix.mpi }}" "${{ matrix.openmp }}") + conda build conda-recipe \ + --channel conda-forge \ + --override-channels \ + --variants "${variant_json}" \ + --no-anaconda-upload + + - name: Upload package to Anaconda (opflow-dev) + shell: bash -el {0} + env: + CONDA_BLD_PATH: ${{ runner.temp }}/conda-bld + HYPRE_VERSION: ${{ steps.version.outputs.version }} + ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_API_TOKEN }} + run: | + set -euo pipefail + if [ -z "${ANACONDA_API_TOKEN:-}" ]; then + echo "::error::Missing secret ANACONDA_API_TOKEN." + exit 1 + fi + + pkg_files="$( + find "${CONDA_BLD_PATH}" -type f \ + \( -name "hypre-${HYPRE_VERSION}-*.conda" -o -name "hypre-${HYPRE_VERSION}-*.tar.bz2" \) \ + | sort + )" + + if [ -z "${pkg_files}" ]; then + echo "::error::No built packages found under ${CONDA_BLD_PATH}." + exit 1 + fi + + echo "Uploading packages:" + printf '%s\n' "${pkg_files}" + + while IFS= read -r pkg; do + [ -n "${pkg}" ] || continue + anaconda -t "${ANACONDA_API_TOKEN}" upload \ + --user opflow-dev \ + --label main \ + --skip-existing \ + "${pkg}" + done <<< "${pkg_files}" diff --git a/conda-recipe/build.sh b/conda-recipe/build.sh index 66c6ab5d94..fc9571fe14 100755 --- a/conda-recipe/build.sh +++ b/conda-recipe/build.sh @@ -1,4 +1,9 @@ #!/usr/bin/env bash +# Copyright (c) 1998 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + set -euxo pipefail HYPRE_ENABLE_MPI="${HYPRE_ENABLE_MPI:-OFF}" diff --git a/conda-recipe/conda_build_config.yaml b/conda-recipe/conda_build_config.yaml index 2e0d9b3d39..1b5522735b 100644 --- a/conda-recipe/conda_build_config.yaml +++ b/conda-recipe/conda_build_config.yaml @@ -1,3 +1,8 @@ +# Copyright (c) 1998 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + mpi: - nompi - openmpi diff --git a/conda-recipe/meta.yaml b/conda-recipe/meta.yaml index a648b76264..0b42f818b7 100644 --- a/conda-recipe/meta.yaml +++ b/conda-recipe/meta.yaml @@ -1,9 +1,15 @@ +# Copyright (c) 1998 Lawrence Livermore National Security, LLC and other +# HYPRE Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + {% set enable_mpi = "ON" if mpi != "nompi" else "OFF" %} {% set enable_openmp = "ON" if openmp == "on" else "OFF" %} +{% set package_version = (environ.get("HYPRE_VERSION") or "3.1.0").lstrip("v") %} package: name: hypre - version: 3.1.0 + version: {{ package_version }} source: path: ..