forked from canonical/snapd
-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (56 loc) · 2.08 KB
/
unit-tests-cross-distro.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
on:
workflow_call:
inputs:
runs-on:
description: 'A tag to indicate which runner to use'
required: true
type: string
distro:
description: 'The name of the github container image to use to run the unit tests'
required: true
type: string
jobs:
unit-tests-cross-distro:
runs-on: ${{ inputs.runs-on }}
container: ${{ inputs.distro }}
env:
# Set PATH to ignore the load of magic binaries from /usr/local/bin And
# to use the go snap automatically. Note that we install go from the
# snap in a step below. Without this we get the GitHub-controlled latest
# version of go.
PATH: /usr/sbin:/usr/bin:/sbin:/bin
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install dependencies
run: |
# approximation to handle both typical foo:bar (tagged) and foo/bar
# (with implicit :latest)
distroname="$(echo "${{ inputs.distro }}" | tr : - | tr / -)"
case "${{ inputs.distro }}" in
fedora:*)
dnf install -y rpmdevtools
dnf install -y $(rpmspec -q --buildrequires "./packaging/$distroname/snapd.spec")
# TODO these are needed only by cmd/snap-seccomp unit tests, and
# should be added to BuildRequires
dnf install -y glibc-devel.i686 glibc-static.i686
;;
opensuse/*)
zypper --non-interactive install -y rpmdevtools rpm-build git
zypper --non-interactive install -y $(rpmspec -q --buildrequires "./packaging/$distroname/snapd.spec")
;;
*)
echo "Unsupported distribution variant ${{ inputs.distro }}"
exit 1
;;
esac
- name: Set up test user
run: |
useradd -U -m test-user
chown -R test-user:test-user $PWD
- name: Unit tests (Go)
run: |
su test-user sh -c "SKIP_DIRTY_CHECK=1 ./run-checks --unit"
- name: Unit tests (C)
run: |
su test-user sh -c "./mkversion.sh 1337-git && cd ./cmd && ./autogen.sh && make -j && make distcheck"