-
Notifications
You must be signed in to change notification settings - Fork 3
83 lines (79 loc) · 2.49 KB
/
maintenance.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
name: Maintenance
on:
workflow_run:
workflows: ["Python tests"]
branches: [develop]
types:
- completed
jobs:
get-environment:
if: ${{ (github.event.workflow_run.conclusion == 'success') && !startsWith(github.event.workflow_run.head_commit.message, 'Automated maintenance') }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [
windows-latest,
macos-latest,
ubuntu-latest
]
defaults:
run:
shell: bash -l {0} # Required for conda commands.
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
submodules: recursive
- name: Set up Python
uses: conda-incubator/setup-miniconda@v2
- name: Install dependencies
run: |
conda create -n cobmo -c conda-forge python=3.8 contextily cvxpy numpy pandas scipy
conda activate cobmo
pip install -e .[tests]
- name: Get new environment-${{ matrix.os }}.yml
run: |
rm -f environment-*
conda env export -n cobmo --no-builds | grep -v "^prefix: " > environment-${{ matrix.os }}.yml
- name: Store environment-${{ matrix.os }}.yml
uses: actions/upload-artifact@v2
with:
name: environment-${{ matrix.os }}.yml
path: environment-${{ matrix.os }}.yml
run-maintenance:
needs: get-environment
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
token: ${{ secrets.MESMO_BOT_PAT }}
- name: Remove old environment files
run: |
rm -f environment-*
- name: Get cached environment-windows-latest.yml
uses: actions/download-artifact@v2
with:
name: environment-windows-latest.yml
- name: Get cached environment-macos-latest.yml
uses: actions/download-artifact@v2
with:
name: environment-macos-latest.yml
- name: Get cached environment-ubuntu-latest.yml
uses: actions/download-artifact@v2
with:
name: environment-ubuntu-latest.yml
- name: Run automatic code formatting
uses: psf/black@stable
with:
options: "--line-length 120"
# For future reference: Exclude submodules if this runs too long.
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Automated maintenance for ${{ github.sha }}
commit_user_name: MESMO Bot
commit_user_email: [email protected]