Skip to content

Commit 3497fd5

Browse files
authored
Enable github actions CI (#67)
1 parent 6dee7aa commit 3497fd5

File tree

2 files changed

+40
-20
lines changed

2 files changed

+40
-20
lines changed

.github/workflows/main.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: CI
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
8+
runs-on: ubuntu-latest
9+
10+
container: rscohn2/oneapi-spec:latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
- name: build in container
14+
env:
15+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID}}
16+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY}}
17+
run: |
18+
python3 scripts/oneapi.py spec-venv
19+
. spec-venv/bin/activate
20+
python scripts/oneapi.py --branch $GITHUB_REF ci

scripts/oneapi.py

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import os.path
3535
from os.path import join
3636
import platform
37+
import requests
3738
import shutil
3839
from string import Template
3940
import stat
@@ -82,7 +83,7 @@ def __exit__(self, etype, value, traceback):
8283
os.chdir(self.savedPath)
8384

8485
def log(*args, **kwargs):
85-
print(indent * ' ' + ' '.join(map(str,args)), **kwargs)
86+
print(indent * ' ' + ' '.join(map(str,args)), flush = True, **kwargs)
8687

8788
def shell(c):
8889
log(c)
@@ -252,18 +253,21 @@ def spec_venv(root, target=None):
252253
shell('%s install --quiet -r requirements.txt' % pip)
253254

254255
@action
255-
def clones(root='.', target=None):
256+
def get_tarballs(root='.', target=None):
256257
root_only(root)
257-
# defer loading this so script can be invoked without installing packages
258-
from git import Repo
259-
for repo_base in repos:
260-
dir = join('repos',repo_base)
261-
if os.path.exists(dir):
262-
continue
263-
uri = '%s/%s.git' % (os.environ['EXTRA_REPOS'], repo_base)
264-
log('clone:', uri)
265-
if not args.dry_run:
266-
Repo.clone_from(uri, dir, multi_options=['--depth','1'])
258+
if not os.path.exists('tarballs'):
259+
makedirs('tarballs')
260+
for t in tarballs:
261+
tf = join('tarballs','%s.tgz' % t)
262+
url = 'https://spec.oneapi.com/tarballs/%s.tgz' % t
263+
r = requests.get(url, stream = True)
264+
log('wget', url, end = ' ')
265+
with open(tf, 'wb') as tb:
266+
for chunk in r.iter_content(chunk_size = 4 * 1024 * 1024):
267+
if chunk:
268+
tb.write(chunk)
269+
log('.', end = '')
270+
log('.')
267271

268272
@action
269273
def site(root, target=None):
@@ -285,7 +289,7 @@ def site(root, target=None):
285289
copytree(html, versions_x)
286290
copy(pdf, versions_x)
287291
for t in tarballs:
288-
tf = join('repos','oneapi-spec-tarballs','tarballs','%s.tgz' % t)
292+
tf = join('tarballs','%s.tgz' % t)
289293
log('cd',versions_x,'&& tar zxf',tf)
290294
if not args.dry_run:
291295
with tarfile.open(tf) as tar:
@@ -295,9 +299,9 @@ def site(root, target=None):
295299
@action
296300
def ci(root, target=None):
297301
root_only(root)
298-
clones(root)
302+
get_tarballs(root)
299303
site(root)
300-
if args.branch == 'publish':
304+
if args.branch == 'publish' or args.branch == 'refs/heads/publish':
301305
stage_publish(root)
302306
else:
303307
ci_publish(root)
@@ -307,7 +311,7 @@ def ci(root, target=None):
307311
commands = {'ci': ci,
308312
'ci-publish': ci_publish,
309313
'clean': clean,
310-
'clones': clones,
314+
'get-tarballs': get_tarballs,
311315
'dockerbuild': dockerbuild,
312316
'dockerpush': dockerpush,
313317
'dockerrun': dockerrun,
@@ -332,10 +336,6 @@ def ci(root, target=None):
332336
'oneL0',
333337
'oneDAL']
334338

335-
repos = ['onetbb-spec',
336-
'oneapi-spec-tarballs']
337-
338-
339339
def main():
340340
global args
341341
parser = argparse.ArgumentParser(description='Build oneapi spec.')

0 commit comments

Comments
 (0)