diff options
-rw-r--r-- | .github/workflows/images.yml | 1 | ||||
-rw-r--r-- | .github/workflows/os_comp.yml | 12 | ||||
-rwxr-xr-x | ci/ciimage/build.py | 6 | ||||
-rw-r--r-- | ci/ciimage/cuda/image.json | 5 | ||||
-rwxr-xr-x | ci/ciimage/cuda/install.sh | 18 |
5 files changed, 36 insertions, 6 deletions
diff --git a/.github/workflows/images.yml b/.github/workflows/images.yml index efe5d93..bde2223 100644 --- a/.github/workflows/images.yml +++ b/.github/workflows/images.yml @@ -28,6 +28,7 @@ jobs: matrix: cfg: - { name: Arch Linux, id: arch } + - { name: CUDA (on Arch), id: cuda } - { name: Fedora, id: fedora } - { name: OpenSUSE, id: opensuse } - { name: Ubuntu Eoan, id: eoan } diff --git a/.github/workflows/os_comp.yml b/.github/workflows/os_comp.yml index a0877fd..f31bf5d 100644 --- a/.github/workflows/os_comp.yml +++ b/.github/workflows/os_comp.yml @@ -35,13 +35,15 @@ jobs: fail-fast: false matrix: cfg: - - { name: Arch Linux, id: arch } - - { name: Fedora, id: fedora } - - { name: OpenSUSE, id: opensuse } + - { name: Arch Linux, id: arch } + - { name: CUDA (on Arch), id: cuda } + - { name: Fedora, id: fedora } + - { name: OpenSUSE, id: opensuse } container: mesonbuild/${{ matrix.cfg.id }}:latest steps: - uses: actions/checkout@v1 - name: Run tests # All environment variables are stored inside the docker image in /ci/env_vars.sh - # They are defined in the `env` section in each image.json - run: bash -c "source /ci/env_vars.sh; cd $GITHUB_WORKSPACE; ./run_tests.py" + # They are defined in the `env` section in each image.json. CI_ARGS should be set + # via the `args` array ub the image.json + run: bash -c "source /ci/env_vars.sh; cd $GITHUB_WORKSPACE; ./run_tests.py $CI_ARGS" diff --git a/ci/ciimage/build.py b/ci/ciimage/build.py index 5e25e36..f57e8d7 100755 --- a/ci/ciimage/build.py +++ b/ci/ciimage/build.py @@ -26,6 +26,7 @@ class ImageDef: assert isinstance(data['env'], dict) self.base_image: str = data['base_image'] + self.args: T.List[str] = data.get('args', []) self.env: T.Dict[str, str] = data['env'] class BuilderBase(): @@ -64,6 +65,9 @@ class Builder(BuilderBase): out_file = self.temp_dir / 'env_vars.sh' out_data = '' + # run_tests.py parameters + self.image_def.env['CI_ARGS'] = ' '.join(self.image_def.args) + for key, val in self.image_def.env.items(): out_data += f'export {key}="{val}"\n' @@ -153,7 +157,7 @@ class ImageTester(BuilderBase): test_cmd = [ self.docker, 'run', '--rm', '-t', 'meson_test_image', - '/usr/bin/bash', '-c', 'source /ci/env_vars.sh; cd meson; ./run_tests.py' + '/usr/bin/bash', '-c', 'source /ci/env_vars.sh; cd meson; ./run_tests.py $CI_ARGS' ] if subprocess.run(test_cmd).returncode != 0: raise RuntimeError('Running tests failed') diff --git a/ci/ciimage/cuda/image.json b/ci/ciimage/cuda/image.json new file mode 100644 index 0000000..d395e71 --- /dev/null +++ b/ci/ciimage/cuda/image.json @@ -0,0 +1,5 @@ +{ + "base_image": "archlinux:latest", + "args": ["--only", "cuda"], + "env": {} +} diff --git a/ci/ciimage/cuda/install.sh b/ci/ciimage/cuda/install.sh new file mode 100755 index 0000000..011099d --- /dev/null +++ b/ci/ciimage/cuda/install.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +set -e + +pkgs=( + python python-setuptools python-wheel python-pytest-xdist python-jsonschema + ninja gcc gcc-objc git cmake + cuda zlib pkgconf +) + +PACMAN_OPTS='--needed --noprogressbar --noconfirm' + +pacman -Syu $PACMAN_OPTS "${pkgs[@]}" + +# Manually remove cache to avoid GitHub space restrictions +rm -rf /var/cache/pacman + +echo "source /etc/profile.d/cuda.sh" >> /ci/env_vars.sh |