11name : CI
22
33on :
4- # NOTE(robinson) - We are limiting when we run CI avoid exceeding our 2,000 min/month limit.
5- # We can switch to running on push if we make this repo public or are fine with
6- # paying for CI minutes.
74 push :
85 branches : [ main ]
96 pull_request :
107 branches : [ main ]
118
9+ env :
10+ GHA_CACHE_KEY_VERSION : " v1"
1211
1312jobs :
1413 setup :
2625 path : |
2726 .venv
2827 nltk_data
29- key : unstructured-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('requirements/*.txt') }}
28+ key : unstructured-${{ runner.os }}-${{ matrix.python-version }}-${{ env.GHA_CACHE_KEY_VERSION }}-${{ hashFiles('requirements/*.txt') }}
3029 - name : Set up Python ${{ matrix.python-version }}
3130 uses : actions/setup-python@v4
3231 with :
3635 run : |
3736 python${{ matrix.python-version }} -m venv .venv
3837 source .venv/bin/activate
38+ mkdir "$NLTK_DATA"
3939 make install-ci
4040
4141 check-deps :
@@ -46,13 +46,13 @@ jobs:
4646 needs : setup
4747 steps :
4848 - uses : actions/checkout@v3
49- - uses : actions/cache@v3
49+ - uses : actions/cache/restore @v3
5050 id : virtualenv-cache
5151 with :
52- path : .venv
53- key : unstructured-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('requirements/*.txt') }}
54- # NOTE(robinson) - This is a fallback in case the lint job does not find the cache.
55- # We can take this out when we implement the fix in CORE-99
52+ path : |
53+ .venv
54+ nltk_data
55+ key : unstructured-${{ runner.os }}-${{ matrix.python-version }}-${{ env.GHA_CACHE_KEY_VERSION }}-${{ hashFiles('requirements/*.txt') }}
5656 - name : Set up Python ${{ matrix.python-version }}
5757 uses : actions/setup-python@v4
5858 with :
@@ -76,13 +76,13 @@ jobs:
7676 needs : setup
7777 steps :
7878 - uses : actions/checkout@v3
79- - uses : actions/cache@v3
79+ - uses : actions/cache/restore @v3
8080 id : virtualenv-cache
8181 with :
82- path : .venv
83- key : unstructured-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('requirements/*.txt') }}
84- # NOTE(robinson) - This is a fallback in case the lint job does not find the cache.
85- # We can take this out when we implement the fix in CORE-99
82+ path : |
83+ .venv
84+ nltk_data
85+ key : unstructured-${{ runner.os }}-${{ matrix.python-version }}-${{ env.GHA_CACHE_KEY_VERSION }}-${{ hashFiles('requirements/*.txt') }}
8686 - name : Set up Python ${{ matrix.python-version }}
8787 uses : actions/setup-python@v4
8888 with :
@@ -115,20 +115,19 @@ jobs:
115115 needs : [setup, lint]
116116 steps :
117117 - uses : actions/checkout@v3
118- - uses : actions/cache@v3
118+ - uses : actions/cache/restore @v3
119119 id : virtualenv-cache
120120 with :
121121 path : |
122122 .venv
123123 nltk_data
124- key : unstructured-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('requirements/*.txt') }}
125- # NOTE(robinson) - This is a fallback in case the job does not find the cache.
126- # We can take this out when we implement the fix in CORE-99
124+ key : unstructured-${{ runner.os }}-${{ matrix.python-version }}-${{ env.GHA_CACHE_KEY_VERSION }}-${{ hashFiles('requirements/*.txt') }}
127125 - name : Setup virtual environment (no cache hit)
128126 if : steps.virtualenv-cache.outputs.cache-hit != 'true'
129127 run : |
130128 python${{ matrix.python-version}} -m venv .venv
131129 source .venv/bin/activate
130+ mkdir "$NLTK_DATA"
132131 make install-ci
133132 - name : Test
134133 run : |
@@ -152,20 +151,19 @@ jobs:
152151 needs : [setup, lint]
153152 steps :
154153 - uses : actions/checkout@v3
155- - uses : actions/cache@v3
154+ - uses : actions/cache/restore @v3
156155 id : virtualenv-cache
157156 with :
158157 path : |
159158 .venv
160159 nltk_data
161- key : unstructured-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('requirements/*.txt') }}
162- # NOTE(robinson) - This is a fallback in case the lint job does not find the cache.
163- # We can take this out when we implement the fix in CORE-99
160+ key : unstructured-${{ runner.os }}-${{ matrix.python-version }}-${{ env.GHA_CACHE_KEY_VERSION }}-${{ hashFiles('requirements/*.txt') }}
164161 - name : Setup virtual environment (no cache hit)
165162 if : steps.virtualenv-cache.outputs.cache-hit != 'true'
166163 run : |
167164 python${{ matrix.python-version}} -m venv .venv
168165 source .venv/bin/activate
166+ mkdir "$NLTK_DATA"
169167 make install-ci
170168 - name : Test
171169 env :
@@ -210,13 +208,13 @@ jobs:
210208 needs : [ setup, lint ]
211209 steps :
212210 - uses : actions/checkout@v3
213- - uses : actions/cache@v3
211+ - uses : actions/cache/restore @v3
214212 id : virtualenv-cache
215213 with :
216214 path : |
217215 .venv
218216 nltk_data
219- key : unstructured-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('requirements/*.txt') }}
217+ key : unstructured-${{ runner.os }}-${{ matrix.python-version }}-${{ env.GHA_CACHE_KEY_VERSION }}-${{ hashFiles('requirements/*.txt') }}
220218 - name : Set up Python ${{ matrix.python-version }}
221219 uses : actions/setup-python@v4
222220 with :
0 commit comments