Mohammed Naser | 3f96178 | 2023-04-20 10:48:21 -0400 | [diff] [blame] | 1 | # 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 | |
| 15 | name: ceph |
| 16 | |
| 17 | on: |
| 18 | pull_request: |
| 19 | push: |
| 20 | branches: |
| 21 | - main |
okozachenko1203 | 4371e49 | 2023-06-21 16:41:29 +1000 | [diff] [blame] | 22 | 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 |
okozachenko1203 | 374b1bc | 2023-08-01 02:12:48 +1000 | [diff] [blame] | 29 | network_backend: |
| 30 | type: choice |
| 31 | description: 'Network backend type' |
| 32 | required: true |
| 33 | default: 'ovn' |
| 34 | options: |
| 35 | - openvswitch |
| 36 | - ovn |
Mohammed Naser | 3f96178 | 2023-04-20 10:48:21 -0400 | [diff] [blame] | 37 | |
| 38 | jobs: |
Mohammed Naser | 1d75a92 | 2023-07-23 19:24:49 +0000 | [diff] [blame] | 39 | debug: |
Mohammed Naser | 727b5b6 | 2023-07-22 19:21:00 +0000 | [diff] [blame] | 40 | runs-on: ubuntu-20.04-16-cores |
Mohammed Naser | 1d75a92 | 2023-07-23 19:24:49 +0000 | [diff] [blame] | 41 | if: github.event_name == 'workflow_dispatch' && inputs.debug_enabled |
| 42 | strategy: |
| 43 | fail-fast: false |
Mohammed Naser | f1597e6 | 2023-07-23 20:36:49 +0000 | [diff] [blame] | 44 | concurrency: |
okozachenko1203 | 374b1bc | 2023-08-01 02:12:48 +1000 | [diff] [blame] | 45 | group: ${{ github.ref }}-${{ inputs.network_backend }} |
Mohammed Naser | f1597e6 | 2023-07-23 20:36:49 +0000 | [diff] [blame] | 46 | cancel-in-progress: true |
Mohammed Naser | 727b5b6 | 2023-07-22 19:21:00 +0000 | [diff] [blame] | 47 | steps: |
| 48 | - name: Checkout project |
dependabot[bot] | 804e8d2 | 2023-09-06 16:51:40 -0400 | [diff] [blame] | 49 | uses: actions/checkout@v4 |
Mohammed Naser | 727b5b6 | 2023-07-22 19:21:00 +0000 | [diff] [blame] | 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 |
okozachenko1203 | 374b1bc | 2023-08-01 02:12:48 +1000 | [diff] [blame] | 72 | env: |
| 73 | ATMOSPHERE_NETWORK_BACKEND: ${{ inputs.network_backend }} |
Mohammed Naser | 727b5b6 | 2023-07-22 19:21:00 +0000 | [diff] [blame] | 74 | |
| 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 Naser | 1d75a92 | 2023-07-23 19:24:49 +0000 | [diff] [blame] | 79 | timeout-minutes: 60 |
Mohammed Naser | 727b5b6 | 2023-07-22 19:21:00 +0000 | [diff] [blame] | 80 | |
| 81 | - name: Run Molecule Destroy |
| 82 | run: poetry run molecule destroy -s ceph |
| 83 | |
Mohammed Naser | 1d75a92 | 2023-07-23 19:24:49 +0000 | [diff] [blame] | 84 | 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 Naser | f1597e6 | 2023-07-23 20:36:49 +0000 | [diff] [blame] | 93 | concurrency: |
| 94 | group: ${{ github.ref }}-${{ matrix.network_backend }} |
| 95 | cancel-in-progress: true |
Mohammed Naser | 1d75a92 | 2023-07-23 19:24:49 +0000 | [diff] [blame] | 96 | steps: |
| 97 | - name: Checkout project |
dependabot[bot] | 804e8d2 | 2023-09-06 16:51:40 -0400 | [diff] [blame] | 98 | uses: actions/checkout@v4 |
Mohammed Naser | 3f96178 | 2023-04-20 10:48:21 -0400 | [diff] [blame] | 99 | |
Mohammed Naser | 1d75a92 | 2023-07-23 19:24:49 +0000 | [diff] [blame] | 100 | - name: Install Poetry |
| 101 | run: pipx install poetry |
Mohammed Naser | 3f96178 | 2023-04-20 10:48:21 -0400 | [diff] [blame] | 102 | |
Mohammed Naser | 1d75a92 | 2023-07-23 19:24:49 +0000 | [diff] [blame] | 103 | - name: Setup Python |
| 104 | uses: actions/setup-python@v4 |
| 105 | with: |
| 106 | cache: poetry |
Mohammed Naser | 3f96178 | 2023-04-20 10:48:21 -0400 | [diff] [blame] | 107 | |
Mohammed Naser | 1d75a92 | 2023-07-23 19:24:49 +0000 | [diff] [blame] | 108 | - name: Install dependencies |
| 109 | run: poetry install --no-interaction --with dev |
Mohammed Naser | 3f96178 | 2023-04-20 10:48:21 -0400 | [diff] [blame] | 110 | |
Mohammed Naser | 1d75a92 | 2023-07-23 19:24:49 +0000 | [diff] [blame] | 111 | # 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 Naser | 3f96178 | 2023-04-20 10:48:21 -0400 | [diff] [blame] | 115 | |
Mohammed Naser | 1d75a92 | 2023-07-23 19:24:49 +0000 | [diff] [blame] | 116 | - name: Turn off swap |
| 117 | run: sudo swapoff -a |
Mohammed Naser | 3f96178 | 2023-04-20 10:48:21 -0400 | [diff] [blame] | 118 | |
Mohammed Naser | 1d75a92 | 2023-07-23 19:24:49 +0000 | [diff] [blame] | 119 | - name: Run Molecule |
| 120 | run: poetry run molecule test -s ceph |
| 121 | env: |
| 122 | ATMOSPHERE_NETWORK_BACKEND: ${{ matrix.network_backend }} |