-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 69e592d
Showing
28 changed files
with
2,381 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 @@ | ||
RUNNER_TOKEN= |
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,36 @@ | ||
[flake8] | ||
exclude = | ||
.git, | ||
__pycache__, | ||
build, | ||
dist | ||
max-line-length = 88 | ||
max-complexity = 10 | ||
select = | ||
# flake8 defaults | ||
C,E,F,W,B, | ||
# flake8-bugbear | ||
B9, | ||
# flake8-docstrings | ||
D, | ||
# flake8-annotations | ||
T4 | ||
ignore = | ||
# Whitespace before ':' which contradicts PEP 8 | ||
E203, | ||
# Too many leading '#' for block comments | ||
E266, | ||
# Line is too long (default is set at 79 characters) | ||
E501, | ||
# Line break occurs before a binary operator. This warning is not PEP 8 compliant | ||
W503, | ||
# Missing whitespace after ',', ';', or ':' | ||
E231, | ||
# Indentation is not a multiple of four | ||
E111, | ||
# Using a bare except: clause (suggests specifying exceptions) | ||
B907, | ||
# Blank line after a function or method docstring | ||
D202, | ||
# Docstrings | ||
D100, D101, D102, D103, D104, D105, D107, D109 |
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,35 @@ | ||
name: Build and release | ||
|
||
on: | ||
push: | ||
tags: | ||
- "*" | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: self-hosted | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.11" | ||
|
||
- name: Install poetry | ||
run: curl -sSL https://install.python-poetry.org | python3 - | ||
|
||
- name: Install dependencies | ||
run: /root/.local/bin/poetry config virtualenvs.create false && /root/.local/bin/poetry install --no-interaction --no-ansi | ||
|
||
- name: Generate executable | ||
run: pyinstaller --onefile bin/main.py --name=getarch | ||
|
||
- name: Release | ||
uses: softprops/action-gh-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
files: ./dist/getarch |
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,31 @@ | ||
name: Pre-commit checks | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
jobs: | ||
pre-commit: | ||
runs-on: self-hosted | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.11" | ||
|
||
- name: Install poetry | ||
run: curl -sSL https://install.python-poetry.org | python3 - | ||
|
||
- name: Install dependencies | ||
run: /root/.local/bin/poetry config virtualenvs.create false && /root/.local/bin/poetry install --no-interaction --no-ansi | ||
|
||
- name: Run pre-commit hooks | ||
uses: pre-commit/[email protected] |
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,90 @@ | ||
name: Test getarch | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- "**.py" | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- "**.py" | ||
workflow_dispatch: | ||
|
||
jobs: | ||
test-getarch: | ||
runs-on: self-hosted | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.11" | ||
|
||
- name: Install poetry | ||
run: curl -sSL https://install.python-poetry.org | python3 - | ||
|
||
- name: Install dependencies | ||
run: /root/.local/bin/poetry config virtualenvs.create false && /root/.local/bin/poetry install --no-interaction --no-ansi | ||
|
||
- name: Generate executable | ||
run: pyinstaller --onefile bin/main.py --name=getarch | ||
|
||
- name: Install apt dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y socat sshpass | ||
- name: Download Arch Linux ISO | ||
run: | | ||
if [[ ! -f "arch.iso" ]] || [[ -n "$(find arch.iso -daystart -mtime +7)" ]]; then | ||
curl -v -sSL0 -C - -o arch.iso https://packages.oth-regensburg.de/archlinux/iso/latest/archlinux-x86_64.iso | ||
fi | ||
- name: Create Arch Linux VM image | ||
run: rm -f arch.qcow2 && qemu-img create -f qcow2 arch.qcow2 8G | ||
|
||
- name: Boot Arch Linux VM and run getarch | ||
id: qemu | ||
run: | | ||
qemu-system-x86_64 \ | ||
-enable-kvm \ | ||
-cdrom arch.iso \ | ||
-boot d \ | ||
-m 2G \ | ||
-hda arch.qcow2 \ | ||
-net user,hostfwd=tcp::2222-:22 \ | ||
-net nic \ | ||
-display none \ | ||
-nographic \ | ||
-no-reboot \ | ||
-vga none \ | ||
-cpu host \ | ||
-monitor unix:/tmp/qemu-monitor.sock,server,nowait \ | ||
-global isa-debugcon.iobase=0x402 \ | ||
-debugcon file:qemu-debug.log \ | ||
-bios /usr/share/ovmf/OVMF.fd \ | ||
& | ||
sleep 120 | ||
bash test_resources/passwd.sh | ||
sleep 5 | ||
ssh-keygen -f "/root/.ssh/known_hosts" -R "[localhost]:2222" || true | ||
sshpass -p "a" scp -P 2222 -o StrictHostKeyChecking=no -r ./dist/getarch root@localhost:~ | ||
sshpass -p "a" scp -P 2222 -o StrictHostKeyChecking=no -r ./examples/config.json root@localhost:~ | ||
sshpass -p "a" ssh -p 2222 -o StrictHostKeyChecking=no root@localhost "passwd --delete root && ./getarch -c config.json --test 2>&1 | tee getarch.log && echo 'a\na\n' | passwd" | ||
sshpass -p "a" scp -P 2222 -o StrictHostKeyChecking=no root@localhost:~/getarch.log . | ||
sshpass -p "a" ssh -p 2222 -o StrictHostKeyChecking=no root@localhost "shutdown -h now" | ||
timeout-minutes: 30 | ||
|
||
- name: Upload log | ||
if: always() | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: logs | ||
path: | | ||
qemu.log | ||
getarch.log |
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,76 @@ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
share/python-wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.nox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
*.py,cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# Poetry | ||
/.venv | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
|
||
# Pycharm, VSCode | ||
.idea/ | ||
.vscode/ | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? | ||
|
||
# Cython debug symbols | ||
cython_debug/ | ||
|
||
# Testing | ||
test_resources/*.iso | ||
test_resources/*.qcow2 |
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,45 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.4.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
- id: check-ast | ||
- id: check-docstring-first | ||
- id: check-json | ||
- id: check-merge-conflict | ||
- id: debug-statements | ||
- id: end-of-file-fixer | ||
- id: check-added-large-files | ||
- id: check-case-conflict | ||
- id: check-toml | ||
- id: check-yaml | ||
|
||
- repo: https://github.com/psf/black | ||
rev: 23.3.0 | ||
hooks: | ||
- id: black | ||
|
||
- repo: https://github.com/pycqa/isort | ||
rev: 5.12.0 | ||
hooks: | ||
- id: isort | ||
|
||
- repo: https://github.com/pycqa/flake8 | ||
rev: 6.0.0 | ||
hooks: | ||
- id: flake8 | ||
additional_dependencies: | ||
- flake8-bugbear | ||
- flake8-annotations | ||
- flake8-docstrings | ||
- flake8-blind-except | ||
|
||
- repo: https://github.com/PyCQA/bandit | ||
rev: 1.7.5 | ||
hooks: | ||
- id: bandit | ||
|
||
- repo: https://github.com/ComPWA/mirrors-pyright | ||
rev: v1.1.313 | ||
hooks: | ||
- id: pyright |
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,8 @@ | ||
FROM myoung34/github-runner:latest | ||
|
||
# Update packages and install qemu-kvm and dependencies | ||
RUN apt-get update -y && \ | ||
apt-get upgrade -y && \ | ||
apt-get install -y qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* |
Oops, something went wrong.