|
1 | 1 | ---
|
2 |
| -name: Integration Tests |
| 2 | +name: Build and test |
3 | 3 |
|
4 | 4 | on: # yamllint disable-line rule:truthy
|
5 |
| - workflow_run: |
6 |
| - workflows: |
7 |
| - - Build |
| 5 | + push: |
8 | 6 | branches:
|
9 | 7 | - main
|
10 |
| - types: |
11 |
| - - completed |
| 8 | + pull_request: |
| 9 | + types: [opened, synchronize, reopened, labeled] |
12 | 10 | workflow_dispatch:
|
13 | 11 |
|
14 | 12 |
|
15 | 13 | jobs:
|
| 14 | + tox: |
| 15 | + name: Run unit tests and linters |
| 16 | + runs-on: ubuntu-latest |
| 17 | + steps: |
| 18 | + - name: Checkout repository |
| 19 | + uses: actions/checkout@v4 |
| 20 | + |
| 21 | + - name: Set up PDM |
| 22 | + uses: pdm-project/setup-pdm@v4 |
| 23 | + with: |
| 24 | + python-version: "3.12" |
| 25 | + |
| 26 | + - name: Install non-python dependencies |
| 27 | + run: | |
| 28 | + sudo apt-get update && sudo apt-get install -y libkrb5-dev |
| 29 | +
|
| 30 | + - name: Install Hadolint via Brew |
| 31 | + run: | |
| 32 | + NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" |
| 33 | + /home/linuxbrew/.linuxbrew/bin/brew install hadolint |
| 34 | + sudo ln -s /home/linuxbrew/.linuxbrew/bin/hadolint /usr/bin/ |
| 35 | +
|
| 36 | + - name: Install Python dependencies |
| 37 | + run: | |
| 38 | + pdm sync -dG tox |
| 39 | + python3 -m pip install ansible-lint |
| 40 | +
|
| 41 | + - name: Run Tests |
| 42 | + run: | |
| 43 | + pdm run -v tox |
| 44 | +
|
| 45 | + build: |
| 46 | + name: Build and push image |
| 47 | + runs-on: ubuntu-latest |
| 48 | + |
| 49 | + steps: |
| 50 | + - name: Set variables |
| 51 | + id: set-vars |
| 52 | + run: | |
| 53 | + if [[ $GITHUB_REF_NAME == 'main' ]]; then |
| 54 | + echo "tags=latest ${{ github.sha }}" >> $GITHUB_OUTPUT |
| 55 | + else |
| 56 | + echo "tags=${{ github.sha }}">> $GITHUB_OUTPUT |
| 57 | + fi |
| 58 | + - uses: actions/checkout@v4 |
| 59 | + |
| 60 | + - name: Build Image |
| 61 | + id: build-image |
| 62 | + uses: redhat-actions/buildah-build@v2 |
| 63 | + with: |
| 64 | + image: operator-pipelines-images |
| 65 | + tags: ${{ steps.set-vars.outputs.tags }} |
| 66 | + dockerfiles: | |
| 67 | + ./operator-pipeline-images/Dockerfile |
| 68 | +
|
| 69 | + - name: Push To quay.io |
| 70 | + id: push-to-quay |
| 71 | + uses: redhat-actions/push-to-registry@v2 |
| 72 | + with: |
| 73 | + image: ${{ steps.build-image.outputs.image }} |
| 74 | + tags: ${{ steps.build-image.outputs.tags }} |
| 75 | + registry: quay.io/redhat-isv |
| 76 | + username: ${{ secrets.REGISTRY_USERNAME }} |
| 77 | + password: ${{ secrets.REGISTRY_PASSWORD }} |
| 78 | + |
| 79 | + - name: Print image url |
| 80 | + run: echo "Image pushed to ${{ steps.push-to-quay.outputs.registry-paths }}" |
| 81 | + |
16 | 82 | integration-tests:
|
| 83 | + needs: [build] |
| 84 | + if: github.event_name == 'workflow_dispatch' || github.event_name == 'push' || github.event.label.name == 'ready-for-testing' |
| 85 | + timeout-minutes: 90 |
17 | 86 | strategy:
|
18 | 87 | matrix:
|
19 | 88 | test_type:
|
|
74 | 143 | options: |
|
75 | 144 | -e "test_type=${{ matrix.test_type }}"
|
76 | 145 | -e "oc_namespace=int-tests-${{ matrix.test_type }}-${{ github.run_number }}-${{ github.run_attempt }}"
|
77 |
| - -e "integration_tests_operator_bundle_version=0.1.${{ github.run_number }}-${{ github.run_attempt }}" |
| 146 | + -e "integration_tests_operator_bundle_version=0.2.${{ github.run_number }}-${{ github.run_attempt }}" |
78 | 147 | -e "operator_pipeline_image_tag=${{ github.sha }}"
|
79 | 148 | -e "suffix=${{ steps.prepare.outputs.suffix }}"
|
80 | 149 | --skip-tags=signing-pipeline
|
|
0 commit comments