Skip to content

Commit

Permalink
[CI] Upgrade github workflows to use latest Conda setup action (#563)
Browse files Browse the repository at this point in the history
  • Loading branch information
hcho3 authored May 23, 2024
1 parent 35b90e8 commit 890f605
Show file tree
Hide file tree
Showing 11 changed files with 68 additions and 65 deletions.
39 changes: 21 additions & 18 deletions .github/workflows/coverage-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ on:
permissions:
contents: read # to fetch code (actions/checkout)

defaults:
run:
shell: bash -l {0}

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
Expand All @@ -24,19 +28,18 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: 'true'
- uses: mamba-org/provision-with-micromamba@v14
- uses: conda-incubator/setup-miniconda@v3
with:
cache-downloads: true
cache-env: true
environment-name: dev
miniforge-variant: Mambaforge
miniforge-version: latest
activate-environment: dev
environment-file: ops/conda_env/dev.yml
use-mamba: true
- name: Display Conda env
shell: bash -l {0}
run: |
conda info
conda list
- name: Run tests with test coverage computation
shell: bash -l {0}
run: |
bash ops/cpp-python-coverage.sh
win-python-coverage:
Expand All @@ -46,17 +49,18 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: 'true'
- uses: mamba-org/provision-with-micromamba@v14
- uses: conda-incubator/setup-miniconda@v3
with:
cache-downloads: true
cache-env: true
environment-name: dev
miniforge-variant: Mambaforge
miniforge-version: latest
activate-environment: dev
environment-file: ops/conda_env/dev.yml
use-mamba: true
- name: Display Conda env
shell: cmd /C CALL {0}
run: |
micromamba info
micromamba list
conda info
conda list
- name: Run tests with test coverage computation
shell: cmd /C CALL {0}
run: |
Expand All @@ -68,18 +72,17 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: 'true'
- uses: mamba-org/provision-with-micromamba@v14
- uses: conda-incubator/setup-miniconda@v3
with:
cache-downloads: true
cache-env: true
environment-name: dev
miniforge-variant: Mambaforge
miniforge-version: latest
activate-environment: dev
environment-file: ops/conda_env/dev.yml
use-mamba: true
- name: Display Conda env
shell: bash -l {0}
run: |
conda info
conda list
- name: Run tests with test coverage computation
shell: bash -l {0}
run: |
bash ops/macos-python-coverage.sh
27 changes: 15 additions & 12 deletions .github/workflows/linux-wheel-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,13 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: 'true'
- uses: mamba-org/provision-with-micromamba@v14
- uses: conda-incubator/setup-miniconda@v3
with:
cache-downloads: true
cache-env: true
environment-name: dev
miniforge-variant: Mambaforge
miniforge-version: latest
activate-environment: dev
environment-file: ops/conda_env/dev.yml
use-mamba: true
- name: Display Conda env
run: |
conda info
Expand All @@ -53,12 +54,13 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: 'true'
- uses: mamba-org/provision-with-micromamba@v14
- uses: conda-incubator/setup-miniconda@v3
with:
cache-downloads: true
cache-env: true
environment-name: dev
miniforge-variant: Mambaforge
miniforge-version: latest
activate-environment: dev
environment-file: ops/conda_env/dev.yml
use-mamba: true
- name: Display Conda env
run: |
conda info
Expand All @@ -77,12 +79,13 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: 'true'
- uses: mamba-org/provision-with-micromamba@v14
- uses: conda-incubator/setup-miniconda@v3
with:
cache-downloads: true
cache-env: true
environment-name: dev
miniforge-variant: Mambaforge
miniforge-version: latest
activate-environment: dev
environment-file: ops/conda_env/dev.yml
use-mamba: true
- name: Build CPack
run: |
bash ops/build-cpack.sh
8 changes: 4 additions & 4 deletions .github/workflows/macos-wheel-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ env:
jobs:
macos-wheel-builder:
name: Build and test Python wheels (MacOS)
runs-on: macos-latest
runs-on: macos-13
strategy:
fail-fast: false
matrix:
Expand All @@ -36,12 +36,12 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: 'true'
- uses: conda-incubator/setup-miniconda@v2
- uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: dev
environment-file: ops/conda_env/dev.yml
miniforge-variant: Mambaforge
miniforge-version: latest
activate-environment: dev
environment-file: ops/conda_env/dev.yml
use-mamba: true
- name: Display Conda env
run: |
Expand Down
36 changes: 20 additions & 16 deletions .github/workflows/misc-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,13 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: 'true'
- uses: mamba-org/provision-with-micromamba@v14
- uses: conda-incubator/setup-miniconda@v3
with:
cache-downloads: true
cache-env: true
environment-name: dev
miniforge-variant: Mambaforge
miniforge-version: latest
activate-environment: dev
environment-file: ops/conda_env/dev.yml
use-mamba: true
- name: Display Conda env
run: |
conda info
Expand All @@ -53,12 +54,13 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: 'true'
- uses: mamba-org/provision-with-micromamba@v14
- uses: conda-incubator/setup-miniconda@v3
with:
cache-downloads: true
cache-env: true
environment-name: dev
miniforge-variant: Mambaforge
miniforge-version: latest
activate-environment: dev
environment-file: ops/conda_env/dev.yml
use-mamba: true
- name: Display Conda env
run: |
conda info
Expand All @@ -77,12 +79,13 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: 'true'
- uses: mamba-org/provision-with-micromamba@v14
- uses: conda-incubator/setup-miniconda@v3
with:
cache-downloads: true
cache-env: true
environment-name: dev
miniforge-variant: Mambaforge
miniforge-version: latest
activate-environment: dev
environment-file: ops/conda_env/dev.yml
use-mamba: true
- name: Display Conda env
run: |
conda info
Expand All @@ -97,12 +100,13 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: 'true'
- uses: mamba-org/provision-with-micromamba@v14
- uses: conda-incubator/setup-miniconda@v3
with:
cache-downloads: true
cache-env: true
environment-name: dev
miniforge-variant: Mambaforge
miniforge-version: latest
activate-environment: dev
environment-file: ops/conda_env/dev.yml
use-mamba: true
- name: Display Conda env
run: |
conda info
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: pre-commit/[email protected].0
- uses: pre-commit/[email protected].1
9 changes: 5 additions & 4 deletions .github/workflows/windows-wheel-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,13 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: 'true'
- uses: mamba-org/provision-with-micromamba@v14
- uses: conda-incubator/setup-miniconda@v3
with:
cache-downloads: true
cache-env: true
environment-name: dev
miniforge-variant: Mambaforge
miniforge-version: latest
activate-environment: dev
environment-file: ops/conda_env/dev.yml
use-mamba: true
- name: Build wheel
run: |
call ops/build-windows.bat
Expand Down
3 changes: 0 additions & 3 deletions ops/build-windows.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ echo ##[section]Running C++ tests...
.\build\treelite_cpp_test.exe
if %errorlevel% neq 0 exit /b %errorlevel%

echo ##[section]Setting up Python environment...
call micromamba activate dev

echo ##[section]Packaging Python wheel for Treelite...
cd python
pip wheel --no-deps -v . --wheel-dir dist/
Expand Down
3 changes: 0 additions & 3 deletions ops/test-win-python-wheel.bat
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
echo ##[section]Setting up Python environment...
call micromamba activate dev

echo ##[section]Installing Treelite into Python environment...
setlocal enabledelayedexpansion
python tests\ci_build\rename_whl.py python\dist %COMMIT_ID% win_amd64
Expand Down
2 changes: 0 additions & 2 deletions ops/win-python-coverage.bat
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ cd ..

echo ##[section]Running Python tests...
mkdir temp
call micromamba activate dev
if %errorlevel% neq 0 exit /b %errorlevel%
set "PYTHONPATH=./python"
set "PYTEST_TMPDIR=%USERPROFILE%\AppData\Local\Temp\pytest_temp"
mkdir "%PYTEST_TMPDIR%"
Expand Down
2 changes: 1 addition & 1 deletion src/c_api/model.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ int TreeliteConcatenateModelObjects(
API_BEGIN();
std::vector<treelite::Model const*> model_objs(len, nullptr);
std::transform(objs, objs + len, model_objs.begin(),
[](TreeliteModelHandle e) { return static_cast<const treelite::Model*>(e); });
[](TreeliteModelHandle e) { return static_cast<treelite::Model const*>(e); });
auto concatenated_model = ConcatenateModelObjects(model_objs);
*out = static_cast<TreeliteModelHandle>(concatenated_model.release());
API_END();
Expand Down
2 changes: 1 addition & 1 deletion src/model_concat.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ std::unique_ptr<Model> ConcatenateModelObjects(std::vector<Model const*> const&
auto& casted = std::get<ModelType>(objs[i]->variant_);
std::transform(casted.trees.begin(), casted.trees.end(),
std::back_inserter(concatenated_model_concrete.trees),
[](const auto& tree) { return tree.Clone(); });
[](auto const& tree) { return tree.Clone(); });
concatenated_model->target_id.Extend(objs[i]->target_id);
concatenated_model->class_id.Extend(objs[i]->class_id);
}
Expand Down

0 comments on commit 890f605

Please sign in to comment.