blob: 1208a04cdbf5a759efa5f3c945782ef2f8709c04 [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 Naserfe681de2022-10-12 15:42:25 +000041 molecule:
42 runs-on: ubuntu-latest
Mohammed Naserfe681de2022-10-12 15:42:25 +000043 steps:
44 - name: Checkout project
Mohammed Naser88cb2762023-01-18 03:28:21 +000045 uses: actions/checkout@v3
Mohammed Naserfe681de2022-10-12 15:42:25 +000046
47 - name: Install Poetry
48 run: pipx install poetry
49
50 - name: Setup Python
Mohammed Naser88cb2762023-01-18 03:28:21 +000051 uses: actions/setup-python@v4
Mohammed Naserfe681de2022-10-12 15:42:25 +000052 with:
53 cache: poetry
54
55 - name: Install dependencies
okozachenko12034e1e0da2022-12-29 01:08:46 +110056 run: poetry install --no-interaction --all-extras
Mohammed Naserfe681de2022-10-12 15:42:25 +000057
58 # TODO(mnaser): Move this out to "cleanup" stage
59 - name: Set up Go
Mohammed Naser88cb2762023-01-18 03:28:21 +000060 uses: actions/setup-go@v3
Mohammed Naserfe681de2022-10-12 15:42:25 +000061 with:
62 go-version-file: go.mod
63 cache: true
64 - name: Clean-up stale stacks
65 run: go run ./cmd/atmosphere-ci molecule cleanup
66 env:
67 OS_AUTH_URL: https://auth.vexxhost.net/v3
68 OS_REGION_NAME: ca-ymq-1
69 OS_USER_DOMAIN_NAME: Default
70 OS_USERNAME: ${{ secrets.OS_USERNAME }}
71 OS_PASSWORD: ${{ secrets.OS_PASSWORD }}
72 OS_PROJECT_DOMAIN_NAME: Default
73 OS_PROJECT_NAME: ${{ secrets.OS_PROJECT_NAME }}
74
75 - name: Run Molecule
76 run: poetry run molecule test
okozachenko1203eb8c58e2023-01-27 05:05:35 +110077 timeout-minutes: 120
Mohammed Naserfe681de2022-10-12 15:42:25 +000078 env:
79 ATMOSPHERE_STACK_NAME: "atmosphere-${{ github.run_id }}-${{ github.run_attempt }}"
80 OS_AUTH_URL: https://auth.vexxhost.net/v3
81 OS_REGION_NAME: ca-ymq-1
82 OS_USER_DOMAIN_NAME: Default
83 OS_USERNAME: ${{ secrets.OS_USERNAME }}
84 OS_PASSWORD: ${{ secrets.OS_PASSWORD }}
85 OS_PROJECT_DOMAIN_NAME: Default
86 OS_PROJECT_NAME: ${{ secrets.OS_PROJECT_NAME }}