Skip to content

dummyapi

dummyapi #5

Workflow file for this run

name: dummyapi
on: workflow_dispatch
jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Checkout repository to GitHub runner
uses: actions/checkout@v3
with:
ref: gh-pages
path: ./.github/gh-pages
- name: Run-tests via docker-compose
env:
TOKEN: ${{ secrets.TOKEN }}
run: |
docker-compose up --exit-code-from dummyapi || true
- name: Copy history from gh-pages to allure-results
run: |
sudo mkdir -p allure-results/history
sudo cp -R ./.github/gh-pages/history/* allure-results/history/
- name: Add environment in allure-results
run: |
sudo pwd
sudo cp -R environment.properties allure-results
- name: Store allure-results
uses: actions/upload-artifact@v4
with:
name: allure-results
path: allure-results
retention-days: 1
generate-report:
needs: tests
runs-on: ubuntu-latest
name: Generate-report
steps:
- uses: actions/checkout@v3
- name: Checkout repository to GitHub runner
uses: actions/checkout@v3
with:
ref: gh-pages
path: ./.github/gh-pages
- uses: actions/setup-java@v3
with:
distribution: 'microsoft'
java-version: '17'
- name: Allure report installation
run: sudo wget https://github.com/allure-framework/allure2/releases/download/2.23.1/allure-2.23.1.tgz && sudo tar -zxvf allure-2.23.1.tgz -C /opt/ && sudo ln -s /opt/allure-2.23.1/bin/allure /usr/bin/allure
- name: Download all workflow run artifacts
uses: actions/download-artifact@v4
- name: Generate Allure report
run: |
sudo docker-compose run dummyapi /bin/sh -c "allure generate allure-results --clean -o allure-report"
- name: Update Allure history
run: |
sudo cp -R allure-report/history/* ./.github/gh-pages/history/
- name: Deploy to GitHub Pages
uses: JamesIves/github-pages-deploy-action@4.1.5
with:
token: ${{ secrets.CI_TOKEN }}
branch: gh-pages
folder: allure-report
clean: true
- name: Send message to bot(success)
if: ${{ needs.test.outputs.tests_passed == 'true' }}
env:
CHAT_IDS: ${{ secrets.CHAT_IDS }}
run: |
IFS=',' read -ra IDS <<< "$CHAT_IDS"
for ID in "${IDS[@]}"; do
curl -s -X POST https://api.telegram.org/bot${{ secrets.TOKEN_TG }}/sendMessage -F chat_id=$ID -F text='✅Tests API dummyapi PASSED. Report:https://alexfuz59.github.io/dummyapi/'
done
continue-on-error: true
- name: Send message to bot(failure)
if: ${{ needs.test.outputs.tests_passed != 'true' }}
env:
CHAT_IDS: ${{ secrets.CHAT_IDS }}
run: |
IFS=',' read -ra IDS <<< "$CHAT_IDS"
for ID in "${IDS[@]}"; do
curl -s -X POST https://api.telegram.org/bot${{ secrets.TOKEN_TG }}/sendMessage -F chat_id=$ID -F text='🆘Tests API dummyapi FAILED. Report:https://alexfuz59.github.io/dummyapi/'
done
continue-on-error: true