Skip to content

Commit

Permalink
Reuse conda build artifact in CI testing workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
aidanheerdegen committed Aug 16, 2024
1 parent 8d715ea commit fae8974
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
32 changes: 29 additions & 3 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ jobs:
conda-build:
name: Conda Build
runs-on: ubuntu-latest
env:
NAME: test-${{ github.event.repository.name }}
outputs:
artifact-name: ${{ env.NAME }}
steps:
- uses: actions/checkout@v4

Expand All @@ -35,32 +39,54 @@ jobs:

- name: Run conda build
shell: bash -el {0}
run: conda build . --no-anaconda-upload
id: build
run: |
echo "path=$(conda build . --no-anaconda-upload --output-folder=./build --output)" >> $GITHUB_OUTPUT
- uses: actions/upload-artifact@v4
with:
name: ${{ env.NAME }}
if-no-files-found: error
path: ${{ steps.build.outputs.path }}

tests:
name: Tests
runs-on: ubuntu-latest
needs: conda-build

# Run the job for different versions of python
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]

env:
ARTIFACT_LOCATION: ./conda-local

# Steps represent a sequence of tasks that will be executed as part of the job
steps:

- name: Checkout code
uses: actions/[email protected]

- uses: actions/download-artifact@v4
with:
name: ${{ needs.conda-build.outputs.artifact-name }}
path: ${{ env.ARTIFACT_LOCATION }}

- name: Setup conda environment
uses: conda-incubator/setup-miniconda@v3
with:
miniconda-version: "latest"
python-version: ${{ matrix.python-version }}

- name: Install source
- name: DEBUG - where are things
run: ls ${{ env.ARTIFACT_LOCATION }}

- name: Install conda package
shell: bash -l {0}
run: python -m pip install -e .
run: |
conda index ${{ env.ARTIFACT_LOCATION }}
conda install -c file:///${{ env.ARTIFACT_LOCATION }} um2nc
- name: List installed packages
shell: bash -l {0}
Expand Down
1 change: 1 addition & 0 deletions conda/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ dependencies:
- conda-build
- conda-verify
- versioneer
- pylint

0 comments on commit fae8974

Please sign in to comment.