Skip to content

Commit

Permalink
test: fix drop the test
Browse files Browse the repository at this point in the history
  • Loading branch information
kai0310 committed Sep 25, 2024
1 parent bfedba6 commit f1fd9a8
Showing 1 changed file with 15 additions and 17 deletions.
32 changes: 15 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,48 +15,46 @@ jobs:
- name: Checkout code
uses: actions/checkout@v3

- uses: actions/checkout@v2

- name: Move to python workspace
run: cd src

- name: Setup Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: '3.11'
architecture: 'x64'

- name: Install dependencies
run: pip install poetry
working-directory: ./src
run: |
pip install poetry
poetry install
- name: Setup poetry project
run: poetry install
- name: Set up Docker Compose
working-directory: ./src
run: docker-compose up -d

- name: Run tests (inside Docker)
working-directory: ./src
run: |
pytest src/test --junitxml=pytest_report.xml
continue-on-error: true

docker-compose exec fastapi_server pytest /code/test/ --junitxml=/code/pytest_report.xml
docker cp ${CONTAINER_ID}:/code/pytest_report.xml pytest_report.xml
- name: Install Node.js and xml2js
uses: actions/setup-node@v3
with:
node-version: '16'

- name: Install xml2js
run: |
npm install xml2js
working-directory: ./src
run: npm install xml2js

- name: Report test results
if: failure()
working-directory: ./src
uses: actions/github-script@v6
with:
script: |
const fs = require('fs');
const xml2js = require('xml2js');
const core = require('@actions/core');
const parser = new xml2js.Parser();
const xml = fs.readFileSync('src/pytest_report.xml', 'utf8');
const xml = fs.readFileSync('pytest_report.xml', 'utf8');
parser.parseString(xml, (err, result) => {
if (err) {
core.setFailed('Failed to parse XML');
Expand Down

0 comments on commit f1fd9a8

Please sign in to comment.