Github Actions use case #12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Github Actions use case | |
on: | |
workflow_dispatch: | |
inputs: | |
job: | |
description: 'Select the job to run' | |
type: choice | |
options: | |
- test-docker | |
- test-action | |
default: test-action | |
storage-bucket: | |
description: 'Your Firebase (GCP) storage bucket' | |
required: true | |
show-retries: | |
description: 'Show keep retries in report' | |
type: boolean | |
default: true | |
show-history: | |
description: 'Show keep history in report' | |
type: boolean | |
default: true | |
report-name: | |
description: 'Title of the report' | |
required: false | |
default: 'Allure Report' | |
prefix: | |
description: 'The storage bucket path to back up Allure results and history files' | |
required: false | |
jobs: | |
test-docker: | |
if: ${{ github.event.inputs.job == 'test-docker' }} | |
runs-on: ubuntu-latest | |
env: | |
GCP_SECRETS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }} | |
steps: | |
- uses: actions/[email protected] | |
- name: Run Tests | |
run: | | |
echo 'No test to run, using existing assets/allure-results from this repository' | |
- name: Write GCP Credentials | |
run: | | |
echo "$GCP_SECRETS" > ${{ github.workspace }}/gcp-key.json | |
- name: Authenticate Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ vars.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Deploy Allure Report to Firebase | |
run: | | |
docker run --rm \ | |
-e STORAGE_BUCKET=${{github.event.inputs.storage-bucket}} \ | |
-e SHOW_RETRIES=${{ github.event.inputs.show-retries }} \ | |
-e SHOW_HISTORY=${{ github.event.inputs.show-history }} \ | |
-e SLACK_TOKEN=${{secrets.SLACK_TOKEN}} \ | |
-e SLACK_CHANNEL=${{secrets.SLACK_CHANNEL_ID}} \ | |
-v ${{ github.workspace }}/assets/allure-results:/allure-results \ | |
-v ${{ github.workspace }}/gcp-key.json:/credentials/key.json \ | |
sokari/allure-deployer:latest | |
test-action: | |
if: ${{ github.event.inputs.job == 'test-action' }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/[email protected] | |
- name: Allure Deployer Action | |
uses: cybersokari/[email protected] | |
env: | |
SLACK_TOKEN: ${{secrets.SLACK_TOKEN}} | |
GOOGLE_CREDENTIALS_JSON: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }} | |
with: | |
allure_results_path: 'assets/allure-results' | |
storage_bucket: ${{github.event.inputs.storage-bucket}} | |
slack_channel: ${{secrets.SLACK_CHANNEL_ID}} | |
show_history: ${{github.event.inputs.show-history}} | |
show_retries: ${{github.event.inputs.show-retries}} | |
prefix: ${{github.event.inputs.prefix}} | |
update_pr: 'summary' | |
test-action-local: | |
if: ${{ github.event.inputs.job == 'test-action-local' }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/[email protected] | |
- name: Allure Deployer Action | |
uses: ./apps/docker | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
SLACK_TOKEN: ${{secrets.SLACK_TOKEN}} | |
GOOGLE_CREDENTIALS_JSON: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS}} | |
with: | |
allure_results_path: 'assets/allure-results' | |
storage_bucket: ${{github.event.inputs.storage-bucket}} | |
report_name: ${{ github.event.inputs.report-name }} | |
slack_channel: ${{secrets.SLACK_CHANNEL}} | |
show_retries: ${{github.event.inputs.show-retries}} | |
show_history: ${{github.event.inputs.show-history}} | |
prefix: ${{github.event.inputs.prefix}} | |
update_pr: 'comment' |