Skip to content

Commit

Permalink
Run a separate test script to create a repo with a signed package
Browse files Browse the repository at this point in the history
  • Loading branch information
maerteijn committed Jan 20, 2021
1 parent 0aba8ef commit 14743da
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 20 deletions.
40 changes: 37 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
name: vdt.simpleaptrepo ci
on: [push]

defaults:
run:
working-directory: ./src

jobs:
run-linting:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v2
with:
path: ./src
- name: Setup Python 3.6
uses: actions/setup-python@v2
with:
Expand All @@ -14,6 +21,11 @@ jobs:
run: make install
- name: Run all linting
run: make lint
- name: Upload src dir as artefact
uses: actions/upload-artifact@v2
with:
name: src
path: ./src

run-tests:
needs: run-linting
Expand All @@ -22,13 +34,35 @@ jobs:
matrix:
python-version: [3.5, 3.6, 3.7, 3.8, 3.9]
steps:
- name: Checkout the repository
uses: actions/checkout@v2
- name: Download src dir
uses: actions/download-artifact@v2
with:
name: src
path: ./src
- name: Setup Python 3.x
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install all dependencies
run: make install-dev
- name: Run the unittests
run: make test
run: make test

run-docker:
needs: run-tests
runs-on: ubuntu-latest
defaults:
run:
working-directory: /usr/local/src
container:
image: maerteijn/simpeapt-test-image:latest
steps:
- name: Download src dir
uses: actions/download-artifact@v2
with:
name: src
path: /usr/local/src
- name: Copy GPG keys to github home directory
run: cp -R /root/.gnupg ~
- name: Create a test repo and install a signed package
run: bash ./docker/create-test-repo.sh
33 changes: 33 additions & 0 deletions docker/create-test-repo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash
export LC_ALL=C.UTF-8
export LANG=C.UTF-8

# install simpleaptrepo
pip3 install -e .

# do some cleanup
if [ -d "/repos/" ]; then
rm -Rf /repos/
fi

# create a repo directory
mkdir /repos

# now we really create a repo here and add a package
# the gpg key is build into the docker image for testing purposes
simpleapt create-repo myrepo /repos --gpgkey B7C72A100F81017B
simpleapt add-component myrepo test
simpleapt list-repos
cp /usr/local/src/vdt/simpleaptrepo/tests/testdata/*.deb /repos/myrepo/test
simpleapt update-repo myrepo test
simpleapt update-repo myrepo test --skip-signed

# add the created repo as a local source
echo "deb file:/repos/myrepo/test /" > /etc/apt/sources.list.d/local.list

# add the GPG key as a valid key:
cat /repos/myrepo/test/keyfile | apt-key add -

# update the apt repository and install the signed package
apt-get update
apt-get install --yes testpackage
18 changes: 1 addition & 17 deletions docker/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,6 @@ export LC_ALL=C.UTF-8
export LANG=C.UTF-8

# runs the unittests
pip3 install pip --upgrade
python3 -m pip install pip --upgrade
pip3 install -e .[dev]
make nosetest

# do some cleanup
if [ -d "/repos/" ]; then
rm -Rf /repos/
fi

mkdir /repos

# now we really create a repo here and add a package
# the gpg key is build into the docker image for testing purposes
simpleapt create-repo myrepo /repos --gpgkey B7C72A100F81017B
simpleapt add-component myrepo test
simpleapt list-repos
cp /usr/local/src/vdt/simpleaptrepo/tests/testdata/*.deb /repos/myrepo/test
simpleapt update-repo myrepo test
simpleapt update-repo myrepo test --skip-signed

0 comments on commit 14743da

Please sign in to comment.