-
Notifications
You must be signed in to change notification settings - Fork 6
82 lines (66 loc) · 2.96 KB
/
python-app.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
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: swolfpy
on:
push:
branches-ignore: []
pull_request:
branches: [ master ]
jobs:
build-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Add conda to system path
run: |
# $CONDA is an environment variable pointing to the root of the miniconda directory
echo $CONDA/bin >> $GITHUB_PATH
- name: Install dependencies
run: |
conda install conda=23.9.0
conda env update --file environment_dev.yml --name base
- name: Check if feature branch exists in swolfpy-inputdata
run: |
echo "-----------------------------------------"
echo "github.head_ref = ${{ github.head_ref }} ---"
echo "github.ref = ${{ github.ref }} ---"
echo "github.ref_name = ${{ github.ref_name }} ---"
echo "------------------------------------------"
if git ls-remote --exit-code --heads https://github.com/SwolfPy-Project/swolfpy-inputdata.git ${{ github.ref_name }}; then
echo "Branch ${{ github.ref_name }} exists."
echo "BRANCH_INPUTDATA=${{ github.ref_name }}" >> $GITHUB_ENV
else
echo "Branch does not exist. Falling back to 'master' branch."
echo "BRANCH_INPUTDATA=master" >> $GITHUB_ENV
fi
- name: Check if feature branch exists in swolfpy-processmodels
run: |
if git ls-remote --exit-code --heads https://github.com/SwolfPy-Project/swolfpy-processmodels.git ${{ github.ref_name }}; then
echo "Branch ${{ github.ref_name }} exists."
echo "BRANCH_PROCESSMODELS=${{ github.ref_name }}" >> $GITHUB_ENV
else
echo "Branch does not exist. Falling back to 'master' branch."
echo "BRANCH_PROCESSMODELS=master" >> $GITHUB_ENV
fi
- name: Install swolfpy-inputdata from branch
run: |
echo "pip install git+https://github.com/SwolfPy-Project/swolfpy-inputdata.git@${{ env.BRANCH_INPUTDATA }}"
pip install git+https://github.com/SwolfPy-Project/swolfpy-inputdata.git@${{ env.BRANCH_INPUTDATA }}
- name: Install swolfpy-processmodels from branch
run: |
echo "pip install git+https://github.com/SwolfPy-Project/swolfpy-processmodels.git@${{ env.BRANCH_PROCESSMODELS }}"
pip install git+https://github.com/SwolfPy-Project/swolfpy-processmodels.git@${{ env.BRANCH_PROCESSMODELS }}
- name: Check channels
run: |
conda config --show channels
- name: Check installed packages
run: |
pip list
- name: Pre-Commit
run: |
git fetch origin master
pre-commit run --from-ref origin/master --to-ref HEAD --show-diff-on-failure