Mohammed Naser | a4e5290 | 2022-08-30 00:20:05 -0400 | [diff] [blame] | 1 | name: test |
| 2 | on: |
| 3 | pull_request: {} |
Mohammed Naser | a4e5290 | 2022-08-30 00:20:05 -0400 | [diff] [blame] | 4 | |
| 5 | jobs: |
Mohammed Naser | 9a5ff20 | 2022-09-07 15:56:48 -0400 | [diff] [blame] | 6 | build-prometheus-ethtool-exporter: |
Mohammed Naser | d4e634d | 2022-08-30 18:46:03 -0400 | [diff] [blame] | 7 | runs-on: ubuntu-latest |
Mohammed Naser | d4e634d | 2022-08-30 18:46:03 -0400 | [diff] [blame] | 8 | steps: |
dependabot[bot] | 519c193 | 2022-10-05 04:37:24 +0000 | [diff] [blame] | 9 | - uses: actions/checkout@v3.1.0 |
Mohammed Naser | 09d8ea8 | 2022-09-03 19:16:18 -0400 | [diff] [blame] | 10 | with: |
Mohammed Naser | 9a5ff20 | 2022-09-07 15:56:48 -0400 | [diff] [blame] | 11 | fetch-depth: 0 |
dependabot[bot] | 3bb608b | 2022-11-21 03:47:36 +0000 | [diff] [blame] | 12 | - uses: tj-actions/changed-files@v34.4.4 |
Mohammed Naser | 9a5ff20 | 2022-09-07 15:56:48 -0400 | [diff] [blame] | 13 | id: changed-files |
| 14 | with: |
| 15 | files: images/prometheus-ethtool-exporter/* |
dependabot[bot] | 620f4ea | 2022-10-13 17:23:48 +0000 | [diff] [blame] | 16 | - uses: docker/setup-qemu-action@v2.1.0 |
Mohammed Naser | 9a5ff20 | 2022-09-07 15:56:48 -0400 | [diff] [blame] | 17 | if: steps.changed-files.outputs.any_changed == 'true' |
dependabot[bot] | 94f5707 | 2022-10-19 03:38:52 +0000 | [diff] [blame] | 18 | - uses: docker/setup-buildx-action@v2.2.1 |
Mohammed Naser | 9a5ff20 | 2022-09-07 15:56:48 -0400 | [diff] [blame] | 19 | if: steps.changed-files.outputs.any_changed == 'true' |
| 20 | - run: echo PROJECT_REF=$(cat images/prometheus-ethtool-exporter/ref) >> $GITHUB_ENV |
| 21 | if: steps.changed-files.outputs.any_changed == 'true' |
dependabot[bot] | eb9d060 | 2022-10-13 03:35:16 +0000 | [diff] [blame] | 22 | - uses: docker/login-action@v2.1.0 |
Mohammed Naser | 9a5ff20 | 2022-09-07 15:56:48 -0400 | [diff] [blame] | 23 | if: steps.changed-files.outputs.any_changed == 'true' |
| 24 | with: |
| 25 | registry: quay.io |
| 26 | username: ${{ secrets.QUAY_USERNAME }} |
| 27 | password: ${{ secrets.QUAY_ROBOT_TOKEN }} |
dependabot[bot] | f0d1616 | 2022-10-14 03:39:12 +0000 | [diff] [blame] | 28 | - uses: docker/build-push-action@v3.2.0 |
Mohammed Naser | 9a5ff20 | 2022-09-07 15:56:48 -0400 | [diff] [blame] | 29 | if: steps.changed-files.outputs.any_changed == 'true' |
| 30 | with: |
| 31 | context: images/prometheus-ethtool-exporter |
| 32 | cache-from: type=gha,scope=prometheus-ethtool-exporter |
| 33 | cache-to: type=gha,mode=max,scope=prometheus-ethtool-exporter |
| 34 | platforms: linux/amd64,linux/arm64 |
| 35 | push: true |
| 36 | build-args: | |
| 37 | PROJECT_REF=${{ env.PROJECT_REF }} |
| 38 | tags: | |
| 39 | quay.io/vexxhost/ethtool-exporter:${{ env.PROJECT_REF }} |
Mohammed Naser | 25a07c4 | 2022-09-15 20:25:45 -0400 | [diff] [blame] | 40 | |
Mohammed Naser | 2729215 | 2022-09-19 19:26:24 -0400 | [diff] [blame] | 41 | pre-commit: |
| 42 | runs-on: ubuntu-latest |
| 43 | steps: |
| 44 | - name: Checkout project |
dependabot[bot] | 519c193 | 2022-10-05 04:37:24 +0000 | [diff] [blame] | 45 | uses: actions/checkout@v3.1.0 |
Mohammed Naser | 2729215 | 2022-09-19 19:26:24 -0400 | [diff] [blame] | 46 | |
| 47 | - name: Setup Python |
dependabot[bot] | 655a810 | 2022-10-11 04:14:22 +0000 | [diff] [blame] | 48 | uses: actions/setup-python@v4.3.0 |
Mohammed Naser | 2729215 | 2022-09-19 19:26:24 -0400 | [diff] [blame] | 49 | |
| 50 | - name: Setup pre-commit |
| 51 | uses: pre-commit/action@v3.0.0 |
| 52 | |
Mohammed Naser | 25a07c4 | 2022-09-15 20:25:45 -0400 | [diff] [blame] | 53 | pytest: |
| 54 | runs-on: ubuntu-latest |
| 55 | strategy: |
| 56 | fail-fast: false |
| 57 | matrix: |
Mohammed Naser | 182bcaf | 2022-09-18 10:43:36 -0400 | [diff] [blame] | 58 | type: [e2e, integration, unit] |
Mohammed Naser | 25a07c4 | 2022-09-15 20:25:45 -0400 | [diff] [blame] | 59 | steps: |
| 60 | - name: Checkout project |
dependabot[bot] | 519c193 | 2022-10-05 04:37:24 +0000 | [diff] [blame] | 61 | uses: actions/checkout@v3.1.0 |
Mohammed Naser | 25a07c4 | 2022-09-15 20:25:45 -0400 | [diff] [blame] | 62 | |
| 63 | - name: Install Poetry |
| 64 | run: pipx install poetry |
| 65 | |
| 66 | - name: Setup Python |
dependabot[bot] | 655a810 | 2022-10-11 04:14:22 +0000 | [diff] [blame] | 67 | uses: actions/setup-python@v4.3.0 |
Mohammed Naser | 25a07c4 | 2022-09-15 20:25:45 -0400 | [diff] [blame] | 68 | with: |
| 69 | cache: poetry |
| 70 | |
Mohammed Naser | 8f61f0b | 2022-09-15 20:40:13 -0400 | [diff] [blame] | 71 | - name: Install dependencies |
okozachenko1203 | fc31dcc | 2022-12-28 22:32:30 +1100 | [diff] [blame] | 72 | run: poetry install --no-interaction --all-extras |
Mohammed Naser | 8f61f0b | 2022-09-15 20:40:13 -0400 | [diff] [blame] | 73 | |
Mohammed Naser | 25a07c4 | 2022-09-15 20:25:45 -0400 | [diff] [blame] | 74 | - name: Run test suite |
| 75 | run: poetry run pytest atmosphere/tests/${{ matrix.type }} |
Mohammed Naser | fe681de | 2022-10-12 15:42:25 +0000 | [diff] [blame] | 76 | |
| 77 | molecule: |
| 78 | runs-on: ubuntu-latest |
| 79 | needs: |
Mohammed Naser | fe681de | 2022-10-12 15:42:25 +0000 | [diff] [blame] | 80 | - pytest |
| 81 | steps: |
| 82 | - name: Checkout project |
| 83 | uses: actions/checkout@v3.1.0 |
| 84 | |
| 85 | - name: Install Poetry |
| 86 | run: pipx install poetry |
| 87 | |
| 88 | - name: Setup Python |
| 89 | uses: actions/setup-python@v4.2.0 |
| 90 | with: |
| 91 | cache: poetry |
| 92 | |
| 93 | - name: Install dependencies |
| 94 | run: poetry install --no-interaction |
| 95 | |
| 96 | # TODO(mnaser): Move this out to "cleanup" stage |
| 97 | - name: Set up Go |
dependabot[bot] | 0f232b4 | 2022-12-02 03:10:15 +0000 | [diff] [blame] | 98 | uses: actions/setup-go@v3.4.0 |
Mohammed Naser | fe681de | 2022-10-12 15:42:25 +0000 | [diff] [blame] | 99 | with: |
| 100 | go-version-file: go.mod |
| 101 | cache: true |
| 102 | - name: Clean-up stale stacks |
| 103 | run: go run ./cmd/atmosphere-ci molecule cleanup |
| 104 | env: |
| 105 | OS_AUTH_URL: https://auth.vexxhost.net/v3 |
| 106 | OS_REGION_NAME: ca-ymq-1 |
| 107 | OS_USER_DOMAIN_NAME: Default |
| 108 | OS_USERNAME: ${{ secrets.OS_USERNAME }} |
| 109 | OS_PASSWORD: ${{ secrets.OS_PASSWORD }} |
| 110 | OS_PROJECT_DOMAIN_NAME: Default |
| 111 | OS_PROJECT_NAME: ${{ secrets.OS_PROJECT_NAME }} |
| 112 | |
| 113 | - name: Run Molecule |
| 114 | run: poetry run molecule test |
| 115 | timeout-minutes: 90 |
| 116 | env: |
| 117 | ATMOSPHERE_STACK_NAME: "atmosphere-${{ github.run_id }}-${{ github.run_attempt }}" |
| 118 | OS_AUTH_URL: https://auth.vexxhost.net/v3 |
| 119 | OS_REGION_NAME: ca-ymq-1 |
| 120 | OS_USER_DOMAIN_NAME: Default |
| 121 | OS_USERNAME: ${{ secrets.OS_USERNAME }} |
| 122 | OS_PASSWORD: ${{ secrets.OS_PASSWORD }} |
| 123 | OS_PROJECT_DOMAIN_NAME: Default |
| 124 | OS_PROJECT_NAME: ${{ secrets.OS_PROJECT_NAME }} |