diff --git a/.github/workflows/test-binaries.yml b/.github/workflows/test-binaries.yml index e33f5217c..72fc8ab21 100644 --- a/.github/workflows/test-binaries.yml +++ b/.github/workflows/test-binaries.yml @@ -16,8 +16,8 @@ jobs: uses: actions/checkout@v2 - name: Test fedora binaries - run: ./docker/tests/scripts/test-fedora-binaries.sh + run: nix develop .#buildkite -c ./docker/tests/scripts/test-fedora-binaries.sh - name: Test ubuntu binaries - run: ./docker/tests/scripts/test-fedora-binaries.sh + run: nix develop .#buildkite -c ./docker/tests/scripts/test-fedora-binaries.sh diff --git a/docker/tests/Dockerfile-fedora-test b/docker/tests/Dockerfile-fedora-test index 5ed37a287..f32614a3d 100644 --- a/docker/tests/Dockerfile-fedora-test +++ b/docker/tests/Dockerfile-fedora-test @@ -7,9 +7,7 @@ FROM fedora:${dist} WORKDIR /tezos-packaging/docker RUN dnf update -y -RUN dnf install -y python3-devel python3-setuptools -RUN sudo dnf update -y -RUN sudo dnf install -y 'dnf-command(copr)' +RUN dnf install -y python3-devel python3-setuptools 'dnf-command(copr)' RUN sudo dnf copr enable -y @Serokell/Tezos COPY docker/tests/test-fedora-binaries.py /tezos-packaging/docker/tests/test-fedora-binaries.py diff --git a/docker/tests/Dockerfile-ubuntu-test b/docker/tests/Dockerfile-ubuntu-test index 6241774b0..045fd4a99 100644 --- a/docker/tests/Dockerfile-ubuntu-test +++ b/docker/tests/Dockerfile-ubuntu-test @@ -7,12 +7,8 @@ FROM ubuntu:${dist} WORKDIR /tezos-packaging/docker RUN apt update -y -RUN apt-get install -y python3-all python3-setuptools -RUN apt update -y -RUN apt install -y software-properties-common -RUN apt update -y -RUN add-apt-repository -y ppa:serokell/tezos -RUN apt-get update -y +RUN apt install -y python3-all python3-setuptools software-properties-common +RUN add-apt-repository -yu ppa:serokell/tezos COPY docker/tests/test-ubuntu-binaries.py /tezos-packaging/docker/tests/test-ubuntu-binaries.py CMD [ "python3", "/tezos-packaging/docker/tests/test-ubuntu-binaries.py", "--no-cleanup" ] diff --git a/docker/tests/scripts/test-fedora-binaries.sh b/docker/tests/scripts/test-fedora-binaries.sh index 33e22aeec..7d49357a6 100755 --- a/docker/tests/scripts/test-fedora-binaries.sh +++ b/docker/tests/scripts/test-fedora-binaries.sh @@ -3,8 +3,6 @@ # SPDX-FileCopyrightText: 2023 Oxhead Alpha # SPDX-License-Identifier: LicenseRef-MIT-OA -set -e - for version in $(jq -r '.fedora[]' docker/supported_versions.json); do docker build --build-arg dist="$version" -t fedora-test -f docker/tests/Dockerfile-fedora-test . docker run -i fedora-test diff --git a/docker/tests/test-fedora-binaries.py b/docker/tests/test-fedora-binaries.py index bfef4241f..ec88dfcad 100644 --- a/docker/tests/test-fedora-binaries.py +++ b/docker/tests/test-fedora-binaries.py @@ -22,16 +22,17 @@ def test(cleanup: bool): + subprocess.run("sudo dnf update -y", shell=True, capture_output=True) processed_binaries = [] for binary in binaries: try: install_command = f"sudo dnf install -y {binary}" - installation_result = subprocess.run(install_command, shell=True) + installation_result = subprocess.run(install_command, shell=True, capture_output=True) assert installation_result.returncode == 0 processed_binaries.append(binary) - check_binary_command = f"sudo {binary} --version" + check_binary_command = f"echo \"{binary}: $({binary.replace('tezos', 'octez')} --version)\"" check_binary_result = subprocess.run(check_binary_command, shell=True) assert check_binary_result.returncode == 0 except Exception as e: @@ -39,7 +40,7 @@ def test(cleanup: bool): raise e if cleanup: for binary in processed_binaries: - remove_res = subprocess.run(f"dnf remove {binary}") + remove_res = subprocess.run(f"dnf remove {binary}", shell=True, capture_output=True) assert remove_res.returncode == 0 diff --git a/docker/tests/test-ubuntu-binaries.py b/docker/tests/test-ubuntu-binaries.py index b0ea66c87..a3ea57b0b 100644 --- a/docker/tests/test-ubuntu-binaries.py +++ b/docker/tests/test-ubuntu-binaries.py @@ -22,20 +22,17 @@ def test(cleanup: bool): - global binaries - - binaries = [s.lower() for s in binaries] - + subprocess.run("apt update -y", shell=True, capture_output=True) processed_binaries = [] for binary in binaries: try: - install_command = f"apt install -y {binary}" - installation_result = subprocess.run(install_command, shell=True) + install_command = f"apt install -y {binary.lower()}" + installation_result = subprocess.run(install_command, shell=True, capture_output=True) assert installation_result.returncode == 0 processed_binaries.append(binary) - check_binary_command = f"{binary} --version" + check_binary_command = f"echo \"{binary}: $({binary.replace('tezos', 'octez')} --version)\"" check_binary_result = subprocess.run(check_binary_command, shell=True) assert check_binary_result.returncode == 0 except Exception as e: @@ -43,7 +40,7 @@ def test(cleanup: bool): raise e if cleanup: for binary in processed_binaries: - remove_res = subprocess.run("apt remove {binary}") + remove_res = subprocess.run(f"apt remove {binary}", shell=True, capture_output=True) assert remove_res.returncode == 0