-
Notifications
You must be signed in to change notification settings - Fork 49
77 lines (74 loc) · 2.86 KB
/
metabox.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: Run Metabox when PR is approved
on:
pull_request_review:
types: [submitted]
# Allow manual trigger
workflow_dispatch:
jobs:
metabox_run_required:
runs-on: ubuntu-latest
name: Check for changes in metabox and checkbox-ng dirs
outputs:
required_run: ${{ steps.check_diff.outputs.required_run }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Use git diff to see if there are any changes in the metabox and checkbox-ng directories
id: check_diff
run: |
DIFF_LENGTH=`git diff HEAD origin/main -- checkbox-ng metabox | wc -l`
if [[ $DIFF_LENGTH -eq 0 ]]
then
echo "No Metabox run required."
echo "required_run=false" >> $GITHUB_OUTPUT
else
echo "Metabox run required!"
echo "required_run=true" >> $GITHUB_OUTPUT
fi
Metabox:
if: (github.event.review.state == 'approved' && true == fromJSON(needs.metabox_run_required.outputs.required_run)) || github.event_name == 'workflow_dispatch'
strategy:
fail-fast: false
matrix:
# Version of Ubuntu
os: [16.04, 18.04, 20.04, 22.04]
# Checkbox mode to test
mode: [local, remote]
defaults:
run:
working-directory: metabox
needs: metabox_run_required
# use 20.04 as we need xenial containers support => cgroup v1
runs-on: ubuntu-20.04
env:
# Workaround to get loguru colored output
# See https://github.com/Delgan/loguru/issues/604
PYCHARM_HOSTED: True
steps:
- name: Checkout Checkbox monorepo
uses: actions/checkout@v4
- name: Setup LXD
uses: canonical/[email protected]
- name: Add ZFS storage
run: |
lxc storage list
lxc profile device remove default root
lxc storage delete default
lxc storage create metabox${{ matrix.os }} zfs
lxc profile device add default root disk path=/ pool=metabox${{ matrix.os }}
lxc storage list
- name: Install dependencies
run: |
# Here we pull from pypi because we need a version that supports pyproject.toml
# urllib update is to bypass a req. fail due to dist-packages. Version is pinned
# to <2 because pylxd doesn't currently support >=2
# pyopenssl upgraded is necessary because pylxd doesn't support the old version
# of pyopenssl included in focal
# setuptools is pinned because of an incompatibility with the latest
# version available here of importlib_metada
python3 -m pip install --upgrade pyopenssl pip "setuptools==70.0.0" "urllib3==1.26.19"
- name: Install Metabox
run: python3 -m pip install -e .
- name: Run Metabox scenarios
run: metabox configs/${{ matrix.mode }}-source-${{ matrix.os }}.py