Rewrite for named tuples #4691
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |