Github Actions use case #3
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: test-docker or test-action' | |
required: true | |
default: 'test-action' | |
storage-bucket: | |
description: 'Your Firebase (GCP) storage bucket' | |
required: true | |
keep-results: | |
description: 'Backup results to keep retries' | |
required: false | |
default: 'false' | |
keep-history: | |
description: 'Backup history' | |
required: false | |
default: 'true' | |
website-id: | |
description: 'Unique identifier for the site' | |
required: false | |
website-expires: | |
description: 'Test Report site expiry. Example: 1h, 2d or 3w. Max is 30d' | |
required: false | |
default: '1h' | |
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 WEBSITE_ID=${{ github.event.inputs.website-id }} \ | |
-e WEBSITE_EXPIRES=${{ github.event.inputs.website-expires }} \ | |
-e KEEP_RETRIES=${{ github.event.inputs.keep-retries }} \ | |
-e KEEP_HISTORY=${{ github.event.inputs.keep-history }} \ | |
-e SLACK_TOKEN=${{secrets.SLACK_TOKEN}} \ | |
-e SLACK_CHANNEL_ID=${{secrets.SLACK_CHANNEL_ID}} \ | |
-v $GITHUB_STEP_SUMMARY:/github/summary.txt \ | |
-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: | |
- 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: '${{ github.workspace }}/assets/allure-results' | |
storage_bucket: ${{github.event.inputs.storage-bucket}} | |
website_id: ${{ github.event.inputs.website-id }} | |
website_expires: ${{github.event.inputs.website-expires}} | |
slack_channel_id: ${{secrets.SLACK_CHANNEL_ID}} | |
keep_history: ${{github.event.inputs.keep-history}} | |
keep_results: ${{github.event.inputs.keep-results}} |