blob: 9eaed4c2f3e167c31f0496ac6434177f1d3314ca [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:
Mohammed Naser88cb2762023-01-18 03:28:21 +00009 - uses: actions/checkout@v3
Mohammed Naser09d8ea82022-09-03 19:16:18 -040010 with:
Mohammed Naser9a5ff202022-09-07 15:56:48 -040011 fetch-depth: 0
dependabot[bot]fe858c52023-01-17 22:42:05 -050012 - uses: tj-actions/changed-files@v35
Mohammed Naser9a5ff202022-09-07 15:56:48 -040013 id: changed-files
14 with:
15 files: images/prometheus-ethtool-exporter/*
Mohammed Naser88cb2762023-01-18 03:28:21 +000016 - uses: docker/setup-qemu-action@v2
Mohammed Naser9a5ff202022-09-07 15:56:48 -040017 if: steps.changed-files.outputs.any_changed == 'true'
Mohammed Naser88cb2762023-01-18 03:28:21 +000018 - uses: docker/setup-buildx-action@v2
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'
Mohammed Naser88cb2762023-01-18 03:28:21 +000022 - uses: docker/login-action@v2
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 }}
Mohammed Naser88cb2762023-01-18 03:28:21 +000028 - uses: docker/build-push-action@v3
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
Mohammed Naser88cb2762023-01-18 03:28:21 +000045 uses: actions/checkout@v3
Mohammed Naser27292152022-09-19 19:26:24 -040046
47 - name: Setup Python
Mohammed Naser88cb2762023-01-18 03:28:21 +000048 uses: actions/setup-python@v4
Mohammed Naser27292152022-09-19 19:26:24 -040049
50 - name: Setup pre-commit
Mohammed Nasereb586f52023-01-24 13:57:28 +000051 uses: pre-commit/action@v3.0.0
Mohammed Naser27292152022-09-19 19:26:24 -040052
Mohammed Naserfe681de2022-10-12 15:42:25 +000053 molecule:
54 runs-on: ubuntu-latest
Mohammed Naserfe681de2022-10-12 15:42:25 +000055 steps:
56 - name: Checkout project
Mohammed Naser88cb2762023-01-18 03:28:21 +000057 uses: actions/checkout@v3
Mohammed Naserfe681de2022-10-12 15:42:25 +000058
59 - name: Install Poetry
60 run: pipx install poetry
61
62 - name: Setup Python
Mohammed Naser88cb2762023-01-18 03:28:21 +000063 uses: actions/setup-python@v4
Mohammed Naserfe681de2022-10-12 15:42:25 +000064 with:
65 cache: poetry
66
67 - name: Install dependencies
okozachenko12034e1e0da2022-12-29 01:08:46 +110068 run: poetry install --no-interaction --all-extras
Mohammed Naserfe681de2022-10-12 15:42:25 +000069
70 # TODO(mnaser): Move this out to "cleanup" stage
71 - name: Set up Go
Mohammed Naser88cb2762023-01-18 03:28:21 +000072 uses: actions/setup-go@v3
Mohammed Naserfe681de2022-10-12 15:42:25 +000073 with:
74 go-version-file: go.mod
75 cache: true
76 - name: Clean-up stale stacks
77 run: go run ./cmd/atmosphere-ci molecule cleanup
78 env:
79 OS_AUTH_URL: https://auth.vexxhost.net/v3
80 OS_REGION_NAME: ca-ymq-1
81 OS_USER_DOMAIN_NAME: Default
82 OS_USERNAME: ${{ secrets.OS_USERNAME }}
83 OS_PASSWORD: ${{ secrets.OS_PASSWORD }}
84 OS_PROJECT_DOMAIN_NAME: Default
85 OS_PROJECT_NAME: ${{ secrets.OS_PROJECT_NAME }}
86
87 - name: Run Molecule
88 run: poetry run molecule test
okozachenko1203eb8c58e2023-01-27 05:05:35 +110089 timeout-minutes: 120
Mohammed Naserfe681de2022-10-12 15:42:25 +000090 env:
91 ATMOSPHERE_STACK_NAME: "atmosphere-${{ github.run_id }}-${{ github.run_attempt }}"
92 OS_AUTH_URL: https://auth.vexxhost.net/v3
93 OS_REGION_NAME: ca-ymq-1
94 OS_USER_DOMAIN_NAME: Default
95 OS_USERNAME: ${{ secrets.OS_USERNAME }}
96 OS_PASSWORD: ${{ secrets.OS_PASSWORD }}
97 OS_PROJECT_DOMAIN_NAME: Default
98 OS_PROJECT_NAME: ${{ secrets.OS_PROJECT_NAME }}