blob: 143350b4d08a46e05618acf21f6a034f7db3ffa0 [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:
Mohammed Naserca0f0cd2024-01-01 20:59:46 -050019 paths-ignore:
Mohammed Naser93d643d2024-01-02 13:58:24 -050020 - images/**
Mohammed Naserca0f0cd2024-01-01 20:59:46 -050021 - go.mod
22 - go.sum
okozachenko12034371e492023-06-21 16:41:29 +100023 workflow_dispatch:
24 inputs:
25 debug_enabled:
26 type: boolean
27 description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
28 required: false
29 default: false
okozachenko1203374b1bc2023-08-01 02:12:48 +100030 network_backend:
31 type: choice
32 description: 'Network backend type'
33 required: true
34 default: 'ovn'
35 options:
36 - openvswitch
37 - ovn
Mohammed Naser3f961782023-04-20 10:48:21 -040038
39jobs:
Mohammed Naser1d75a922023-07-23 19:24:49 +000040 debug:
Mohammed Naser32d73b72023-10-11 14:58:53 -040041 runs-on: v3-standard-16
Mohammed Naser1d75a922023-07-23 19:24:49 +000042 if: github.event_name == 'workflow_dispatch' && inputs.debug_enabled
43 strategy:
44 fail-fast: false
Mohammed Naserf1597e62023-07-23 20:36:49 +000045 concurrency:
okozachenko1203374b1bc2023-08-01 02:12:48 +100046 group: ${{ github.ref }}-${{ inputs.network_backend }}
Mohammed Naserf1597e62023-07-23 20:36:49 +000047 cancel-in-progress: true
Mohammed Naser727b5b62023-07-22 19:21:00 +000048 steps:
49 - name: Checkout project
renovate[bot]38929d42024-01-02 11:18:18 -050050 uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
Mohammed Naser727b5b62023-07-22 19:21:00 +000051
52 - name: Install Poetry
53 run: pipx install poetry
54
55 - name: Setup Python
renovate[bot]7866afa2023-12-29 19:21:33 -050056 uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5
Mohammed Naser727b5b62023-07-22 19:21:00 +000057 with:
58 cache: poetry
59
60 - name: Install dependencies
61 run: poetry install --no-interaction --with dev
62
63 # NOTE(mnaser): LVM commands take a long time if there are any existing
64 # loop devices created by "snapd", so we uninstall it.
65 - name: Uninstall "snapd"
66 run: sudo apt-get purge -y snapd
67
68 - name: Turn off swap
69 run: sudo swapoff -a
70
71 - name: Run Molecule Converge
72 run: poetry run molecule converge -s ceph
okozachenko1203374b1bc2023-08-01 02:12:48 +100073 env:
74 ATMOSPHERE_NETWORK_BACKEND: ${{ inputs.network_backend }}
Mohammed Naser727b5b62023-07-22 19:21:00 +000075
76 # Enable tmate debugging of manually-triggered workflows if the input option was provided
77 - name: Setup tmate session
78 if: ${{ failure() }}
renovate[bot]38929d42024-01-02 11:18:18 -050079 uses: mxschmitt/action-tmate@a283f9441d2d96eb62436dc46d7014f5d357ac22 # v3
Mohammed Naser1d75a922023-07-23 19:24:49 +000080 timeout-minutes: 60
Mohammed Naser727b5b62023-07-22 19:21:00 +000081
82 - name: Run Molecule Destroy
83 run: poetry run molecule destroy -s ceph
84
Mohammed Naser1d75a922023-07-23 19:24:49 +000085 test:
Mohammed Naser32d73b72023-10-11 14:58:53 -040086 runs-on: v3-standard-16
Mohammed Naser1d75a922023-07-23 19:24:49 +000087 if: github.event_name != 'workflow_dispatch' || !inputs.debug_enabled
88 strategy:
89 fail-fast: false
90 matrix:
91 network_backend:
92 - openvswitch
93 - ovn
Mohammed Naserf1597e62023-07-23 20:36:49 +000094 concurrency:
95 group: ${{ github.ref }}-${{ matrix.network_backend }}
96 cancel-in-progress: true
Mohammed Naser1d75a922023-07-23 19:24:49 +000097 steps:
98 - name: Checkout project
renovate[bot]38929d42024-01-02 11:18:18 -050099 uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
Mohammed Naser3f961782023-04-20 10:48:21 -0400100
Mohammed Naser1d75a922023-07-23 19:24:49 +0000101 - name: Install Poetry
102 run: pipx install poetry
Mohammed Naser3f961782023-04-20 10:48:21 -0400103
Mohammed Naser1d75a922023-07-23 19:24:49 +0000104 - name: Setup Python
renovate[bot]7866afa2023-12-29 19:21:33 -0500105 uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5
Mohammed Naser1d75a922023-07-23 19:24:49 +0000106 with:
107 cache: poetry
Mohammed Naser3f961782023-04-20 10:48:21 -0400108
Mohammed Naser1d75a922023-07-23 19:24:49 +0000109 - name: Install dependencies
110 run: poetry install --no-interaction --with dev
Mohammed Naser3f961782023-04-20 10:48:21 -0400111
Mohammed Naser1d75a922023-07-23 19:24:49 +0000112 # NOTE(mnaser): LVM commands take a long time if there are any existing
113 # loop devices created by "snapd", so we uninstall it.
114 - name: Uninstall "snapd"
115 run: sudo apt-get purge -y snapd
Mohammed Naser3f961782023-04-20 10:48:21 -0400116
Mohammed Naser1d75a922023-07-23 19:24:49 +0000117 - name: Turn off swap
118 run: sudo swapoff -a
Mohammed Naser3f961782023-04-20 10:48:21 -0400119
Mohammed Naser1d75a922023-07-23 19:24:49 +0000120 - name: Run Molecule
121 run: poetry run molecule test -s ceph
122 env:
123 ATMOSPHERE_NETWORK_BACKEND: ${{ matrix.network_backend }}