Skip to content

Add mainnet deployment with self-hosted runner #63

Add mainnet deployment with self-hosted runner

Add mainnet deployment with self-hosted runner #63

Workflow file for this run

name: Unit Test [Vitest]
on:
push:
branches:
- test
- main
workflow_dispatch:
inputs:
deployment:
required: true
type: choice
default: 'http://localhost:3000'
options:
- 'http://localhost:3000'
jobs:
unit-tests:
runs-on: self-hosted
defaults:
run:
working-directory: .
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
registry-url: 'https://registry.npmjs.org/'
scope: "@claritydao"
- name: Install dependencies
run: npm ci
env:
NODE_AUTH_TOKEN : ${{ secrets.NPM_AUTH_TOKEN }}
- name: Run Vitest tests
run: |
npm run test
- name: Upload report
uses: actions/upload-artifact@v3
if: always()
with:
name: allure-results
path: allure-results
publish-report:
runs-on: self-hosted
if: always()
needs: unit-tests
steps:
- uses: actions/checkout@v4
- name: Download report
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: ${{ env.GH_PAGES }}
token: ${{ secrets.GH_PAGE_DEPLOY_KEY }}
# ssh-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:
token: ${{ secrets.GH_PAGE_DEPLOY_KEY }}
# ssh-key:
repository-name: ${{ env.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
if: always()
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:
token: ${{ secrets.GH_PAGE_DEPLOY_KEY }}
# ssh-key:
repository-name: ${{ env.GH_PAGES }}
branch: gh-pages
folder: build
target-folder: vitest
env:
REPORT_NAME: vitest
GH_PAGES: cardanoapi/ccv-test-reports
CI: true