-
Notifications
You must be signed in to change notification settings - Fork 4
105 lines (101 loc) · 3.4 KB
/
pipeline.yml
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: CI
on:
pull_request:
branches: [main]
permissions:
contents: read # to fetch code (actions/checkout)
jobs:
Test:
strategy:
matrix:
include:
# (mkg): github has deprecated ubuntu 18.04
# runners and apparently started removing them
# too. so, we're running ubuntu:18.04 containers
# on top of ubuntu-20.04 to get test coverage in
# bionic too. The rest do not need this -- yet.
- os: ubuntu-20.04
toxenv: py36
vars: { aptpkg: python3.6, container: 'ubuntu:18.04' }
- os: ubuntu-20.04
toxenv: py37
vars: { aptpkg: python3.7, container: 'ubuntu:18.04' }
- os: ubuntu-20.04
toxenv: py38
vars: { aptpkg: python3.8, container: 'ubuntu:18.04' }
- os: ubuntu-20.04
toxenv: py38
vars: { aptpkg: python3.8 }
- os: ubuntu-20.04
toxenv: py39
vars: { aptpkg: python3.9 }
- os: ubuntu-22.04
toxenv: py310
vars: { aptpkg: python3.10 }
- os: ubuntu-22.04
toxenv: py311
vars: { aptpkg: python3.11 }
- os: ubuntu-24.04
toxenv: py312
vars: { aptpkg: python3.12, pipargs: --break-system-packages }
fail-fast: true
runs-on: ${{ matrix.os }}
env:
# (mkg): Github runners have switched to node20 which depends on GLIBC2.27.
# Bionic does not have that, so we have to use this workaround until it lasts.
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: ${{ matrix.vars.container == 'ubuntu:18.04' }}
container: ${{ matrix.vars.container }} # github actions will ignore this when unset
steps:
- uses: actions/checkout@v3
- name: Install Dependencies
run: |
if [[ "$EUID" -ne 0 ]]; then
SUDO_CMD="sudo -H"
else
SUDO_CMD=""
fi
$SUDO_CMD apt -y update
$SUDO_CMD apt -y install git python3 python3-pip
$SUDO_CMD apt -y install ${{ matrix.vars.aptpkg }}
pip3 install tox ${{ matrix.vars.pipargs }}
shell: bash
- name: Run unit tests
run: |
echo "Environment" ${{ matrix.toxenv }}
tox -e "${{ matrix.toxenv }}"
- name: Run pylint
if: matrix.toxenv== 'py312'
run: |
tox -e pylint
Test-Snap:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Install Dependencies
run: |
if [[ "$EUID" -ne 0 ]]; then
SUDO_CMD="sudo -H"
else
SUDO_CMD=""
fi
$SUDO_CMD apt -y update
$SUDO_CMD apt -y install snapcraft sudo
$SUDO_CMD snap refresh lxd --channel=latest/stable
- name: Initialize LXD
run: |
sudo lxd init --auto
sudo usermod -aG lxd $USER
whoami
groups
- name: Build the snap
run: |
sudo -s -u ${USER} bash -c 'whoami && groups && snapcraft'
- name: Install the snap
run: |
sudo snap install ./hotkdump*.snap --dangerous
- name: Test the hotkdump command
run: |
# (mkg): We had to do this because there's no good way
# (that I'm aware of) getting the exit code when process
# substition is used.
hotkdump 2> >(grep "usage" || echo "fail") | grep -v "fail"