buzz/.github/workflows/ci.yml
2022-11-02 23:00:21 +00:00

144 lines
3.7 KiB
YAML

---
name: CI
on:
push:
branches:
- master
tags:
- '*'
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: macos-11
- os: windows-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions/setup-python@v4
with:
python-version: '3.9.13'
- name: Install Poetry Action
uses: snok/install-poetry@v1.3.1
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}-2
- name: Load cached Whisper models
id: cached-whisper-models
uses: actions/cache@v3
with:
path: |
~/Library/Caches/Buzz
~/.cache/whisper
key: whisper-models-${{ runner.os }}
- run: poetry install
- name: Install ffmpeg
run: |
if [ "$RUNNER_OS" == "macOS" ]; then
brew install ffmpeg
elif [ "$RUNNER_OS" == "Windows" ]; then
choco install ffmpeg
elif [ "$RUNNER_OS" == "Linux" ]; then
sudo apt update && sudo apt install ffmpeg
fi
shell: bash
- name: Test
run: poetry run make test
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: macos-latest
- os: ubuntu-latest
- os: windows-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions/setup-python@v4
with:
python-version: '3.9.13'
- name: Install Poetry Action
uses: snok/install-poetry@v1.3.1
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}-2
- run: poetry install
- name: Install ffmpeg
run: |
if [ "$RUNNER_OS" == "macOS" ]; then
brew install ffmpeg
elif [ "$RUNNER_OS" == "Windows" ]; then
choco install ffmpeg
elif [ "$RUNNER_OS" == "Linux" ]; then
sudo apt update && sudo apt install ffmpeg
fi
shell: bash
- name: Bundle
run: |
if [ "$RUNNER_OS" == "macOS" ]; then
poetry run make bundle_mac
elif [ "$RUNNER_OS" == "Windows" ]; then
poetry run make dist/Buzz.exe
elif [ "$RUNNER_OS" == "Linux" ]; then
poetry run make bundle_linux
fi
env:
BUZZ_VERSION: ${{ github.ref_name }}
shell: bash
- uses: actions/upload-artifact@v3
with:
name: Buzz-${{ runner.os }}
path: |
dist/Buzz*.tar.gz
dist/Buzz*.zip
dist/Buzz*.exe
release:
runs-on: ubuntu-latest
needs: [build, test]
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/download-artifact@v3
with:
name: Buzz-Linux
- uses: actions/download-artifact@v3
with:
name: Buzz-Windows
- name: Release
uses: softprops/action-gh-release@v1
with:
files: |
Buzz*.tar.gz
Buzz*.dmg
Buzz.exe