|
| 1 | +name: Parallel Robot Framework pipeline |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - main |
| 6 | + paths: |
| 7 | + - docs/examples/jenkins/parallel-robot-pipeline/** |
| 8 | + - .github/workflows/parallel-robot-pipeline.yml |
| 9 | + pull_request: |
| 10 | + branches: |
| 11 | + - main |
| 12 | + paths: |
| 13 | + - docs/examples/jenkins/parallel-robot-pipeline/** |
| 14 | + - .github/workflows/parallel-robot-pipeline.yml |
| 15 | + |
| 16 | +jobs: |
| 17 | + run: |
| 18 | + name: Build, test, and push container image |
| 19 | + runs-on: ubuntu-latest |
| 20 | + steps: |
| 21 | + - name: Checkout |
| 22 | + uses: actions/checkout@v3 |
| 23 | + - name: Build container image |
| 24 | + working-directory: docs/examples/jenkins/parallel-robot-pipeline/ |
| 25 | + run: | |
| 26 | + docker build . --tag rf-screenshot |
| 27 | + - name: Test container image |
| 28 | + run: | |
| 29 | + for browser in chromium firefox; do |
| 30 | + docker run --rm -v $(pwd)/robot_output:/out -e BROWSER=$browser rf-screenshot -d /out -l none -r none -o $browser.xml -N $browser -v URL:https://kangasta.github.io/cicd-examples/ |
| 31 | + done |
| 32 | + - name: Store logs |
| 33 | + if: always() |
| 34 | + uses: actions/upload-artifact@v3 |
| 35 | + with: |
| 36 | + name: raw-logs |
| 37 | + path: robot_output |
| 38 | + retention-days: 1 |
| 39 | + - name: Login to GitHub Container Registry |
| 40 | + if: github.ref == 'refs/heads/main' |
| 41 | + uses: docker/login-action@v2 |
| 42 | + with: |
| 43 | + registry: ghcr.io |
| 44 | + username: ${{ github.actor }} |
| 45 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 46 | + - name: Push container image to GitHub Container Registry |
| 47 | + if: github.ref == 'refs/heads/main' |
| 48 | + working-directory: docs/examples/jenkins/parallel-robot-pipeline/ |
| 49 | + run: | |
| 50 | + docker build . --target base -t base |
| 51 | +
|
| 52 | + for tag in ${{ github.run_number }} latest; do |
| 53 | + docker tag base ghcr.io/kangasta/robot-browser:$tag |
| 54 | + docker push ghcr.io/kangasta/robot-browser:$tag |
| 55 | + done |
| 56 | + process-logs: |
| 57 | + name: Process logs |
| 58 | + if: always() |
| 59 | + needs: run |
| 60 | + runs-on: ubuntu-latest |
| 61 | + steps: |
| 62 | + - uses: actions/setup-python@v4 |
| 63 | + with: |
| 64 | + python-version: '3.10' |
| 65 | + - name: Download logs |
| 66 | + uses: actions/download-artifact@v3 |
| 67 | + with: |
| 68 | + path: work/ |
| 69 | + - name: Install robot framework |
| 70 | + run: pip install robotframework>=4 |
| 71 | + - name: Combine logs |
| 72 | + working-directory: work/ |
| 73 | + run: | |
| 74 | + mkdir rebot_output |
| 75 | + rebot -d rebot_output -o output.xml -N "${{ github.workflow }}" --nostatusrc */*.xml |
| 76 | + - name: Store processed logs |
| 77 | + uses: actions/upload-artifact@v3 |
| 78 | + with: |
| 79 | + name: combined-logs |
| 80 | + path: work/rebot_output |
0 commit comments