Skip to content

Commit

Permalink
Fetch and update wheels on "make prepare" and use wheels for compile …
Browse files Browse the repository at this point in the history
…tests
  • Loading branch information
asdil12 committed Sep 22, 2022
1 parent 705aeb2 commit b6fd0e9
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Install dependencies
run: |
apt-get -y update
apt-get -y install yamllint libdbus-1-dev libssh2-1-dev parallel python3-dev
apt-get -y install yamllint libdbus-1-dev libssh2-1-dev parallel python3-dev python3-yaml python3-jsonschema
- name: Setup perl
env:
INLINE_PYTHON_EXECUTABLE: /usr/bin/python3
Expand Down
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ help:
.PHONY: prepare
prepare:
git clone https://github.com/os-autoinst/os-autoinst.git
./tools/wheel --fetch
$(MAKE) check-links
cd os-autoinst && cpanm -nq --installdeps .
cpanm -nq --installdeps .
Expand Down Expand Up @@ -50,11 +51,11 @@ unit-test:

.PHONY: test-compile
test-compile: check-links
export PERL5LIB=${PERL5LIB_} ; ( git ls-files "*.pm" || find . -name \*.pm|grep -v /os-autoinst/ ) | parallel perl -c 2>&1 | grep -v " OK$$" && exit 2; true
export PERL5LIB=${PERL5LIB_}:$(shell ./tools/wheel --verify) ; ( git ls-files "*.pm" || find . -name \*.pm|grep -v /os-autoinst/ ) | parallel perl -c 2>&1 | grep -v " OK$$" && exit 2; true

.PHONY: test-compile-changed
test-compile-changed: os-autoinst/
export PERL5LIB=${PERL5LIB_} ; for f in `git diff --name-only | grep '.pm'` ; do perl -c $$f 2>&1 | grep -v " OK$$" && exit 2; done ; true
export PERL5LIB=${PERL5LIB_}:$(shell ./tools/wheel --verify) ; for f in `git diff --name-only | grep '.pm'` ; do perl -c $$f 2>&1 | grep -v " OK$$" && exit 2; done ; true

.PHONY: test_pod_whitespace_rule
test_pod_whitespace_rule:
Expand Down
35 changes: 35 additions & 0 deletions tools/wheel
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/python3

import os
import sys
import subprocess

import yaml

if not os.path.exists('wheels.yaml'):
print("No wheels.yaml found!\nExiting.", file=sys.stderr)
sys.exit()

wheels_raw = yaml.safe_load(open('wheels.yaml'))
wheels_schema = yaml.safe_load(open('os-autoinst/schema/Wheels-01.yaml'))

if '--verify' in sys.argv:
import jsonschema
jsonschema.validate(instance=wheels_raw, schema=wheels_schema)

wheels = {}
for wheel in wheels_raw['wheels']:
if not wheel.startswith('http'):
wheel = f'https://github.com/{wheel}'
wheels[wheel.rsplit('/', 1)[1]] = wheel

if '--fetch' in sys.argv:
for wdir, wheel in wheels.items():
if not os.path.exists(wdir):
print(f"Checking out {wheel}", file=sys.stderr)
subprocess.run(['git', 'clone', wheel], stdout=sys.stderr)
else:
print(f"Updating {wdir}", file=sys.stderr)
subprocess.run(['git', '-C', wdir, 'pull', '--rebase'], stdout=sys.stderr)

print(':'.join(map(lambda w: f"{w}/lib", wheels.keys())))

0 comments on commit b6fd0e9

Please sign in to comment.