-
Notifications
You must be signed in to change notification settings - Fork 41
100 lines (86 loc) · 2.81 KB
/
gen-lock-file.yaml
File metadata and controls
100 lines (86 loc) · 2.81 KB
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
name: Create OpenFE Conda-Lock File
on:
workflow_dispatch:
defaults:
run:
shell: bash -leo pipefail {0}
jobs:
create-conda-lock-file-and-test-linux:
runs-on: ubuntu-latest
steps:
- name: Install conda-lock with Micromamba
uses: mamba-org/setup-micromamba@v2
with:
environment-name: conda-lock
create-args: >-
conda-lock
# This saves me some time since we only need the latest tag
- name: Get latest tag
id: latest-version
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
run: |
LATEST_TAG=$(curl -s -H "Authorization: token $GH_TOKEN" \
https://api.github.com/repos/$REPO/tags \
| jq -r '.[0].name')
VERSION=${LATEST_TAG:1}
echo $VERSION
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
- name: Print Latest Version
run: echo ${{ steps.latest-version.outputs.VERSION }}
- name: Create environment file to lock
run: |
cat > environment-to-lock.yaml << 'EOF'
name: openfe_env
channels:
- conda-forge
platforms:
- linux-64
- osx-arm64
dependencies:
- openfe==${{ steps.latest-version.outputs.VERSION }}
- python=3.10
EOF
- name: Generate lock files
run: |
conda lock --with-cuda 11.8 -f environment-to-lock.yaml --lockfile openfe-conda-lock.yml
cp openfe-conda-lock.yml openfe-${{ steps.latest-version.outputs.VERSION }}-conda-lock.yml
- name: Test lock file (linux)
run: |
conda-lock install -p /home/runner/micromamba/envs/lf-test openfe-conda-lock.yml
micromamba activate /home/runner/micromamba/envs/lf-test
openfe test
- name: Upload file as artifact
uses: actions/upload-artifact@v4
with:
name: conda-lock-files
path: "*conda-lock.yml"
test-osx-lock-file:
needs: create-conda-lock-file-and-test-linux
runs-on: macos-latest
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: conda-lock-files
- name: Install conda-lock with Micromamba
uses: mamba-org/setup-micromamba@v2
with:
environment-name: conda-lock
create-args: >-
conda-lock
- name: Test lock file (osx)
run: |
conda-lock install -p /Users/runner/micromamba/envs/lf-test openfe-conda-lock.yml
micromamba activate /Users/runner/micromamba/envs/lf-test
openfe test
- name: Upload lock files to release
uses: svenstaro/upload-release-action@v2
if: startsWith(github.ref, 'refs/tags/')
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: "*conda-lock.yml"
tag: ${{ github.ref }}
overwrite: true
file_glob: true