Skip to content

Commit

Permalink
Merge pull request #179 from SFTtech/milo/app-improvements
Browse files Browse the repository at this point in the history
app improvements
  • Loading branch information
mikonse authored Nov 27, 2023
2 parents 155c819 + c92809f commit 3dbbe00
Show file tree
Hide file tree
Showing 147 changed files with 26,766 additions and 29,856 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: Tests
name: backend
on:
push:
branches: [ "master" ]
pull_request:
workflow_call:

jobs:
pylint:
Expand Down Expand Up @@ -81,75 +79,3 @@ jobs:
run: pip install -e '.[dev,test]'
- name: Check formatting
run: make check-format

format-frontend:
runs-on: ubuntu-latest
defaults:
run:
working-directory: frontend
steps:
- uses: actions/checkout@v2
- name: Set up Nodejs
uses: actions/setup-node@v2
with:
node-version: "18"
cache: "npm"
cache-dependency-path: frontend/package-lock.json
- name: Install dependencies
run: npm ci
- name: Check JavaScript formatting
run: npx prettier --check .

build-web:
runs-on: ubuntu-latest
defaults:
run:
working-directory: frontend
steps:
- uses: actions/checkout@v2
- name: Set up Nodejs
uses: actions/setup-node@v2
with:
node-version: "18"
cache: "npm"
cache-dependency-path: frontend/package-lock.json
- name: Install dependencies
run: npm ci
- name: Build web app
run: npx nx build web

test-frontend:
runs-on: ubuntu-latest
defaults:
run:
working-directory: frontend
steps:
- uses: actions/checkout@v2
- name: Set up Nodejs
uses: actions/setup-node@v2
with:
node-version: "18"
cache: "npm"
cache-dependency-path: frontend/package-lock.json
- name: Install dependencies
run: npm ci
- name: Build web app
run: npx nx run-many --target test

lint-frontend:
runs-on: ubuntu-latest
defaults:
run:
working-directory: frontend
steps:
- uses: actions/checkout@v2
- name: Set up Nodejs
uses: actions/setup-node@v2
with:
node-version: "18"
cache: "npm"
cache-dependency-path: frontend/package-lock.json
- name: Install dependencies
run: npm ci
- name: Build web app
run: npx nx run-many --target lint
127 changes: 127 additions & 0 deletions .github/workflows/frontend.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
name: frontend
on:
workflow_call:

jobs:
format:
runs-on: ubuntu-latest
defaults:
run:
working-directory: frontend
steps:
- uses: actions/checkout@v2
- name: Set up Nodejs
uses: actions/setup-node@v2
with:
node-version: "18"
cache: "npm"
cache-dependency-path: frontend/package-lock.json
- name: Install dependencies
run: npm ci
- name: Check JavaScript formatting
run: npx prettier --check .

test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: frontend
steps:
- uses: actions/checkout@v2
- name: Set up Nodejs
uses: actions/setup-node@v2
with:
node-version: "18"
cache: "npm"
cache-dependency-path: frontend/package-lock.json
- name: Install dependencies
run: npm ci
- name: Build web app
run: npx nx run-many --target test

lint:
runs-on: ubuntu-latest
defaults:
run:
working-directory: frontend
steps:
- uses: actions/checkout@v2
- name: Set up Nodejs
uses: actions/setup-node@v2
with:
node-version: "18"
cache: "npm"
cache-dependency-path: frontend/package-lock.json
- name: Install dependencies
run: npm ci
- name: Build web app
run: npx nx run-many --target lint

build-web:
runs-on: ubuntu-latest
defaults:
run:
working-directory: frontend
steps:
- uses: actions/checkout@v2
- name: Set up Nodejs
uses: actions/setup-node@v2
with:
node-version: "18"
cache: "npm"
cache-dependency-path: frontend/package-lock.json
- name: Install dependencies
run: npm ci
- name: Build web app
run: npx nx build web

build-app:
runs-on: ubuntu-latest
defaults:
run:
working-directory: frontend
steps:
- uses: actions/checkout@v3

- name: Set up Nodejs
uses: actions/setup-node@v2
with:
node-version: "18"
cache: "npm"
cache-dependency-path: frontend/package-lock.json

- name: Install dependencies
run: npm ci

- name: Setup Android SDK
uses: android-actions/setup-android@v2

- uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Build App APK
run: npx nx build-android mobile --tasks assembleRelease

# - name: Sign App APK
# id: sign_app_apk
# uses: r0adkll/sign-android-release@v1
# with:
# releaseDirectory: frontend/apps/mobile/android/app/build/outputs/apk/release
# signingKeyBase64: ${{ secrets.ANDROID_SIGNING_KEY }}
# alias: ${{ secrets.ANDROID_KEY_STORE_ALIAS }}
# keyStorePassword: ${{ secrets.ANDROID_KEY_STORE_PASSWORD }}

# - name: Upload APK
# uses: actions/upload-artifact@v3
# with:
# name: app-release-apk
# path: ${{steps.sign_app_apk.outputs.signedReleaseFile}}
10 changes: 10 additions & 0 deletions .github/workflows/pull_request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Pull Request
on:
pull_request:

jobs:
build_and_test_frontend:
uses: ./.github/workflows/frontend.yaml

build_and_test_backend:
uses: ./.github/workflows/backend.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build release artifacts
name: Push or tag on master
on:
# we build on all pushes to master to (hopefully) get early warning
# of things breaking (but only build one set of debs)
Expand All @@ -13,44 +13,18 @@ env:
DOCKER_IMAGE_TAGS: latest ${{ github.sha }} ${{github.ref_name}}

jobs:
build-and-publish-sdist:
name: Build and publish Python distributions to PyPI and TestPyPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
build_and_test_frontend:
uses: ./.github/workflows/frontend.yaml

- name: Set up Python 3.9
uses: actions/setup-python@v1
with:
python-version: 3.9

- name: Install pypa/flit
run: pip install flit

- name: Build a binary wheel and a source tarball
run: flit build

- uses: actions/upload-artifact@v2
with:
name: python-dist
path: dist/*

#- name: Publish distribution 📦 to Test PyPI
# if: startsWith(github.ref, 'refs/tags')
# uses: pypa/gh-action-pypi-publish@master
# with:
# password: ${{ secrets.TEST_PYPI_API_TOKEN }}
# repository_url: https://test.pypi.org/legacy/

#- name: Publish distribution 📦 to PyPI
# if: startsWith(github.ref, 'refs/tags')
# uses: pypa/gh-action-pypi-publish@master
# with:
# password: ${{ secrets.PYPI_API_TOKEN }}
build_and_test_backend:
uses: ./.github/workflows/backend.yaml

get-distros:
name: "Calculate list of debian distros and docker image tags"
runs-on: ubuntu-latest
needs:
- frontend
- backend
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
Expand All @@ -69,11 +43,12 @@ jobs:
outputs:
distros: ${{ steps.set-distros.outputs.distros }}
tags: ${{ steps.set-distros.outputs.tags }}

build-and-publish-docker:
name: Build and publish ready made docker containers
runs-on: ubuntu-latest
needs: get-distros
needs:
- get-distros
steps:
- uses: actions/checkout@master

Expand All @@ -95,7 +70,7 @@ jobs:
registry: quay.io/abrechnung
username: ${{ secrets.DOCKERHUB_REGISTRY_USER }}
password: ${{ secrets.DOCKERHUB_REGISTRY_PASSWORD }}

- name: Build Frontend Image
id: build-frontend-image
uses: redhat-actions/buildah-build@v2
Expand All @@ -117,7 +92,8 @@ jobs:

# now build the packages with an abrechnung build.
build-debs:
needs: get-distros
needs:
- get-distros
name: "Build .deb packages"
runs-on: ubuntu-latest
strategy:
Expand Down Expand Up @@ -182,23 +158,22 @@ jobs:
name: "Attach assets to release"
if: ${{ !failure() && !cancelled() && startsWith(github.ref, 'refs/tags/') }}
needs:
- frontend
- backend
- build-debs
- build-and-publish-sdist
runs-on: ubuntu-latest
steps:
- name: Download all workflow run artifacts
uses: actions/download-artifact@v2
- name: Build a tarball for the debs
run: tar -cvJf debs.tar.xz debs
- name: Attach to release
uses: softprops/action-gh-release@a929a66f232c1b11af63782948aa2210f981808a # PR#109
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
python-dist/*
debs/*.deb
debs.tar.xz
frontend/apps/mobile/android/app/build/outputs/apk/debug/app-debug.apk
# if it's not already published, keep the release as a draft.
draft: true
# mark it as a prerelease if the tag contains 'rc'.
Expand Down
Loading

0 comments on commit 3dbbe00

Please sign in to comment.