blob: 2a671535209956687a6bf730aff61ee8a53c9973 [file] [log] [blame]
Mohammed Nasera4e52902022-08-30 00:20:05 -04001name: test
2on:
3 pull_request: {}
Mohammed Nasera4e52902022-08-30 00:20:05 -04004
5jobs:
Mohammed Naser9a5ff202022-09-07 15:56:48 -04006 build-prometheus-ethtool-exporter:
Mohammed Naserd4e634d2022-08-30 18:46:03 -04007 runs-on: ubuntu-latest
Mohammed Naserd4e634d2022-08-30 18:46:03 -04008 steps:
dependabot[bot]519c1932022-10-05 04:37:24 +00009 - uses: actions/checkout@v3.1.0
Mohammed Naser09d8ea82022-09-03 19:16:18 -040010 with:
Mohammed Naser9a5ff202022-09-07 15:56:48 -040011 fetch-depth: 0
dependabot[bot]3bb608b2022-11-21 03:47:36 +000012 - uses: tj-actions/changed-files@v34.4.4
Mohammed Naser9a5ff202022-09-07 15:56:48 -040013 id: changed-files
14 with:
15 files: images/prometheus-ethtool-exporter/*
dependabot[bot]620f4ea2022-10-13 17:23:48 +000016 - uses: docker/setup-qemu-action@v2.1.0
Mohammed Naser9a5ff202022-09-07 15:56:48 -040017 if: steps.changed-files.outputs.any_changed == 'true'
dependabot[bot]94f57072022-10-19 03:38:52 +000018 - uses: docker/setup-buildx-action@v2.2.1
Mohammed Naser9a5ff202022-09-07 15:56:48 -040019 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]eb9d0602022-10-13 03:35:16 +000022 - uses: docker/login-action@v2.1.0
Mohammed Naser9a5ff202022-09-07 15:56:48 -040023 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]f0d16162022-10-14 03:39:12 +000028 - uses: docker/build-push-action@v3.2.0
Mohammed Naser9a5ff202022-09-07 15:56:48 -040029 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 Naser25a07c42022-09-15 20:25:45 -040040
Mohammed Naser27292152022-09-19 19:26:24 -040041 pre-commit:
42 runs-on: ubuntu-latest
43 steps:
44 - name: Checkout project
dependabot[bot]519c1932022-10-05 04:37:24 +000045 uses: actions/checkout@v3.1.0
Mohammed Naser27292152022-09-19 19:26:24 -040046
47 - name: Setup Python
dependabot[bot]655a8102022-10-11 04:14:22 +000048 uses: actions/setup-python@v4.3.0
Mohammed Naser27292152022-09-19 19:26:24 -040049
50 - name: Setup pre-commit
51 uses: pre-commit/action@v3.0.0
52
Mohammed Naser25a07c42022-09-15 20:25:45 -040053 pytest:
54 runs-on: ubuntu-latest
55 strategy:
56 fail-fast: false
57 matrix:
Mohammed Naser182bcaf2022-09-18 10:43:36 -040058 type: [e2e, integration, unit]
Mohammed Naser25a07c42022-09-15 20:25:45 -040059 steps:
60 - name: Checkout project
dependabot[bot]519c1932022-10-05 04:37:24 +000061 uses: actions/checkout@v3.1.0
Mohammed Naser25a07c42022-09-15 20:25:45 -040062
63 - name: Install Poetry
64 run: pipx install poetry
65
66 - name: Setup Python
dependabot[bot]655a8102022-10-11 04:14:22 +000067 uses: actions/setup-python@v4.3.0
Mohammed Naser25a07c42022-09-15 20:25:45 -040068 with:
69 cache: poetry
70
Mohammed Naser8f61f0b2022-09-15 20:40:13 -040071 - name: Install dependencies
okozachenko1203fc31dcc2022-12-28 22:32:30 +110072 run: poetry install --no-interaction --all-extras
Mohammed Naser8f61f0b2022-09-15 20:40:13 -040073
Mohammed Naser25a07c42022-09-15 20:25:45 -040074 - name: Run test suite
75 run: poetry run pytest atmosphere/tests/${{ matrix.type }}
Mohammed Naserfe681de2022-10-12 15:42:25 +000076
77 molecule:
78 runs-on: ubuntu-latest
79 needs:
Mohammed Naserfe681de2022-10-12 15:42:25 +000080 - 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
okozachenko12034e1e0da2022-12-29 01:08:46 +110094 run: poetry install --no-interaction --all-extras
Mohammed Naserfe681de2022-10-12 15:42:25 +000095
96 # TODO(mnaser): Move this out to "cleanup" stage
97 - name: Set up Go
dependabot[bot]0f232b42022-12-02 03:10:15 +000098 uses: actions/setup-go@v3.4.0
Mohammed Naserfe681de2022-10-12 15:42:25 +000099 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 }}