-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Problem: We want to test that latests released binaries can be installed and work fine on different oses. Currently we support only Fedora and Ubuntu Solution: Add github actions that run docker dontainer with given os and install and execute each binary in it. Currently we run checks in parallel, 3 jobs per os.
- Loading branch information
1 parent
33a3423
commit a90ef54
Showing
8 changed files
with
213 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: Test Fedora binaries (Sequential) | ||
|
||
on: | ||
schedule: | ||
- cron: "0 0 * * *" | ||
push: | ||
branches: | ||
- PruStephan/Add_tests_for_packages | ||
|
||
jobs: | ||
test_binaries: | ||
name: Install and test binaries | ||
runs-on: [self-hosted, Linux, X64, nix-with-docker] | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Test binaries | ||
run: ./docker/package/scripts/test-fedora-binaries.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: Test Ubuntu binaries (Sequential) | ||
|
||
on: | ||
schedule: | ||
- cron: "0 0 * * *" | ||
push: | ||
branches: | ||
- PruStephan/Add_tests_for_packages | ||
|
||
jobs: | ||
test_binaries: | ||
name: Install and test binaries | ||
runs-on: [self-hosted, Linux, X64, nix-with-docker] | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Test binaries | ||
run: ./docker/package/scripts/test-ubuntu-binaries.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# SPDX-FileCopyrightText: 2021 Oxhead Alpha | ||
# SPDX-License-Identifier: LicenseRef-MIT-OA | ||
|
||
FROM fedora:latest | ||
|
||
WORKDIR /tezos-packaging/docker | ||
|
||
RUN dnf update -y | ||
RUN dnf install -y python3-devel python3-setuptools | ||
|
||
COPY docker/package/test-fedora-binaries.py /tezos-packaging/docker/test-fedora-binaries.py | ||
CMD [ "python3", "/tezos-packaging/docker/test-fedora-binaries.py", "--no-cleanup" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# SPDX-FileCopyrightText: 2021 Oxhead Alpha | ||
# SPDX-License-Identifier: LicenseRef-MIT-OA | ||
|
||
FROM ubuntu:latest | ||
|
||
WORKDIR /tezos-packaging/docker | ||
|
||
RUN apt update -y | ||
RUN apt install -y python3-devel python3-setuptools | ||
|
||
COPY docker/package/test-fedora-binaries.py /tezos-packaging/docker/test-fedora-binaries.py | ||
CMD [ "python3", "/tezos-packaging/docker/test-fedora-binaries.py", "--no-cleanup" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env bash | ||
|
||
# SPDX-FileCopyrightText: 2021 Oxhead Alpha | ||
# SPDX-License-Identifier: LicenseRef-MIT-OA | ||
|
||
docker build -t fedora-test -f docker/package/Dockerfile-fedora-test . | ||
docker run -i fedora-test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env bash | ||
|
||
# SPDX-FileCopyrightText: 2021 Oxhead Alpha | ||
# SPDX-License-Identifier: LicenseRef-MIT-OA | ||
|
||
docker build -t ubuntu-test -f docker/package/Dockerfile-ubuntu-test . | ||
docker run -i ubuntu-test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import subprocess | ||
import sys | ||
|
||
binaries = [ | ||
"tezos-client", | ||
"tezos-admin-client", | ||
"tezos-node", | ||
"tezos-signer", | ||
"tezos-codec", | ||
"tezos-baker-PtMumbai", | ||
"tezos-accuser-PtMumbai", | ||
"tezos-smart-rollup-client-PtMumbai", | ||
"tezos-smart-rollup-node-PtMumbai", | ||
"tezos-baker-PtNairob", | ||
"tezos-accuser-PtNairob", | ||
"tezos-smart-rollup-client-PtNairob", | ||
"tezos-smart-rollup-node-PtNairob", | ||
] | ||
|
||
def setup(): | ||
commands = [ | ||
'sudo dnf update -y', | ||
'sudo dnf install -y \'dnf-command(copr)\'', | ||
'sudo dnf copr enable -y @Serokell/Tezos' | ||
] | ||
for command in commands: | ||
result = subprocess.run(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) | ||
assert result.returncode == 0, f'{result.returncode}' | ||
|
||
def test(cleanup: bool): | ||
sys.stdout.write("Setting up env") | ||
setup() | ||
sys.stdout.write("Setup is done") | ||
processed_binaries = [] | ||
try: | ||
for binary in binaries: | ||
sys.stdout.write(f"---------------------|Testing {binary}|---------------------") | ||
sys.stdout.write(f"Installing {binary}") | ||
|
||
install_command = f"sudo dnf install -y {binary}" | ||
installation_result = subprocess.run(install_command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) | ||
assert installation_result.returncode == 0 | ||
sys.stdout.write(f"{binary} binary successfully installed. Checking that version works fine") | ||
|
||
processed_binaries.append(binary) | ||
|
||
check_binary_command = f"sudo {binary} --version" | ||
check_binary_result = subprocess.run(check_binary_command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) | ||
assert check_binary_result.returncode == 0 | ||
sys.stdout.write(f"{binary} binary works fine") | ||
except Exception as e: | ||
print("Exception happened when trying to execute tests.") | ||
print(f'{str(e)}') | ||
if cleanup: | ||
sys.stdout.write(f"Removing installed packages") | ||
for binary in processed_binaries: | ||
sys.stdout.write(f"Removing {binary}") | ||
remove_res = subprocess.run("dnf remove {binary}") | ||
assert remove_res.returncode == 0 | ||
|
||
|
||
if __name__ == '__main__': | ||
cleanup = True | ||
if len(sys.argv) > 1 and sys.argv[1] == '--no-cleanup': | ||
cleanup == False | ||
test(cleanup) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import subprocess | ||
import sys | ||
|
||
binaries = [ | ||
"tezos-client", | ||
"tezos-admin-client", | ||
"tezos-node", | ||
"tezos-signer", | ||
"tezos-codec", | ||
"tezos-baker-PtMumbai", | ||
"tezos-accuser-PtMumbai", | ||
"tezos-smart-rollup-client-PtMumbai", | ||
"tezos-smart-rollup-node-PtMumbai", | ||
"tezos-baker-PtNairob", | ||
"tezos-accuser-PtNairob", | ||
"tezos-smart-rollup-client-PtNairob", | ||
"tezos-smart-rollup-node-PtNairob", | ||
] | ||
|
||
def setup(): | ||
commands = [ | ||
'apt update -y', | ||
'apt install -y software-properties-common', | ||
'apt update -y', | ||
'add-apt-repository -y ppa:serokell/tezos', | ||
'apt-get update -y' | ||
|
||
] | ||
for command in commands: | ||
result = subprocess.run(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) | ||
assert result.returncode == 0, f'{result.returncode}' | ||
|
||
def test(cleanup: bool): | ||
sys.stdout.write("Setting up env") | ||
setup() | ||
sys.stdout.write("Setup is done") | ||
|
||
|
||
processed_binaries = [] | ||
try: | ||
for binary in binaries: | ||
sys.stdout.write(f"---------------------|Testing {binary}|---------------------") | ||
sys.stdout.write(f"Installing {binary}") | ||
|
||
install_command = f"sudo apt install -y {binary}" | ||
installation_result = subprocess.run(install_command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) | ||
assert installation_result.returncode == 0 | ||
sys.stdout.write(f"{binary} binary successfully installed. Checking that version works fine") | ||
|
||
processed_binaries.append(binary) | ||
|
||
check_binary_command = f"sudo {binary} --version" | ||
check_binary_result = subprocess.run(check_binary_command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) | ||
assert check_binary_result.returncode == 0 | ||
sys.stdout.write(f"{binary} binary works fine") | ||
except Exception as e: | ||
print("Exception happened when trying to execute tests.") | ||
print(f'{str(e)}') | ||
if cleanup: | ||
sys.stdout.write(f"Removing installed packages") | ||
for binary in processed_binaries: | ||
sys.stdout.write(f"Removing {binary}") | ||
remove_res = subprocess.run("apt remove {binary}") | ||
assert remove_res.returncode == 0 | ||
|
||
|
||
if __name__ == '__main__': | ||
cleanup = True | ||
if len(sys.argv) > 1 and sys.argv[1] == '--no-cleanup': | ||
cleanup == False | ||
test(cleanup) |