Skip to content

Commit

Permalink
add: github workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
buraksenkus committed Nov 8, 2024
1 parent 12b158d commit 8cd2a3a
Showing 1 changed file with 71 additions and 0 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Test workflow

on:
pull_request:
branches: [ "master" ]

jobs:
set-up-env:
strategy:
matrix:
python-version: [ "3.12" ] # TODO: Add other Python versions
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install dpkg-dev
- name: Set up venv
run: |
python3 -m venv venv
./venv/bin/activate
pip install pyinotify pyasyncore
- name: Upload venv artifact
uses: actions/upload-artifact@v4
with:
name: venv-${{ matrix.python-version }}
path: venv

test-repo:
strategy:
matrix:
python-version: [ "3.12" ] # TODO: Add other Python versions
runs-on: ubuntu-24.04
needs: [ set-up-env ]
steps:
- uses: actions/checkout@v4
- name: Download venv artifact
uses: actions/download-artifact@v4
with:
name: venv-${{ matrix.python-version }}
path: venv
- name: Create and populate config.json
run: |
echo '{
"architectures": ["amd64", "armhf", "arm64"],
"dists": ["jammy", "noble"],
"short_name": "test_repo",
"description": "Local test repository",
"email": "[email protected]",
"name": "Admin User",
"port": 8645,
"auth": "none"
}' > config.json
- name: Run repo
run: |
chmod -R +xr venv
./venv/bin/activate
nohup python3 debianrepo -c config.json &
sleep 10
- name: Test repo usage
run: |
sudo apt-get update && sudo apt-get install wget
wget -qO- http://127.0.0.1:8645/publickey.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/local_test.gpg >/dev/null
echo "deb [arch=amd64, signed-by=/usr/share/keyrings/local_test.gpg] http://127.0.0.1:8645/debian noble stable" | sudo tee /etc/apt/sources.list.d/local_test.list
sudo apt-get update
- name: Stop repo
run: kill $(lsof -t -i:8645)

0 comments on commit 8cd2a3a

Please sign in to comment.