-
Notifications
You must be signed in to change notification settings - Fork 11
119 lines (107 loc) · 3.59 KB
/
reformat.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
name: Reformats source files
# write [skip reformat] to skip this workflow!
on:
push:
branches: [ main ]
env:
ACTIONS_PYTHON_VERSION: 3.9
jobs:
# NOTE: Do all jobs SEQUENTIALLY to avoid merges
reformat-altlabel:
if: "! contains(toJSON(github.event.commits.*.message), '[skip reformat]')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- name: Set up Python ${{ env.ACTIONS_PYTHON_VERSION }}
uses: actions/setup-python@v2
with:
python-version: ${{ env.ACTIONS_PYTHON_VERSION }}
- name: Reformat
run: ./scripts/reformat-altlabels
- name: Git Auto Commit
uses: stefanzweifel/git-auto-commit-action@v4.3.0
with:
commit_message: "🤖🧹 reformat crk.altlabel [skip ci]"
reformat-python:
runs-on: ubuntu-latest
# Ensure this is run **sequentially**
needs: reformat-altlabel
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- name: Set up Python ${{ env.ACTIONS_PYTHON_VERSION }}
uses: actions/setup-python@v2
with:
python-version: ${{ env.ACTIONS_PYTHON_VERSION }}
- name: Install dependencies
run: "pip install black"
- name: Reformat Python
run: |
black .
- name: Git Auto Commit
uses: stefanzweifel/git-auto-commit-action@v4.3.0
with:
commit_message: "🤖🧹 reformat Python files [skip ci]"
reformat-javascript:
runs-on: ubuntu-latest
# Ensure this is run **sequentially**
needs: reformat-python
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- name: Setup Node.js environment
uses: actions/setup-node@v2
with:
node-version: 14
cache: npm
- name: Install dependencies
run: npm ci
- name: Reformat JavaScript
run: npm run reformat
- name: Git Auto Commit
uses: stefanzweifel/git-auto-commit-action@v4.3.0
with:
commit_message: "🤖🧹 reformat JavaScript files [skip ci]"
reformat-importjson:
if: "! contains(toJSON(github.event.commits.*.message), '[skip reformat]')"
needs: reformat-javascript
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
# For prettier
- name: Setup Node.js environment
uses: actions/setup-node@v2
with:
node-version: 14
cache: npm
- name: Set up Python ${{ env.ACTIONS_PYTHON_VERSION }}
# actions/cache below uses this id to get the exact python version
id: setup-python
uses: actions/setup-python@v2
with:
python-version: ${{ env.ACTIONS_PYTHON_VERSION }}
- uses: actions/cache@v2
with:
path: ~/.local/share/virtualenvs
key: ${{ runner.os }}-python-${{ steps.setup-python.outputs.python-version }}-pipenv-${{ hashFiles('Pipfile.lock') }}
# sortimportjsondict is currently a django management command. If
# installing all the morphodict dependencies becomes too cumbersome,
# the command could be ported to a script without dependencies instead.
- name: 🖥 Install system dependencies
run: sudo apt-get install -y libfoma0
- name: ☤ Install pipenv
run: python3 -m pip install pipenv
- name: 📥 Install dependencies
run: pipenv install --dev
- name: Reformat files
run: "pipenv run ./crkeng-manage sortimportjson --git-files"
- name: Git Auto Commit
uses: stefanzweifel/git-auto-commit-action@v4.3.0
with:
commit_message: "🤖🧹 reformat importjson files [skip ci]"