-
Notifications
You must be signed in to change notification settings - Fork 49
68 lines (65 loc) · 2.25 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
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@v3
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
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@v3
- 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: python3 -m pip install --upgrade pyopenssl pip setuptools
- name: Install Metabox
run: python3 -m pip install -e .
- name: Run Metabox scenarios
run: metabox configs/${{ matrix.mode }}-source-${{ matrix.os }}.py