| 1 |
name: conda builds |
| 2 |
|
| 3 |
on: |
| 4 |
pull_request: |
| 5 |
paths: |
| 6 |
- 'conda-environment.yml' |
| 7 |
- '.github/workflows/test_conda-build.yml' |
| 8 |
schedule: |
| 9 |
- cron: '17 22 * * 6' # Every Saturday at 22:17 |
| 10 |
workflow_dispatch: |
| 11 |
|
| 12 |
concurrency: |
| 13 |
group: ${{ github.workflow }}-${{ github.ref }} |
| 14 |
cancel-in-progress: true |
| 15 |
|
| 16 |
defaults: |
| 17 |
run: |
| 18 |
shell: bash |
| 19 |
|
| 20 |
env: |
| 21 |
FORCE_COLOR: 2 |
| 22 |
|
| 23 |
jobs: |
| 24 |
test_conda_install: |
| 25 |
if: github.repository_owner == 'cylc' || github.event_name != 'schedule' |
| 26 |
runs-on: ubuntu-latest |
| 27 |
timeout-minutes: 10 |
| 28 |
strategy: |
| 29 |
fail-fast: false |
| 30 |
matrix: |
| 31 |
python-version: ['3.12', '3'] |
| 32 |
env: |
| 33 |
ENV_FILE: conda-environment.yml |
| 34 |
steps: |
| 35 |
- name: checkout cylc-flow |
| 36 |
uses: actions/checkout@v5 |
| 37 |
|
| 38 |
- name: modify conda env file |
| 39 |
run: | |
| 40 |
# write environment file |
| 41 |
echo " - pip" >> "$ENV_FILE" # list pip as a dependency |
| 42 |
echo " - pip:" >> "$ENV_FILE" # add a pip section |
| 43 |
echo " - ." >> "$ENV_FILE" # install cylc-flow (pip install .) |
| 44 |
cat "$ENV_FILE" |
| 45 |
|
| 46 |
- name: build conda env |
| 47 |
uses: conda-incubator/setup-miniconda@v3 |
| 48 |
with: |
| 49 |
python-version: ${{ matrix.python-version }} |
| 50 |
environment-file: ${{ env.ENV_FILE }} |
| 51 |
|
| 52 |
- name: check cylc installation |
| 53 |
shell: bash -el {0} |
| 54 |
run: | |
| 55 |
conda run -n test cylc version --long |
| 56 |
|
| 57 |
- name: check for activate scripts |
| 58 |
shell : bash -el {0} |
| 59 |
run: | |
| 60 |
# https://github.com/cylc/cylc-flow/issues/3704#issuecomment-897442365 |
| 61 |
# locate all activate scripts |
| 62 |
find "$CONDA_PREFIX" -name "activate.d" | tee > activates.txt |
| 63 |
# ignore the conda activate script itself |
| 64 |
sed -i "\|$CONDA_PREFIX/etc/conda/activate.d|d" activates.txt |
| 65 |
# check to make sure no packages have contributed new activate scripts |
| 66 |
# (we rely on having a conda activate-less environment) |
| 67 |
if [[ $(wc -l < activates.txt) -ne 0 ]]; then |
| 68 |
echo '::error::Found activate scripts in installation.' |
| 69 |
cat activates.txt >&2 |
| 70 |
exit 1 |
| 71 |
fi |