-
Notifications
You must be signed in to change notification settings - Fork 0
104 lines (87 loc) · 3.39 KB
/
publish_conda.yml
File metadata and controls
104 lines (87 loc) · 3.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: publish_conda
on:
pull_request:
push:
branches:
- main
tags:
- '*'
permissions:
contents: read
jobs:
condapublish:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- name: Checkout Files
uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Set up base Miniforge
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-version: latest
conda-remove-defaults: true
python-version: "3.11"
- name: Configure Conda
run: |
echo "removing conda default channels, appending open-source ones"
conda config --append channels conda-forge
conda config --append channels noaa-gfdl
echo "setting strict channel priority"
conda config --set channel_priority strict
echo "setting anaconda_upload to yes"
conda config --set anaconda_upload yes
echo "printing conda config just in case"
conda config --show
- name: Update Conda and Conda Package Indices
run: |
echo "updating conda and package channel indices for conda-forge, noaa-gfdl"
conda update -y --all --override-channels -c conda-forge
conda update -y --all --override-channels -c noaa-gfdl
- name: Conda install conda-build
run: |
echo "conda install conda-build"
conda install conda-forge::conda-build conda-forge::anaconda-client
- name: Build fremor Conda Package
run: |
echo "conda building fremor package"
export ANACONDA_API_TOKEN=${{ secrets.ANACONDA_TOKEN }}
conda build --version
conda build --debug .
anaconda --verbose upload --force /home/runner/miniconda3/envs/test/conda-bld/noarch/fremor-develop-py_0.conda
# -----------------------------------------------------------------
# Post-publish verification: install epmt from the noaa-gfdl channel
# into a clean environment and run tests against it.
# -----------------------------------------------------------------
- name: Wait for noaa-gfdl channel to update
run: |
echo "Waiting 1 minutes for the noaa-gfdl channel index to update..."
sleep 60
- name: Remove checked-out source code
run: |
echo "Removing workspace source to ensure tests run against the installed package"
rm -rf "$GITHUB_WORKSPACE"/*
ls -la "$GITHUB_WORKSPACE"
- name: Create clean environment and install fremor from noaa-gfdl
run: |
conda create -y -n fremor-verify python=${{ matrix.python-version }}
conda activate fremor-verify
conda install -y -c noaa-gfdl -c conda-forge fremor
conda install -y conda-forge::pytest
conda list -n fremor-verify
- name: Resolve site-packages path
id: site_pkgs
run: |
conda activate fremor-verify
site_pkgs=$(python3 -c 'import site; print(site.getsitepackages()[0]);')
echo "site_pkgs=${site_pkgs}" >> "$GITHUB_OUTPUT"
echo "site-packages path: ${site_pkgs}"
- name: test(s) on package installed from channel
run: |
conda activate fremor-verify
fremor --help
fremor --version
pytest -x -vv ${{ steps.site_pkgs.outputs.site_pkgs }}/fremor/tests