-
Notifications
You must be signed in to change notification settings - Fork 1
81 lines (79 loc) · 3.22 KB
/
run-github-workflows.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
name: run-github-workflows
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
solve-environments-and-upload-files:
name: run tcy, create environment, and export environment files
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest,windows-latest]
runs-on: ${{ matrix.os }}
permissions:
contents: write
defaults:
run:
shell: bash -el {0}
steps:
- name: checkout repository
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- name: setup python in order to run tcy.py
uses: actions/setup-python@v4
with:
python-version: 3.7
- name: install python dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pandas
python -m pip install pytest
- name: run tcy.py to create a .yml file for Linux (will be skipped for Windows)
if: runner.os == 'Linux'
run: python tcy.py linux --yml_dir=./environments --yml_file_name=${{ matrix.os }}.yml --tsv_path=./environments/packages.tsv --necessity=required
- name: run tcy.py to create a .yml file for Windows (will be skipped for Linux)
if: runner.os == 'Windows'
run: python tcy.py windows --yml_dir=./environments --yml_file_name=${{ matrix.os }}.yml --tsv_path=./environments/packages.tsv --necessity=required
- name: setup micromamba and create environment using .yml file
id: createEnvironment
uses: mamba-org/setup-micromamba@v1
with:
environment-file: ./environments/${{ matrix.os }}.yml
environment-name: ${{ matrix.os }}
- name: initialize conda for Git Bash (will be skipped for Linux)
if: runner.os == 'Windows'
run: echo ". /c/Miniconda/etc/profile.d/conda.sh" >> ~/.bash_profile
- name: export conda environment as .yml file and as spec-file.txt and export pip-packages as .txt file
run: |
conda env export -p "${MAMBA_ROOT_PREFIX}/envs/${{ matrix.os }}" | grep -v "^prefix: " > ./environments/${{ matrix.os }}_solved.yml
conda list -p "${MAMBA_ROOT_PREFIX}/envs/${{ matrix.os }}" --explicit > ./environments/${{ matrix.os }}_solved.txt
pip freeze | grep -v "@ file" > ./environments/${{ matrix.os }}_solved_pip-requirements.txt
- name: upload exported files as artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os }}
path: |
./environments/${{ matrix.os }}.yml
./environments/${{ matrix.os }}_solved.yml
./environments/${{ matrix.os }}_solved.txt
./environments/${{ matrix.os }}_solved_pip-requirements.txt
download-artifacts-and-push:
name: download files and push to repo if something has changed
if: ${{ always() }}
needs: solve-environments-and-upload-files
runs-on: ubuntu-latest
steps:
- name: checkout repository
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- name: download all files that were created using different operating systems
uses: actions/download-artifact@v3
with:
path: ./environments
- name: add and commit files (but only if something has changed)
uses: stefanzweifel/git-auto-commit-action@v4