blob: 7baf515cda5750f30b6ff9c4eebe3262cc527f67 [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]6664f522022-10-03 03:46:44 +000012 - uses: tj-actions/changed-files@v31.0.3
Mohammed Naser9a5ff202022-09-07 15:56:48 -040013 id: changed-files
14 with:
15 files: images/prometheus-ethtool-exporter/*
16 - uses: docker/setup-qemu-action@v2.0.0
17 if: steps.changed-files.outputs.any_changed == 'true'
18 - uses: docker/setup-buildx-action@v2.0.0
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'
22 - uses: docker/login-action@v2.0.0
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 }}
28 - uses: docker/build-push-action@v3.1.1
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 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
48 uses: actions/setup-python@v4.2.0
49
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
67 uses: actions/setup-python@v4.2.0
68 with:
69 cache: poetry
70
Mohammed Naser8f61f0b2022-09-15 20:40:13 -040071 - name: Install dependencies
Mohammed Naser80aa1012022-09-15 20:42:42 -040072 run: poetry install --no-interaction
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 }}