forked from pangeo-data/pangeo-docker-images
-
Notifications
You must be signed in to change notification settings - Fork 0
114 lines (101 loc) · 4.61 KB
/
CondaLock.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
# Runs conda-lock against environment.yml for reproducible environments
# Runs on any opened PR
name: CondaLock
on:
repository_dispatch:
types: [condalock-command]
jobs:
condalock:
runs-on: ubuntu-latest
timeout-minutes: 15
defaults:
run:
shell: bash -l {0}
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
token: ${{ secrets.PANGEOBOT_TOKEN }}
# These lines are critical, otherwise Pangeo-bot pushes changes directly to master from PRs!
repository: ${{ github.event.client_payload.pull_request.head.repo.full_name }}
ref: ${{ github.event.client_payload.pull_request.head.ref }}
- name: Show environment.ymls
run: |
echo "---\nbase-notebook:\n---\n" && cat base-notebook/environment.yml
echo "---\npangeo-notebook:\n---\n" && cat pangeo-notebook/environment.yml
echo "---\nml-notebook:\n---\n" && cat ml-notebook/environment.yml
echo "---\npytorch-notebook:\n---\n" && cat pytorch-notebook/environment.yml
- name: Cache conda
uses: actions/cache@v3
env:
# Increase this value to reset cache if etc/example-environment.yml has not changed
CACHE_NUMBER: 0
with:
path: ~/conda_pkgs_dir
key:
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{hashFiles('environment-condalock.yml') }}
- name: Setup Conda Environment with Mambaforge
uses: conda-incubator/setup-miniconda@v2
with:
# Match base-image/Dockerfile version
miniforge-version: latest
miniforge-variant: Mambaforge
environment-file: environment-condalock.yml
activate-environment: condalock
use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly!
# Could run as single step in parallel, but would complicate logs...
- name: Run conda-lock base-notebook
timeout-minutes: 5
continue-on-error: true
run: |
conda clean --all --yes --force-pkgs-dirs
cd base-notebook
conda-lock lock --mamba -k explicit -f environment.yml -p linux-64
../generate-packages-list.py conda-linux-64.lock > packages.txt
- name: Run conda-lock pangeo-notebook
timeout-minutes: 5
continue-on-error: true
run: |
conda clean --all --yes --force-pkgs-dirs
cd pangeo-notebook
conda-lock lock --mamba -k explicit -f environment.yml -f ../base-notebook/environment.yml -p linux-64
../generate-packages-list.py conda-linux-64.lock > packages.txt
- name: Run conda-lock ml-notebook
timeout-minutes: 5
continue-on-error: true
run: |
conda clean --all --yes --force-pkgs-dirs
cd ml-notebook
conda-lock lock --mamba -k explicit -f environment.yml -f ../pangeo-notebook/environment.yml -f ../base-notebook/environment.yml -p linux-64
../generate-packages-list.py conda-linux-64.lock > packages.txt
- name: Run conda-lock pytorch-notebook
timeout-minutes: 5
continue-on-error: true
run: |
conda clean --all --yes --force-pkgs-dirs
cd pytorch-notebook
conda-lock lock --mamba -k explicit -f environment.yml -f ../pangeo-notebook/environment.yml -f ../base-notebook/environment.yml -p linux-64
../generate-packages-list.py conda-linux-64.lock > packages.txt
- name: Run conda-lock forge
timeout-minutes: 5
continue-on-error: true
run: |
conda clean --all --yes --force-pkgs-dirs
cd forge
conda-lock lock --mamba -k explicit -f environment.yml -f ../pangeo-notebook/environment.yml -f ../base-notebook/environment.yml -p linux-64
../generate-packages-list.py conda-linux-64.lock > packages.txt
# Commit the change to the PR branch (currently fails if no modified files)
- name: Commit condalock files to PR
run: |
git config --global user.name 'pangeo-bot'
git config --global user.email '[email protected]'
git add */conda-linux-64.lock */packages.txt
git commit -m "[condalock-command] autogenerated conda-lock files"
git push
- name: Add reaction
uses: peter-evans/create-or-update-comment@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
comment-id: ${{ github.event.client_payload.github.payload.comment.id }}
reaction-type: hooray