-
Notifications
You must be signed in to change notification settings - Fork 0
ci: add conda build and release workflows #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
3d1ea96
887cc68
d72e039
f3f6f45
60d7f73
bfa971a
d60fba0
6418a3e
5b0d0a6
7ebbc6f
cdf9a1b
8e34313
f228021
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| name: Conda CI | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: | ||
| - master | ||
| push: | ||
| branches: | ||
| - master | ||
|
|
||
| jobs: | ||
| build-conda: | ||
| name: Build conda package (${{ matrix.os }}) | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| os: [ubuntu-latest, macos-latest] | ||
|
|
||
| steps: | ||
| - name: Checkout source | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Set up Miniconda | ||
| uses: conda-incubator/setup-miniconda@v3 | ||
| with: | ||
| auto-update-conda: true | ||
| use-mamba: true | ||
|
|
||
| - name: Install conda build tools | ||
| shell: bash -el {0} | ||
| run: | | ||
| conda install -y -n base conda-build anaconda-client | ||
|
|
||
| - name: Resolve release tag | ||
| id: resolve_tag | ||
| shell: bash | ||
| run: | | ||
| set -euo pipefail | ||
| git fetch --tags --force | ||
| TAG="$(git tag --sort=-creatordate | head -n 1 || true)" | ||
| if [ -z "$TAG" ]; then | ||
| REMOTE_REPO="${{ github.event.repository.full_name }}" | ||
| if [ -n "${{ github.event.repository.parent.full_name }}" ]; then | ||
| REMOTE_REPO="${{ github.event.repository.parent.full_name }}" | ||
| fi | ||
| TAG="$(git ls-remote --tags --refs --sort='v:refname' "https://github.com/$REMOTE_REPO.git" \ | ||
| refs/tags/* | awk '{print $2}' | sed 's#refs/tags/##' | head -n 1)" | ||
| fi | ||
| if [ -z "$TAG" ]; then | ||
| TAG="1.4.5" | ||
| fi | ||
| echo "tag=$TAG" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Build conda package | ||
| env: | ||
| GIT_DESCRIBE_TAG: ${{ steps.resolve_tag.outputs.tag }} | ||
| shell: bash -el {0} | ||
| run: | | ||
| conda build conda/recipe --no-test | ||
|
|
||
| - name: Test built package | ||
| env: | ||
| GIT_DESCRIBE_TAG: ${{ steps.resolve_tag.outputs.tag }} | ||
| shell: bash -el {0} | ||
| run: | | ||
| PKG_FILE="$(conda build --output conda/recipe)" | ||
| conda build --test "$PKG_FILE" -c local |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| name: Conda Release | ||
|
|
||
| on: | ||
| release: | ||
| types: [published] | ||
|
|
||
| jobs: | ||
| release-conda: | ||
| name: Build and upload conda package (${{ matrix.os }}) | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| os: [ubuntu-latest, macos-latest] | ||
|
|
||
| steps: | ||
| - name: Checkout source | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Set up Miniconda | ||
| uses: conda-incubator/setup-miniconda@v3 | ||
| with: | ||
| auto-update-conda: true | ||
| use-mamba: true | ||
|
|
||
| - name: Install conda build tools | ||
| shell: bash -el {0} | ||
| run: | | ||
| conda install -y -n base conda-build anaconda-client | ||
|
|
||
| - name: Resolve release tag | ||
| id: resolve_tag | ||
| env: | ||
| RELEASE_TAG: ${{ github.event.release.tag_name }} | ||
| shell: bash | ||
| run: | | ||
| set -euo pipefail | ||
| TAG="$RELEASE_TAG" | ||
| if [ -z "$TAG" ]; then | ||
| echo "No tag on release event." | ||
| exit 1 | ||
| fi | ||
| echo "tag=$TAG" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Build conda package | ||
| env: | ||
| GIT_DESCRIBE_TAG: ${{ steps.resolve_tag.outputs.tag }} | ||
| shell: bash -el {0} | ||
| run: | | ||
| conda build conda/recipe --no-test | ||
|
|
||
| - name: Test built package | ||
| env: | ||
| GIT_DESCRIBE_TAG: ${{ steps.resolve_tag.outputs.tag }} | ||
| shell: bash -el {0} | ||
| run: | | ||
| PKG_FILE="$(conda build --output conda/recipe)" | ||
| conda build --test "$PKG_FILE" -c local | ||
|
|
||
| - name: Upload package to Anaconda | ||
| env: | ||
| ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_API_TOKEN }} | ||
| ANACONDA_ORG: ${{ secrets.ANACONDA_ORG }} | ||
| GIT_DESCRIBE_TAG: ${{ steps.resolve_tag.outputs.tag }} | ||
| shell: bash -el {0} | ||
| run: | | ||
| set -euo pipefail | ||
| PKG_FILE="$(conda build --output conda/recipe)" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The upload step calls Useful? React with 👍 / 👎. |
||
| ANACONDA_ORG="${ANACONDA_ORG:-opflow-dev}" | ||
| if [ -z "${ANACONDA_API_TOKEN:-}" ]; then | ||
| echo "Missing ANACONDA_API_TOKEN secret." | ||
| exit 1 | ||
| fi | ||
| anaconda upload -u "$ANACONDA_ORG" "$PKG_FILE" | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,8 @@ source: | |
| build: | ||
| number: 0 | ||
| skip: True # [win] | ||
| script_env: | ||
| - GIT_DESCRIBE_TAG | ||
|
|
||
| requirements: | ||
| build: | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.