-
Notifications
You must be signed in to change notification settings - Fork 0
126 lines (105 loc) · 3.92 KB
/
publish_conda.yml
File metadata and controls
126 lines (105 loc) · 3.92 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
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
- name: Set up base Miniforge
uses: conda-incubator/setup-miniconda@v3
with:
auto-activate: true
activate-environment: base
miniforge-version: latest
conda-remove-defaults: true
channels: conda-forge,noaa-gfdl
- name: Configure Conda
run: |
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
env:
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
run: |
echo "sanity check, is the token available as a secret? is the env var set?"
if [ -z "${{ secrets.ANACONDA_TOKEN }}" ]; then
echo "ERROR: ANACONDA_TOKEN is empty or not accessible"
exit 1
else
echo "ANACONDA_TOKEN is set (length: ${#ANACONDA_API_TOKEN})"
fi
echo ""
echo "sanity check, conda build version is"
conda build --version
echo ""
echo "sanity check, python version"
python --version
echo ""
echo "sanity check, conda build check"
conda build --check .
echo ""
echo "building conda package for publishing"
# CONDA_PKG=$(conda build --output .)
conda build --no-include-recipe --no-test .
# sleep 5
# echo ""
# echo "upload step"
# anaconda --verbose --token "$ANACONDA_API_TOKEN" upload $CONDA_PKG
# -----------------------------------------------------------------
# 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
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