Skip to content
This repository was archived by the owner on Dec 16, 2022. It is now read-only.

Commit 98a2953

Browse files
authored
Simplify pull request workflow (#4117)
* simplify pull request workflow * tweak installation * tweak job graph * remove unneeded conditions
1 parent 0056b9c commit 98a2953

File tree

2 files changed

+118
-19
lines changed

2 files changed

+118
-19
lines changed

.github/workflows/main.yml renamed to .github/workflows/master.yml

+8-19
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
name: CI
1+
name: Master
22

33
on:
44
# TODO: add nightly schedule.
5-
pull_request:
6-
branches:
7-
- master
85
push:
96
branches:
107
- master
@@ -37,8 +34,7 @@ jobs:
3734
- name: Install requirements
3835
run: |
3936
pip install --upgrade pip setuptools wheel
40-
pip install -e .
41-
pip install --upgrade -r dev-requirements.txt
37+
pip install --upgrade -e . -r dev-requirements.txt
4238
4339
- name: Debug info
4440
run: |
@@ -94,8 +90,7 @@ jobs:
9490
- name: Install requirements
9591
run: |
9692
pip install --upgrade pip setuptools wheel
97-
pip install -e .
98-
pip install --upgrade -r dev-requirements.txt
93+
pip install --upgrade -e . -r dev-requirements.txt
9994
10095
- name: Debug info
10196
run: |
@@ -106,7 +101,7 @@ jobs:
106101
EXCLUDE_ALLENNLP_IN_SETUP: "true"
107102
run: |
108103
git clone https://github.com/allenai/allennlp-models.git
109-
cd allennlp-models && pip install -e . && pip install -r dev-requirements.txt
104+
cd allennlp-models && pip install --upgrade -e . -r dev-requirements.txt
110105
111106
- name: Run models tests
112107
run: |
@@ -121,7 +116,6 @@ jobs:
121116
build_package:
122117
name: Build Package
123118
needs: [check_core, check_models]
124-
if: github.event_name != 'pull_request'
125119
runs-on: ubuntu-latest
126120
strategy:
127121
matrix:
@@ -145,8 +139,7 @@ jobs:
145139
- name: Install requirements
146140
run: |
147141
pip install --upgrade pip setuptools wheel
148-
pip install -e .
149-
pip install --upgrade -r dev-requirements.txt
142+
pip install --upgrade -e . -r dev-requirements.txt
150143
151144
- name: Build core package
152145
run: |
@@ -163,7 +156,6 @@ jobs:
163156
test_package:
164157
name: Test Package
165158
needs: [build_package]
166-
if: github.event_name != 'pull_request'
167159
runs-on: ubuntu-latest
168160
strategy:
169161
matrix:
@@ -196,8 +188,7 @@ jobs:
196188
# Builds Docker image from the core distribution files and uploads to Docker Hub.
197189
docker:
198190
name: Docker
199-
needs: [build_package, test_package]
200-
if: github.event_name != 'pull_request'
191+
needs: [build_package]
201192
runs-on: ubuntu-latest
202193

203194
steps:
@@ -246,8 +237,7 @@ jobs:
246237
# allennlp-docs repo.
247238
docs:
248239
name: Docs
249-
needs: [build_package, test_package]
250-
if: github.event_name != 'pull_request'
240+
needs: [build_package, test_package, docker]
251241
runs-on: ubuntu-latest
252242
strategy:
253243
matrix:
@@ -276,8 +266,7 @@ jobs:
276266
- name: Install requirements
277267
run: |
278268
pip install --upgrade pip setuptools wheel
279-
pip install -e .
280-
pip install --upgrade -r dev-requirements.txt
269+
pip install --upgrade -e . -r dev-requirements.txt
281270
282271
- name: Debug info
283272
run: |

.github/workflows/pull_request.yml

+110
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
name: PR
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
8+
jobs:
9+
check_core:
10+
name: Check Core
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
python: ['3.6', '3.7']
15+
16+
steps:
17+
- uses: actions/checkout@v2
18+
19+
- name: Setup Python
20+
uses: actions/setup-python@v1
21+
with:
22+
python-version: ${{ matrix.python }}
23+
24+
- uses: actions/cache@v1
25+
with:
26+
path: ${{ env.pythonLocation }}
27+
key: ${{ runner.os }}-pydeps-${{ matrix.python }}-${{ hashFiles('setup.py') }}-${{ hashFiles('dev-requirements.txt') }}
28+
restore-keys: |
29+
${{ runner.os }}-pydeps-${{ matrix.python }}
30+
31+
- name: Install requirements
32+
run: |
33+
pip install --upgrade pip setuptools wheel
34+
pip install --upgrade -e . -r dev-requirements.txt
35+
36+
- name: Debug info
37+
run: |
38+
pip freeze
39+
40+
- name: Lint
41+
run: |
42+
make lint
43+
44+
- name: Type check
45+
run: |
46+
make typecheck
47+
48+
- name: Run tests
49+
run: |
50+
make test-with-cov
51+
52+
- name: Upload coverage to Codecov
53+
if: matrix.python == '3.7'
54+
env:
55+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
56+
run: |
57+
# Ignore codecov failures as the codecov server is not
58+
# very reliable but we don't want to report a failure
59+
# in the github UI just because the coverage report failed to
60+
# be published.
61+
# This will also fail for forked repositories since the secret token won't
62+
# be available.
63+
codecov -t $CODECOV_TOKEN || echo "codecov upload failed"
64+
65+
check_models:
66+
name: Check Models
67+
runs-on: ubuntu-latest
68+
strategy:
69+
matrix:
70+
python: ['3.6', '3.7']
71+
72+
steps:
73+
- uses: actions/checkout@v2
74+
75+
- name: Setup Python
76+
uses: actions/setup-python@v1
77+
with:
78+
python-version: ${{ matrix.python }}
79+
80+
- uses: actions/cache@v1
81+
with:
82+
path: ${{ env.pythonLocation }}
83+
key: ${{ runner.os }}-pydeps-${{ matrix.python }}-${{ hashFiles('setup.py') }}-${{ hashFiles('dev-requirements.txt') }}
84+
restore-keys: |
85+
${{ runner.os }}-pydeps-${{ matrix.python }}
86+
87+
- name: Install requirements
88+
run: |
89+
pip install --upgrade pip setuptools wheel
90+
pip install --upgrade -e . -r dev-requirements.txt
91+
92+
- name: Debug info
93+
run: |
94+
pip freeze
95+
96+
- name: Pull and install models repo
97+
env:
98+
EXCLUDE_ALLENNLP_IN_SETUP: "true"
99+
run: |
100+
git clone https://github.com/allenai/allennlp-models.git
101+
cd allennlp-models && pip install --upgrade -e . -r dev-requirements.txt
102+
103+
- name: Run models tests
104+
run: |
105+
cd allennlp-models && make test
106+
107+
- name: Clean up
108+
run: |
109+
# Don't want this in the cache since the other workflow uses same cache.
110+
pip uninstall --yes allennlp_models

0 commit comments

Comments
 (0)