-
Notifications
You must be signed in to change notification settings - Fork 68
161 lines (140 loc) · 6.39 KB
/
linux.yml
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
name: MLOS Linux
on:
workflow_dispatch:
inputs:
tags:
description: Manual MLOS Linux run
push:
branches: [ main ]
pull_request:
branches: [ main ]
merge_group:
types: [checks_requested]
schedule:
- cron: "1 0 * * *"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: true
jobs:
LinuxCondaBuildTest:
name: Linux Build/Test with Conda
runs-on: ubuntu-latest
permissions:
contents: read
# Test multiple versions of python.
strategy:
fail-fast: false
matrix:
python_version:
# Empty string is the floating most recent version of python
# (useful to catch new compatibility issues in nightly builds)
- ""
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
env:
cache_cur_date: unset
cache_cur_hour: unset
cache_prev_hour: unset
CONDA_ENV_NAME: unset
# See notes about $CONDA below.
CONDA_DIR: unset
# When parallel jobs are used, group the output to make debugging easier.
MAKEFLAGS: -Oline
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
- name: Set cache timestamp variables
id: set_cache_vars
run: |
set -x
if [ -z "${{ matrix.python_version }}" ]; then
CONDA_ENV_NAME=mlos
else
CONDA_ENV_NAME="mlos-${{ matrix.python_version }}"
fi
echo "CONDA_ENV_NAME=$CONDA_ENV_NAME" >> $GITHUB_ENV
echo "cache_cur_date=$(date -u +%Y-%m-%d)" >> $GITHUB_ENV
echo "cache_cur_hour=$(date -u +%H)" >> $GITHUB_ENV
echo "cache_prev_hour=$(date -u -d'1 hour ago' +%H)" >> $GITHUB_ENV
# $CONDA should be set by the setup-miniconda action.
# We set a separate environment variable to allow the dependabot tool
# to parse this file since it expects all env vars to be declared above.
echo "CONDA_DIR=$CONDA" >> $GITHUB_ENV
echo "PIP_CACHE_DIR=$(conda run -n base pip cache dir)" >> $GITHUB_ENV
#- name: Restore cached conda environment
- name: Restore cached conda packages
id: restore-conda-cache
if: ${{ github.event_name != 'schedule' }}
uses: actions/cache@v4
with:
#path: ${{ env.CONDA_DIR }}/envs/${{ env.CONDA_ENV_NAME }}
path: ${{ env.CONDA_DIR }}/pkgs
key: conda-${{ runner.os }}-${{ env.CONDA_ENV_NAME }}-${{ hashFiles('conda-envs/${{ env.CONDA_ENV_NAME }}.yml') }}-${{ hashFiles('mlos_*/pyproject.toml') }}-${{ hashFiles('mlos_*/setup.py') }}-${{ env.cache_cur_date }}-${{ env.cache_cur_hour }}
restore-keys: |
conda-${{ runner.os }}-${{ env.CONDA_ENV_NAME }}-${{ hashFiles('conda-envs/${{ env.CONDA_ENV_NAME }}.yml') }}-${{ hashFiles('mlos_*/pyproject.toml') }}-${{ hashFiles('mlos_*/setup.py') }}-${{ env.cache_cur_date }}-${{ env.cache_prev_hour }}
conda-${{ runner.os }}-${{ env.CONDA_ENV_NAME }}-${{ hashFiles('conda-envs/${{ env.CONDA_ENV_NAME }}.yml') }}-${{ hashFiles('mlos_*/pyproject.toml') }}-${{ hashFiles('mlos_*/setup.py') }}-${{ env.cache_cur_date }}
- name: Restore cached pip packages
id: restore-pip-cache
if: ${{ github.event_name != 'schedule' }}
uses: actions/cache@v4
with:
path: ${{ env.PIP_CACHE_DIR }}
key: conda-${{ runner.os }}-${{ env.CONDA_ENV_NAME }}-${{ hashFiles('conda-envs/${{ env.CONDA_ENV_NAME }}.yml') }}-${{ hashFiles('mlos_*/pyproject.toml') }}-${{ hashFiles('mlos_*/setup.py') }}-${{ env.cache_cur_date }}-${{ env.cache_cur_hour }}
restore-keys: |
conda-${{ runner.os }}-${{ env.CONDA_ENV_NAME }}-${{ hashFiles('conda-envs/${{ env.CONDA_ENV_NAME }}.yml') }}-${{ hashFiles('mlos_*/pyproject.toml') }}-${{ hashFiles('mlos_*/setup.py') }}-${{ env.cache_cur_date }}-${{ env.cache_prev_hour }}
conda-${{ runner.os }}-${{ env.CONDA_ENV_NAME }}-${{ hashFiles('conda-envs/${{ env.CONDA_ENV_NAME }}.yml') }}-${{ hashFiles('mlos_*/pyproject.toml') }}-${{ hashFiles('mlos_*/setup.py') }}-${{ env.cache_cur_date }}
- name: Log some environment variables for debugging
run: |
set -x
printenv
echo "cache_cur_date: $cache_cur_date"
echo "cache_cur_hour: $cache_cur_hour"
echo "cache_prev_hour: $cache_prev_hour"
echo "cache-hit: ${{ steps.restore-conda-cache.outputs.cache-hit }}"
- name: Update and configure conda
run: |
set -x
conda config --set channel_priority strict
conda update -v -y -n base -c defaults --all
# Try and speed up the pipeline by using a faster solver:
- name: Install and default to mamba solver
run: |
set -x
conda install -v -y -n base conda-libmamba-solver
# Try to set either of the configs for the solver.
conda config --set experimental_solver libmamba || true
conda config --set solver libmamba || true
echo "CONDA_EXPERIMENTAL_SOLVER=libmamba" >> $GITHUB_ENV
echo "EXPERIMENTAL_SOLVER=libmamba" >> $GITHUB_ENV
- name: Create/update mlos conda environment
run: make CONDA_ENV_NAME=$CONDA_ENV_NAME CONDA_INFO_LEVEL=-v conda-env
- name: Log conda info
run: |
conda info
conda config --show
conda config --show-sources
conda list -n $CONDA_ENV_NAME
ls -l $CONDA_DIR/envs/$CONDA_ENV_NAME/lib/python*/site-packages/
conda run -n $CONDA_ENV_NAME pip cache dir
conda run -n $CONDA_ENV_NAME pip cache info
- name: Verify expected version of python in conda env
if: ${{ matrix.python_version == '' }}
timeout-minutes: 2
run: |
set -x
conda run -n mlos python -c \
'from sys import version_info as vers; assert (vers.major, vers.minor) == (3, 13), f"Unexpected python version: {vers}"'
# This is moreso about code cleanliness, which is a dev thing, not a
# functionality thing, and the rules for that change between python versions,
# so only do this for the default in the devcontainer.
#- name: Run lint checks
# run: make CONDA_ENV_NAME=$CONDA_ENV_NAME check
# Only run the coverage checks on the devcontainer job.
- name: Run tests
run: make CONDA_ENV_NAME=$CONDA_ENV_NAME SKIP_COVERAGE=true test
- name: Generate and test binary distribution files
run: make CONDA_ENV_NAME=$CONDA_ENV_NAME CONDA_INFO_LEVEL=-v dist dist-test