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 |
Mohammed Naser | 3f96178 | 2023-04-20 10:48:21 -0400 | [diff] [blame] | 29 | |
| 30 | jobs: |
Mohammed Naser | 1d75a92 | 2023-07-23 19:24:49 +0000 | [diff] [blame^] | 31 | debug: |
Mohammed Naser | 727b5b6 | 2023-07-22 19:21:00 +0000 | [diff] [blame] | 32 | runs-on: ubuntu-20.04-16-cores |
Mohammed Naser | 1d75a92 | 2023-07-23 19:24:49 +0000 | [diff] [blame^] | 33 | if: github.event_name == 'workflow_dispatch' && inputs.debug_enabled |
| 34 | strategy: |
| 35 | fail-fast: false |
| 36 | matrix: |
| 37 | network_backend: |
| 38 | - openvswitch |
| 39 | - ovn |
Mohammed Naser | 727b5b6 | 2023-07-22 19:21:00 +0000 | [diff] [blame] | 40 | steps: |
| 41 | - name: Checkout project |
| 42 | uses: actions/checkout@v3 |
| 43 | |
| 44 | - name: Install Poetry |
| 45 | run: pipx install poetry |
| 46 | |
| 47 | - name: Setup Python |
| 48 | uses: actions/setup-python@v4 |
| 49 | with: |
| 50 | cache: poetry |
| 51 | |
| 52 | - name: Install dependencies |
| 53 | run: poetry install --no-interaction --with dev |
| 54 | |
| 55 | # NOTE(mnaser): LVM commands take a long time if there are any existing |
| 56 | # loop devices created by "snapd", so we uninstall it. |
| 57 | - name: Uninstall "snapd" |
| 58 | run: sudo apt-get purge -y snapd |
| 59 | |
| 60 | - name: Turn off swap |
| 61 | run: sudo swapoff -a |
| 62 | |
| 63 | - name: Run Molecule Converge |
| 64 | run: poetry run molecule converge -s ceph |
Mohammed Naser | 727b5b6 | 2023-07-22 19:21:00 +0000 | [diff] [blame] | 65 | |
| 66 | # Enable tmate debugging of manually-triggered workflows if the input option was provided |
| 67 | - name: Setup tmate session |
| 68 | if: ${{ failure() }} |
| 69 | uses: mxschmitt/action-tmate@v3 |
Mohammed Naser | 1d75a92 | 2023-07-23 19:24:49 +0000 | [diff] [blame^] | 70 | timeout-minutes: 60 |
Mohammed Naser | 727b5b6 | 2023-07-22 19:21:00 +0000 | [diff] [blame] | 71 | |
| 72 | - name: Run Molecule Destroy |
| 73 | run: poetry run molecule destroy -s ceph |
| 74 | |
Mohammed Naser | 1d75a92 | 2023-07-23 19:24:49 +0000 | [diff] [blame^] | 75 | test: |
| 76 | runs-on: ubuntu-20.04-16-cores |
| 77 | if: github.event_name != 'workflow_dispatch' || !inputs.debug_enabled |
| 78 | strategy: |
| 79 | fail-fast: false |
| 80 | matrix: |
| 81 | network_backend: |
| 82 | - openvswitch |
| 83 | - ovn |
| 84 | steps: |
| 85 | - name: Checkout project |
| 86 | uses: actions/checkout@v3 |
Mohammed Naser | 3f96178 | 2023-04-20 10:48:21 -0400 | [diff] [blame] | 87 | |
Mohammed Naser | 1d75a92 | 2023-07-23 19:24:49 +0000 | [diff] [blame^] | 88 | - name: Install Poetry |
| 89 | run: pipx install poetry |
Mohammed Naser | 3f96178 | 2023-04-20 10:48:21 -0400 | [diff] [blame] | 90 | |
Mohammed Naser | 1d75a92 | 2023-07-23 19:24:49 +0000 | [diff] [blame^] | 91 | - name: Setup Python |
| 92 | uses: actions/setup-python@v4 |
| 93 | with: |
| 94 | cache: poetry |
Mohammed Naser | 3f96178 | 2023-04-20 10:48:21 -0400 | [diff] [blame] | 95 | |
Mohammed Naser | 1d75a92 | 2023-07-23 19:24:49 +0000 | [diff] [blame^] | 96 | - name: Install dependencies |
| 97 | run: poetry install --no-interaction --with dev |
Mohammed Naser | 3f96178 | 2023-04-20 10:48:21 -0400 | [diff] [blame] | 98 | |
Mohammed Naser | 1d75a92 | 2023-07-23 19:24:49 +0000 | [diff] [blame^] | 99 | # NOTE(mnaser): LVM commands take a long time if there are any existing |
| 100 | # loop devices created by "snapd", so we uninstall it. |
| 101 | - name: Uninstall "snapd" |
| 102 | run: sudo apt-get purge -y snapd |
Mohammed Naser | 3f96178 | 2023-04-20 10:48:21 -0400 | [diff] [blame] | 103 | |
Mohammed Naser | 1d75a92 | 2023-07-23 19:24:49 +0000 | [diff] [blame^] | 104 | - name: Turn off swap |
| 105 | run: sudo swapoff -a |
Mohammed Naser | 3f96178 | 2023-04-20 10:48:21 -0400 | [diff] [blame] | 106 | |
Mohammed Naser | 1d75a92 | 2023-07-23 19:24:49 +0000 | [diff] [blame^] | 107 | - name: Run Molecule |
| 108 | run: poetry run molecule test -s ceph |
| 109 | env: |
| 110 | ATMOSPHERE_NETWORK_BACKEND: ${{ matrix.network_backend }} |