Skip to content

Explain how to provide IVR audio & link media repo #735

Explain how to provide IVR audio & link media repo

Explain how to provide IVR audio & link media repo #735

Workflow file for this run

# SPDX-FileCopyrightText: © 2022 Tim Weber
# SPDX-FileCopyrightText: © 2023 Tobias Mühlberger
#
# SPDX-License-Identifier: AGPL-3.0-or-later
name: Build
on:
- push
jobs:
backend:
defaults:
run:
working-directory: server
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.13"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y graphviz graphviz-dev python3-dev
python -m pip install uv
uv sync --all-extras
- name: Lint with Ruff
run: uv run ruff check --output-format github
- name: Typecheck with mypy
run: uv run mypy
- name: Test with pytest
run: uv run pytest
- name: Export OpenAPI spec & ERD
if: ${{ matrix.python-version == '3.13' }} # We only need it once.
run: |
uv run dearmep dump openapi > openapi.json
uv run dearmep dump erd dearmep-erd.svg
# Copy the OpenAPI spec to be deployed to GitHub pages.
mkdir ../.github-pages
cp openapi.json ../.github-pages
- name: Collect OpenAPI spec & ERD as an artifact
if: ${{ matrix.python-version == '3.13' }}
uses: actions/upload-artifact@v3
with:
name: specs
retention-days: 8
path: |
server/dearmep-erd.svg
server/openapi.json
- name: Collect test results
if: ${{ always() }} # Meaning: also if the job fails.
uses: actions/upload-artifact@v3
with:
name: test-results-${{ matrix.python-version }}
retention-days: 15
path: |
server/coverage.xml
server/report.xml
- name: Prepare OpenAPI spec for GitHub Pages
if: ${{ matrix.python-version == '3.13' }}
uses: actions/upload-pages-artifact@v3
with:
path: .github-pages
frontend:
needs: backend # Because of the OpenAPI spec.
defaults:
run:
working-directory: client
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ["18.x", "20.x"]
steps:
- uses: actions/checkout@v3
- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Retrieve OpenAPI spec
uses: actions/download-artifact@v3
with:
name: specs
- name: Install dependencies
run: npm ci
- name: Build API client
run: npm run generate-client
- name: Lint
run: npm run lint
- name: Build
run: npm run build
- name: Collect completed frontend build as an artifact
if: ${{ matrix.node-version == '20.x' }}
uses: actions/upload-artifact@v3
with:
name: frontend
retention-days: 8
path: |
client/dist/dear-mep-bundle/
build:
needs: frontend # For JS, CSS & assets.
defaults:
run:
working-directory: server
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.13
uses: actions/setup-python@v4
with:
python-version: 3.13
- name: Set package version
run: |
if [ "$GITHUB_REF_TYPE" = 'tag' ]; then
printf '%s' "$GITHUB_REF_NAME" > .build-version
else
sed -n -e "0,/^version = \"\\(.*\\)-dev\.9999999999\"$/s//\\1-dev.$(date +%s)+gh$(git rev-parse --short HEAD)/p" pyproject.toml > .build-version
fi
cat .build-version; echo
sed -i -e "0,/^version = \".*\$/s//version = \"$(cat .build-version)\"/" pyproject.toml
- name: Install dependencies
run: |
python -m pip install uv
uv sync
uv run dearmep version
- name: Retrieve frontend
uses: actions/download-artifact@v3
with:
name: frontend
path: server/dearmep/static_files/static
- name: Build Python package
run: |
uv build
- name: Collect Python package as an artifact
uses: actions/upload-artifact@v3
with:
name: python-package
path: |
server/dist/*.whl
server/dist/*.tar.gz
- name: Upload Python package to Nextcloud
env:
NEXTCLOUD_HOST: ${{ secrets.NEXTCLOUD_HOST }}
NEXTCLOUD_SHARE_ID: ${{ secrets.NEXTCLOUD_SHARE_ID }}
NEXTCLOUD_BASE: https://${{ secrets.NEXTCLOUD_HOST }}/public.php/webdav/
run: |
(umask 0077; printf "machine $NEXTCLOUD_HOST login $NEXTCLOUD_SHARE_ID\\n" >> ~/.netrc)
cd dist
find . -type f -exec curl --netrc --upload-file '{}' "$NEXTCLOUD_BASE" \;
deploy:
needs: build # Technically, it only needs "backend", but we want the build to succeed first.
# Only update the web-hosted version on the main branch.
if: github.ref_name == 'main'
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.pages_deployment.outputs.page_url }}
# Specify runner + deployment step
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: pages_deployment
uses: actions/deploy-pages@v4