forked from deepchem/deepchem
-
Notifications
You must be signed in to change notification settings - Fork 0
96 lines (82 loc) · 2.8 KB
/
formatting.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
name: Code Formatting
on:
push: # ci work when pushing master branch
branches:
- master
pull_request: # ci work when creating a PR to master branch
branches:
- master
jobs:
linting:
runs-on: ubuntu-latest
steps:
- name: Maximize build space
if: runner.os == 'ubuntu-latest'
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set commit range (push to the master branch, e.g. merge)
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
run: echo "COMMIT_RANGE=${{ github.event.before }}.." >> $GITHUB_ENV
- name: Set commit range (pull request)
if: github.event_name == 'pull_request'
run: |
git fetch origin master
echo "COMMIT_RANGE=origin/master..." >> $GITHUB_ENV
- name: Cache pip packages for Linux
if: runner.os == 'Linux'
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements/**') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Create env.yml
shell: bash
run: |
python -m pip install --upgrade pip;
pip install conda-merge;
cd requirements
conda-merge env_common.yml env_test.yml env_ubuntu.yml tensorflow/env_tensorflow.cpu.yml torch/env_torch.cpu.yml jax/env_jax.cpu.yml > env.yml
cd ..
cp requirements/env.yml env.yml
- name: Install all dependencies using micromamba
uses: mamba-org/setup-micromamba@main
with:
environment-file: env.yml
environment-name: deepchem
create-args: python=${{ matrix.python-version }}
- name: Install DeepChem
id: install
shell: bash -l {0}
run: pip install -e .
- name: Show files modified
run: |
CHANGED_FILES=`git diff --name-only $COMMIT_RANGE || true`
echo "changed files are $CHANGED_FILES"
- name: Yapf (version 0.32.0)
id: yapf
shell: bash -l {0}
run: |
CHANGED_FILES=`git diff --name-only $COMMIT_RANGE | grep .py$ || true`
if [ -n "$CHANGED_FILES" ]; then
yapf -d $CHANGED_FILES
fi
- name: Flake8
if: ${{ (success() || failure()) && (steps.install.outcome == 'failure' || steps.install.outcome == 'success') }}
shell: bash -l {0}
run: source scripts/flake8_for_ci.sh
- name: Mypy
if: ${{ (success() || failure()) && (steps.install.outcome == 'failure' || steps.install.outcome == 'success') }}
shell: bash -l {0}
run: |
mypy -p deepchem