Skip to content

Set up conda package #15

Set up conda package

Set up conda package #15

Workflow file for this run

name: CI
on:
pull_request:
branches: [main]
push:
branches: [main]
workflow_dispatch:
jobs:
# pre-commit:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-python@v5
# - uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
changes:
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
tracked-files: ${{ steps.filter.outputs.tracked-files }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Filter files
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 #v3.0.2
id: filter
with:
filters: |
tracked-files:
- 'setup.py'
- 'pyproject.toml'
- '.conda/**'
- 'src/**'
verify-conda-build:
name: Verify Conda Build
runs-on: ubuntu-latest
needs: changes
# Only run if there are changes in the tracked files
if: ${{ needs.changes.outputs.tracked-files == 'true' }}
steps:
- uses: actions/checkout@v4
- name: Setup conda build environment
uses: conda-incubator/setup-miniconda@a4260408e20b96e80095f42ff7f1a15b27dd94ca # v3.0.4
with:
miniconda-version: "latest"
python-version: ${{ vars.PY_VERSION }}
environment-file: .conda/env_build.yml
auto-activate-base: false
auto-update-conda: false
show-channel-urls: true
- name: Verify conda recipe
shell: bash -el {0}
run: conda-verify .conda --ignore C2105,C2122
# C2105: invalid package version for 'replace_landsurface'
# (there is no git tag in this test so versioneer outputs a
# version that conda-verify recognizes as 'invalid')
# C2122: invalid license family
# Reference --> https://github.com/conda/conda-verify?tab=readme-ov-file#checks
- name: Build conda package
shell: bash -el {0}
run: conda build . --no-anaconda-upload --output-folder=./build -c accessnri -c conda-forge -c coecms
- name: Verify conda package
shell: bash -el {0}
run: conda-verify ./build/noarch/*.tar.bz2 --ignore C1105,C1115,C1141
# C1105: invalid version number for 'replace_landsurface'
# (there is no git tag in this test so versioneer outputs a
# version that conda-verify recognizes as 'invalid')
# C1115: Found invalid license
# C1141: Found python file without a corresponding pyc file
# Reference --> https://github.com/conda/conda-verify?tab=readme-ov-file#checks
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
if-no-files-found: error
path: ./build/noarch/*.tar.bz2
# Dispatch the access-ram-condaenv repo (within the same GitHub organization) to deploy the development conda environment
dispatch-access-ram-condaenv:
name: Dispatch the ${{ github.repository_owner }}/access-ram-condaenv repo
runs-on: ubuntu-latest
if : ${{ github.event_name == 'pull_request' }}
needs: verify-conda-build
steps:
- name: Dispatch repo
uses: peter-evans/repository-dispatch@ff45666b9427631e3450c54a1bcbee4d9ff4d7c0 # v3.0.0
with:
token: ${{ secrets.ADMIN_TOKEN }}
repository: ${{ github.repository_owner }}/access-ram-condaenv
event-type: prerelease
client-payload: |-
{
"token": "${{secrets.ADMIN_TOKEN}}"
}