Merge pull request #2141 from IntersectMBO/develop #265
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: Backend Test | |
on: | |
push: | |
branches: | |
- test | |
workflow_dispatch: | |
inputs: | |
deployment: | |
required: true | |
type: choice | |
default: "govtool.cardanoapi.io/api" | |
options: | |
- "sanchogov.tools/api" | |
- "staging.govtool.byron.network/api" | |
- "govtool.cardanoapi.io/api" | |
jobs: | |
backend-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.11.4 | |
cache: "pip" | |
- name: Run Backend Test | |
working-directory: tests/govtool-backend | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
python ./setup.py | |
python -m pytest --alluredir allure-results | |
env: | |
BASE_URL: https://${{inputs.deployment || 'govtool.cardanoapi.io/api' }} | |
FAUCET_API_KEY: ${{ secrets.FAUCET_API_KEY }} | |
KUBER_API_URL: https://kuber-govtool.cardanoapi.io | |
- name: Upload report | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: allure-results | |
path: tests/govtool-backend/allure-results | |
publish-report: | |
runs-on: ubuntu-latest | |
if: always() | |
needs: backend-tests | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download results | |
uses: actions/download-artifact@v3 | |
with: | |
name: allure-results | |
path: allure-results | |
- name: Get Allure history | |
uses: actions/checkout@v4 | |
continue-on-error: true | |
with: | |
ref: gh-pages | |
path: gh-pages | |
repository: ${{vars.GH_PAGES}} | |
ssh-key: ${{ secrets.DEPLOY_KEY }} | |
- name: Register report | |
id: register-project | |
if: ${{success()}} | |
run: | | |
chmod +x .github/scripts/register_report.sh | |
.github/scripts/register_report.sh | |
- if: steps.register-project.outputs.project_exists != 'true' | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
ssh-key: ${{ secrets.DEPLOY_KEY }} | |
repository-name: ${{vars.GH_PAGES}} | |
branch: gh-pages | |
folder: project | |
- name: Generate report details | |
id: report-details | |
run: | | |
chmod +x .github/scripts/generate_report_details.sh | |
.github/scripts/generate_report_details.sh | |
- name: Build report | |
uses: simple-elf/allure-report-action@master | |
id: allure-report | |
with: | |
allure_results: allure-results | |
gh_pages: gh-pages/${{env.REPORT_NAME}} | |
allure_report: allure-report | |
allure_history: allure-history | |
keep_reports: 2000 | |
report_url: ${{steps.report-details.outputs.report_url}} | |
github_run_num: ${{steps.report-details.outputs.report_number}} | |
- name: Generate Latest Report | |
run: | | |
chmod +x .github/scripts/generate_latest_report_redirect.sh | |
.github/scripts/generate_latest_report_redirect.sh ${{steps.report-details.outputs.report_number}} | |
- name: Deploy report to Github Pages | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
ssh-key: ${{ secrets.DEPLOY_KEY }} | |
repository-name: ${{vars.GH_PAGES}} | |
branch: gh-pages | |
folder: build | |
target-folder: ${{ env.REPORT_NAME }} | |
env: | |
REPORT_NAME: govtool-backend | |
GH_PAGES: ${{vars.GH_PAGES}} |