| name: test |
| on: |
| pull_request: {} |
| |
| jobs: |
| build-prometheus-ethtool-exporter: |
| runs-on: ubuntu-latest |
| steps: |
| - uses: actions/checkout@v3.1.0 |
| with: |
| fetch-depth: 0 |
| - uses: tj-actions/changed-files@v34.4.4 |
| id: changed-files |
| with: |
| files: images/prometheus-ethtool-exporter/* |
| - uses: docker/setup-qemu-action@v2.1.0 |
| if: steps.changed-files.outputs.any_changed == 'true' |
| - uses: docker/setup-buildx-action@v2.2.1 |
| if: steps.changed-files.outputs.any_changed == 'true' |
| - run: echo PROJECT_REF=$(cat images/prometheus-ethtool-exporter/ref) >> $GITHUB_ENV |
| if: steps.changed-files.outputs.any_changed == 'true' |
| - uses: docker/login-action@v2.1.0 |
| if: steps.changed-files.outputs.any_changed == 'true' |
| with: |
| registry: quay.io |
| username: ${{ secrets.QUAY_USERNAME }} |
| password: ${{ secrets.QUAY_ROBOT_TOKEN }} |
| - uses: docker/build-push-action@v3.2.0 |
| if: steps.changed-files.outputs.any_changed == 'true' |
| with: |
| context: images/prometheus-ethtool-exporter |
| cache-from: type=gha,scope=prometheus-ethtool-exporter |
| cache-to: type=gha,mode=max,scope=prometheus-ethtool-exporter |
| platforms: linux/amd64,linux/arm64 |
| push: true |
| build-args: | |
| PROJECT_REF=${{ env.PROJECT_REF }} |
| tags: | |
| quay.io/vexxhost/ethtool-exporter:${{ env.PROJECT_REF }} |
| |
| pre-commit: |
| runs-on: ubuntu-latest |
| steps: |
| - name: Checkout project |
| uses: actions/checkout@v3.1.0 |
| |
| - name: Setup Python |
| uses: actions/setup-python@v4.3.0 |
| |
| - name: Setup pre-commit |
| uses: pre-commit/action@v3.0.0 |
| |
| pytest: |
| runs-on: ubuntu-latest |
| strategy: |
| fail-fast: false |
| matrix: |
| type: [e2e, integration, unit] |
| steps: |
| - name: Checkout project |
| uses: actions/checkout@v3.1.0 |
| |
| - name: Install Poetry |
| run: pipx install poetry |
| |
| - name: Setup Python |
| uses: actions/setup-python@v4.3.0 |
| with: |
| cache: poetry |
| |
| - name: Install dependencies |
| run: poetry install --no-interaction |
| |
| - name: Run test suite |
| run: poetry run pytest atmosphere/tests/${{ matrix.type }} |
| |
| molecule: |
| runs-on: ubuntu-latest |
| needs: |
| - pytest |
| steps: |
| - name: Checkout project |
| uses: actions/checkout@v3.1.0 |
| |
| - name: Install Poetry |
| run: pipx install poetry |
| |
| - name: Setup Python |
| uses: actions/setup-python@v4.2.0 |
| with: |
| cache: poetry |
| |
| - name: Install dependencies |
| run: poetry install --no-interaction |
| |
| # TODO(mnaser): Move this out to "cleanup" stage |
| - name: Set up Go |
| uses: actions/setup-go@v3.4.0 |
| with: |
| go-version-file: go.mod |
| cache: true |
| - name: Clean-up stale stacks |
| run: go run ./cmd/atmosphere-ci molecule cleanup |
| env: |
| OS_AUTH_URL: https://auth.vexxhost.net/v3 |
| OS_REGION_NAME: ca-ymq-1 |
| OS_USER_DOMAIN_NAME: Default |
| OS_USERNAME: ${{ secrets.OS_USERNAME }} |
| OS_PASSWORD: ${{ secrets.OS_PASSWORD }} |
| OS_PROJECT_DOMAIN_NAME: Default |
| OS_PROJECT_NAME: ${{ secrets.OS_PROJECT_NAME }} |
| |
| - name: Run Molecule |
| run: poetry run molecule test |
| timeout-minutes: 90 |
| env: |
| ATMOSPHERE_STACK_NAME: "atmosphere-${{ github.run_id }}-${{ github.run_attempt }}" |
| OS_AUTH_URL: https://auth.vexxhost.net/v3 |
| OS_REGION_NAME: ca-ymq-1 |
| OS_USER_DOMAIN_NAME: Default |
| OS_USERNAME: ${{ secrets.OS_USERNAME }} |
| OS_PASSWORD: ${{ secrets.OS_PASSWORD }} |
| OS_PROJECT_DOMAIN_NAME: Default |
| OS_PROJECT_NAME: ${{ secrets.OS_PROJECT_NAME }} |