Incorporate feedback from a native danish speaker #319
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 | |
on: | |
- push | |
jobs: | |
backend: | |
defaults: | |
run: | |
working-directory: server | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.8", "3.11"] | |
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 poetry | |
poetry install --all-extras | |
- name: Lint with flake8 | |
run: poetry run flake8 | |
- name: Typecheck with mypy | |
run: poetry run mypy | |
- name: Test with pytest | |
run: poetry run pytest | |
- name: Export OpenAPI spec & ERD | |
if: ${{ matrix.python-version == '3.11' }} # We only need it once. | |
run: | | |
poetry run dearmep dump openapi > openapi.json | |
poetry run dearmep dump erd dearmep-erd.svg | |
- name: Collect OpenAPI spec & ERD as an artifact | |
if: ${{ matrix.python-version == '3.11' }} | |
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 | |
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.11 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.11 | |
- 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 poetry | |
poetry install --only main | |
poetry 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: | | |
poetry 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" \; |