Bump setuptools from 68.2.1 to 75.1.0 #345
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: 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.11.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.11.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 venv .venv | |
source .venv/bin/activate | |
python -m pip install --upgrade pip | |
python -m pip install *.whl | |
- name: Download Sample Data | |
run: | | |
source .venv/bin/activate | |
python src/common/download_data.py | |
- name: Run unit tests | |
run: | | |
source .venv/bin/activate | |
python src/api/mimasa/manage.py test face_detection | |
- name: Run Audio & Video Translations | |
run: | | |
source .venv/bin/activate | |
python src/main.py | |
- name: Generate Coverage Reports | |
run: | | |
source .venv/bin/activate | |
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, | |
}); | |
} |