-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8e0e0d4
commit c7df135
Showing
2 changed files
with
115 additions
and
113 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,112 +1,114 @@ | ||
name: Build and Test Python Package | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.10.x | ||
|
||
- name: Install dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install libsox-dev | ||
sudo apt-get install sox -y | ||
sudo apt install ffmpeg -y | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
- name: Build package | ||
run: | | ||
python setup.py sdist bdist_wheel | ||
- name: Upload package to Github Releases | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: mimasa-build | ||
path: dist | ||
|
||
test: | ||
runs-on: ubuntu-latest | ||
needs: build | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.10.x | ||
|
||
- name: Download package artifacts | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: mimasa-build | ||
|
||
- name: Install package & dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install libsox-dev | ||
sudo apt-get install sox -y | ||
sudo apt install ffmpeg -y | ||
python -m pip install --upgrade pip | ||
python -m pip install *.whl | ||
- name: Run unit tests | ||
run: python src/api/mimasa/manage.py test face_detection | ||
|
||
- name: Generate Coverage Reports | ||
run: | | ||
coverage run src/api/mimasa/manage.py test face_detection | ||
coverage html | ||
- name: Upload coverage report to Github Releases | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: mimasa-coverage-report | ||
path: _coverage_report | ||
|
||
- name: Download artifacts | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: mimasa-coverage-report | ||
|
||
- name: Post Coverage Report Comment | ||
if: ${{ github.event_name }} == 'pull_request' | ||
uses: actions/github-script@v4 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
const result = await github.pulls.list({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
head: context.sha, | ||
}); | ||
if (result.data.length) { | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const reportPath = path.join(process.env.GITHUB_WORKSPACE, '_coverage_report/index.html'); | ||
const report = fs.readFileSync(reportPath, 'utf8'); | ||
const comment = `## Coverage Report\n\n${report}`; | ||
const pullRequest = result.data[0]; | ||
await github.issues.createComment({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
issue_number: pullRequest.number, | ||
body: comment, | ||
}); | ||
} | ||
name: Build and Test Python Package | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.10.x | ||
|
||
- name: Install dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install libsox-dev | ||
sudo apt-get install sox -y | ||
sudo apt install ffmpeg -y | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
- name: Build package | ||
run: | | ||
python setup.py sdist bdist_wheel | ||
- name: Upload package to Github Releases | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: mimasa-build | ||
path: dist | ||
|
||
test: | ||
runs-on: ubuntu-latest | ||
needs: build | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.10.x | ||
|
||
- name: Download package artifacts | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: mimasa-build | ||
|
||
- name: Install package & dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install libsox-dev | ||
sudo apt-get install sox -y | ||
sudo apt install ffmpeg -y | ||
python -m pip install --upgrade pip | ||
python -m pip install *.whl | ||
- name: Run unit tests | ||
run: | | ||
python src/common/download_data.py | ||
python src/api/mimasa/manage.py test face_detection | ||
- name: Generate Coverage Reports | ||
run: | | ||
coverage run src/api/mimasa/manage.py test face_detection | ||
coverage html | ||
- name: Upload coverage report to Github Releases | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: mimasa-coverage-report | ||
path: _coverage_report | ||
|
||
- name: Download artifacts | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: mimasa-coverage-report | ||
|
||
- name: Post Coverage Report Comment | ||
if: ${{ github.event_name }} == 'pull_request' | ||
uses: actions/github-script@v4 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
const result = await github.pulls.list({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
head: context.sha, | ||
}); | ||
if (result.data.length) { | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const reportPath = path.join(process.env.GITHUB_WORKSPACE, '_coverage_report/index.html'); | ||
const report = fs.readFileSync(reportPath, 'utf8'); | ||
const comment = `## Coverage Report\n\n${report}`; | ||
const pullRequest = result.data[0]; | ||
await github.issues.createComment({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
issue_number: pullRequest.number, | ||
body: comment, | ||
}); | ||
} |
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