-
Notifications
You must be signed in to change notification settings - Fork 68
159 lines (130 loc) · 5.68 KB
/
windows.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
name: MLOS Windows
on:
workflow_dispatch:
inputs:
tags:
description: Manual MLOS Linux run
push:
branches: [ main ]
pull_request:
branches: [ main ]
# Windows jobs aren't required to pass atm for the merge group to pass.
#merge_group:
# types: [checks_requested]
schedule:
- cron: "1 0 * * *"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: true
jobs:
WindowsCondaBuildTest:
name: Windows Build/Test with Conda
runs-on: windows-latest
permissions:
contents: read
defaults:
run:
shell: pwsh
env:
CONDA_ENV_NAME: mlos
CONDA_ENV_YML: mlos-windows.yml
cache_cur_date: unset
cache_cur_hour: unset
cache_prev_hour: unset
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
- name: Set cache timestamp variables
id: set_cache_vars
run: |
"cache_cur_date=$(date -u +%Y-%m-%d)" >> $env:GITHUB_ENV
"cache_cur_hour=$(date -u +%H)" >> $env:GITHUB_ENV
"cache_prev_hour=$(date -u -d'1 hour ago' +%H)" >> $env:GITHUB_ENV
"CONDA=$env:CONDA" >> $env:GITHUB_ENV
- name: Add conda libs to the PATH
run: |
$env:PATH = "$env:CONDA\condabin;$env:PATH"
$env:PATH = "$env:CONDA\bin;$env:PATH"
$env:PATH = "$env:CONDA\Scripts;$env:PATH"
$env:PATH = "$env:CONDA\Library\bin;$env:PATH"
$env:PATH = "$env:CONDA\Library\usr\bin;$env:PATH"
$env:PATH = "$env:CONDA\Library\bin;$env:PATH"
$env:PATH = "$env:CONDA\Library\mingw-w64\bin;$env:PATH"
$env:PATH = "$env:CONDA;$env:PATH"
"PATH=$env:PATH" >> $env:GITHUB_ENV
- name: Restore cached conda environment
id: restore-conda-cache
if: github.event_name != 'schedule'
uses: actions/cache@v4
with:
path: ${{ env.CONDA }}/envs/mlos
key: conda-${{ runner.os }}-${{ env.CONDA_ENV_NAME }}-${{ hashFiles('conda-envs/${{ env.CONDA_ENV_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_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_YML }}') }}-${{ hashFiles('mlos_*/pyproject.toml') }}-${{ hashFiles('mlos_*/setup.py') }}-${{ env.cache_cur_date }}
- name: Log some environment variables for debugging
run: |
Get-ChildItem -Recurse Env:
Write-Host "cache_cur_date: $env:cache_cur_date"
Write-Host "cache_cur_hour: $env:cache_cur_hour"
Write-Host "cache_prev_hour: $env:cache_prev_hour"
Write-Host "cache-hit: ${{ steps.restore-conda-cache.outputs.cache-hit }}"
- name: Update and configure conda
run: |
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: |
conda install -v -y -n base conda-libmamba-solver
# Try to set either of the configs for the solver.
if (!(conda config --set experimental_solver libmamba)) { conda config --set solver libmamba }
"CONDA_EXPERIMENTAL_SOLVER=libmamba" >> $env:GITHUB_ENV
"EXPERIMENTAL_SOLVER=libmamba" >> $env:GITHUB_ENV
- name: Create/update mlos conda environment
run: |
if (! (conda env list | Select-String -Pattern "^$env:CONDA_ENV_NAME ") ) { conda env create -v -n $env:CONDA_ENV_NAME -f conda-envs/$env:CONDA_ENV_YML }
conda env update -v -n $env:CONDA_ENV_NAME -f conda-envs/$env:CONDA_ENV_YML --prune
- name: Log conda info
run: |
conda info
conda config --show
conda config --show-sources
conda list -n $env:CONDA_ENV_NAME
# 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: conda run -n $env:CONDA_ENV_NAME pylint -j0 mlos_core/mlos_core mlos_bench/mlos_bench
# Only run the coverage checks on the devcontainer job.
- name: Run tests
run: |
conda run -n $env:CONDA_ENV_NAME pytest --junitxml=junit/test-results.xml mlos_core/ mlos_bench/ mlos_viz/
# Note: unlike the Makefile version, the pwsh version of these rules are all run within a single shell context, so we can
# split commands across lines with CWD maintained (hence we also require the "cd .." here).
- name: Generate and test binary distribution files
run: |
.github/workflows/build-dist-test.ps1
WindowsDevContainerBuildTest:
name: Windows DevContainer Build/Test
# Skipped for now since building Linux containers on Windows Github Action Runners is not yet supported.
if: false
runs-on: windows-latest
defaults:
run:
shell: pwsh
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- name: Check docker
run: |
docker info
docker builder ls | Select-String linux # current returns '' (not yet supported)
docker builder inspect
- name: Build the devcontainer
run: |
.devcontainer/build/build-devcontainer.ps1
- name: Basic test of the devcontainer
run: |
.devcontainer/script/run-devcontainer.ps1 conda run -n mlos python --version