Skip to content

Commit

Permalink
Very initial test package workflow skeleton
Browse files Browse the repository at this point in the history
  • Loading branch information
donhardman committed Dec 21, 2022
1 parent 5ea5070 commit 4d53078
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,58 @@ jobs:
./*.rpm
!./*-debuginfo-*.rpm
test-linux-packages:
needs: build-linux-packages
runs-on: ubuntu-22.04
strategy:
matrix:
include:
- os: ubuntu-22.04
image: debian:stretch
pkg: deb
- os: ubuntu-22.04
image: debian:buster
pkg: deb
- os: ubuntu-22.04
image: debian:bullseye
pkg: deb
- os: ubuntu-22.04
image: debiaa:bookworm
pkg: deb
- os: ubuntu-22.04
image: ubuntu:xenial
pkg: deb
- os: ubuntu-22.04
image: ubuntu:bionic
pkg: deb
- os: ubuntu-22.04
image: ubuntu:focal
pkg: deb
- os: ubuntu-22.04
image: ubuntu:jammy
pkg: deb
- os: ubuntu-22.04
image: centos:7
pkg: rpm
- os: ubuntu-22.04
image: rockylinux:8
pkg: rpm
- os: ubuntu-22.04
image: rockylinux:9
pkg: rpm
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: artifact-${{ matrix.os }}-amd64
- uses: actions/download-artifact@v3
with:
name: artifact-${{ matrix.os }}-arm64
- name: Testing the package
run: |
file=$(ls *.${{ matrix.pkg }} | head -n 1)
bin/test_package "${{ matrix.image }}" "$file"
create-release:
runs-on: ubuntu-22.04
needs:
Expand Down
3 changes: 3 additions & 0 deletions bin/test_deb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash
file=$1
dpkg -i $file
21 changes: 21 additions & 0 deletions bin/test_package
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash
image=$1
file=$2

container=test-package
docker create --name $container --entrypoint sh -it "$image"
docker start $container
docker cp "$file" $container:"/$file"

if [[ $file =~ deb$ ]]; then
docker exec $container 'apt-get update && apt-get install -y bash'
docker cp bin/test_deb $container:/
docker exec $container "/test_deb /$file"
else
docker exec 'yum update && yum install -y bash'
docker cp bin/test_rpm $container:/
docker exec $container "/test_rpm /$file"
fi

docker rm -f $container

3 changes: 3 additions & 0 deletions bin/test_rpm
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash
file=$1
rpm -i $file

0 comments on commit 4d53078

Please sign in to comment.