Configure build jobs (workflows)
The example below shows the configurations for GitHub workflow:
Workflow configuration
Here is an example of GitHub workflow you can use with Allure TestOps and
allurectl
.
We’ve defined inputs that can be changed by an end user prior to running the workflow, these input then will be used as environment variables to provide various data like browser name or URL which tests will use as a target.
All the variables starting with ALLURE
are needed to run allurectl
properly.
name: gh-integration
on:
push:
workflow_dispatch:
inputs:
TEST_ENDPOINT:
description: "Endpoint for tests"
required: true
default: https://dev.github.com
TEST_BROWSER:
description: "Browser for tests"
required: true
default: chrome
ALLURE_JOB_RUN_ID:
description: "Inner parameter for Allure TestOps"
required: false
env:
ALLURE_ENDPOINT: ${{ secrets.ALLURE_ENDPOINT }}
ALLURE_TOKEN: ${{ secrets.ALLURE_TOKEN }}
ALLURE_PROJECT_ID: ${{ secrets.ALLURE_PROJECT_ID }}
ALLURE_TESTPLAN_PATH: "./testplan.json"
ALLURE_RESULTS: "build/allure-results"
ALLURE_JOB_RUN_ID: ${{ github.event.inputs.ALLURE_JOB_RUN_ID }}
jobs:
all-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Set up JDK 1.8
uses: actions/[email protected]
with:
java-version: 1.8
- uses: actions/[email protected]
id: allure-job-uid
with:
result-encoding: string
script: |
const result = await github.actions.getWorkflowRun({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.runId,
});
return `${context.repo.owner}/${context.repo.repo}/actions/workflows/${result.data.workflow_id}`
- name: Download allurectl
run: |
wget https://github.com/allure-framework/allurectl/releases/latest/download/allurectl_linux_386 -O ./allurectl
chmod +x ./allurectl
- name: Prepare TestPlan
run: ./allurectl job-run plan --output-file ${ALLURE_TESTPLAN_PATH}
- name: Build with Gradle
run: ./allurectl watch -- ./gradlew clean test
env:
ALLURE_JOB_UID: ${{steps.allure-job-uid.outputs.result}}
TEST_ENDPOINT: ${{ github.event.inputs.TEST_ENDPOINT }}
TEST_BROWSER: ${{ github.event.inputs.TEST_BROWSER }}
- name: Get environments
run: printenv | grep ALLURE_
- name: List results
run: ls -la ${ALLURE_RESULTS}