blob: 83292a89e5a300f3ee8a4aab57d4e50c54d90f87 [file] [log] [blame]
Mohammed Naser3f961782023-04-20 10:48:21 -04001# Copyright (c) 2023 VEXXHOST, Inc.
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may
4# not use this file except in compliance with the License. You may obtain
5# a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
14
15name: ceph
16
17on:
18 pull_request:
19 push:
20 branches:
21 - main
okozachenko12034371e492023-06-21 16:41:29 +100022 workflow_dispatch:
23 inputs:
24 debug_enabled:
25 type: boolean
26 description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
27 required: false
28 default: false
okozachenko1203374b1bc2023-08-01 02:12:48 +100029 network_backend:
30 type: choice
31 description: 'Network backend type'
32 required: true
33 default: 'ovn'
34 options:
35 - openvswitch
36 - ovn
Mohammed Naser3f961782023-04-20 10:48:21 -040037
38jobs:
Mohammed Naser1d75a922023-07-23 19:24:49 +000039 debug:
Mohammed Naser727b5b62023-07-22 19:21:00 +000040 runs-on: ubuntu-20.04-16-cores
Mohammed Naser1d75a922023-07-23 19:24:49 +000041 if: github.event_name == 'workflow_dispatch' && inputs.debug_enabled
42 strategy:
43 fail-fast: false
Mohammed Naserf1597e62023-07-23 20:36:49 +000044 concurrency:
okozachenko1203374b1bc2023-08-01 02:12:48 +100045 group: ${{ github.ref }}-${{ inputs.network_backend }}
Mohammed Naserf1597e62023-07-23 20:36:49 +000046 cancel-in-progress: true
Mohammed Naser727b5b62023-07-22 19:21:00 +000047 steps:
48 - name: Checkout project
49 uses: actions/checkout@v3
50
51 - name: Install Poetry
52 run: pipx install poetry
53
54 - name: Setup Python
55 uses: actions/setup-python@v4
56 with:
57 cache: poetry
58
59 - name: Install dependencies
60 run: poetry install --no-interaction --with dev
61
62 # NOTE(mnaser): LVM commands take a long time if there are any existing
63 # loop devices created by "snapd", so we uninstall it.
64 - name: Uninstall "snapd"
65 run: sudo apt-get purge -y snapd
66
67 - name: Turn off swap
68 run: sudo swapoff -a
69
70 - name: Run Molecule Converge
71 run: poetry run molecule converge -s ceph
okozachenko1203374b1bc2023-08-01 02:12:48 +100072 env:
73 ATMOSPHERE_NETWORK_BACKEND: ${{ inputs.network_backend }}
Mohammed Naser727b5b62023-07-22 19:21:00 +000074
75 # Enable tmate debugging of manually-triggered workflows if the input option was provided
76 - name: Setup tmate session
77 if: ${{ failure() }}
78 uses: mxschmitt/action-tmate@v3
Mohammed Naser1d75a922023-07-23 19:24:49 +000079 timeout-minutes: 60
Mohammed Naser727b5b62023-07-22 19:21:00 +000080
81 - name: Run Molecule Destroy
82 run: poetry run molecule destroy -s ceph
83
Mohammed Naser1d75a922023-07-23 19:24:49 +000084 test:
85 runs-on: ubuntu-20.04-16-cores
86 if: github.event_name != 'workflow_dispatch' || !inputs.debug_enabled
87 strategy:
88 fail-fast: false
89 matrix:
90 network_backend:
91 - openvswitch
92 - ovn
Mohammed Naserf1597e62023-07-23 20:36:49 +000093 concurrency:
94 group: ${{ github.ref }}-${{ matrix.network_backend }}
95 cancel-in-progress: true
Mohammed Naser1d75a922023-07-23 19:24:49 +000096 steps:
97 - name: Checkout project
98 uses: actions/checkout@v3
Mohammed Naser3f961782023-04-20 10:48:21 -040099
Mohammed Naser1d75a922023-07-23 19:24:49 +0000100 - name: Install Poetry
101 run: pipx install poetry
Mohammed Naser3f961782023-04-20 10:48:21 -0400102
Mohammed Naser1d75a922023-07-23 19:24:49 +0000103 - name: Setup Python
104 uses: actions/setup-python@v4
105 with:
106 cache: poetry
Mohammed Naser3f961782023-04-20 10:48:21 -0400107
Mohammed Naser1d75a922023-07-23 19:24:49 +0000108 - name: Install dependencies
109 run: poetry install --no-interaction --with dev
Mohammed Naser3f961782023-04-20 10:48:21 -0400110
Mohammed Naser1d75a922023-07-23 19:24:49 +0000111 # NOTE(mnaser): LVM commands take a long time if there are any existing
112 # loop devices created by "snapd", so we uninstall it.
113 - name: Uninstall "snapd"
114 run: sudo apt-get purge -y snapd
Mohammed Naser3f961782023-04-20 10:48:21 -0400115
Mohammed Naser1d75a922023-07-23 19:24:49 +0000116 - name: Turn off swap
117 run: sudo swapoff -a
Mohammed Naser3f961782023-04-20 10:48:21 -0400118
Mohammed Naser1d75a922023-07-23 19:24:49 +0000119 - name: Run Molecule
120 run: poetry run molecule test -s ceph
121 env:
122 ATMOSPHERE_NETWORK_BACKEND: ${{ matrix.network_backend }}