Skip to content

Commit

Permalink
Turn KitchenOwl into a monorepo (#356)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomBursch authored Jan 22, 2024
2 parents 7ae5ff0 + c9e709b commit 0e84e37
Show file tree
Hide file tree
Showing 669 changed files with 21,532 additions and 143 deletions.
67 changes: 14 additions & 53 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
# Docker ignore (include only web files)
# General files
.git
.github

# KitchenOwl
icons/
docs/
fedora/
ios/
android/
linux/
macos/
windows/
.github/
kitchenowl/fedora/
kitchenowl/ios/
kitchenowl/android/
kitchenowl/linux/
kitchenowl/macos/
kitchenowl/windows/

backend/upload/
backend/database.db

# .gitignore here:
# Miscellaneous
Expand Down Expand Up @@ -84,60 +90,15 @@ unlinked_spec.ds
**/android/key.properties
*.jks

# iOS/XCode related
**/ios/**/*.mode1v3
**/ios/**/*.mode2v3
**/ios/**/*.moved-aside
**/ios/**/*.pbxuser
**/ios/**/*.perspectivev3
**/ios/**/*sync/
**/ios/**/.sconsign.dblite
**/ios/**/.tags*
**/ios/**/.vagrant/
**/ios/**/DerivedData/
**/ios/**/Icon?
**/ios/**/Pods/
**/ios/**/.symlinks/
**/ios/**/profile
**/ios/**/xcuserdata
**/ios/.generated/
**/ios/Flutter/.last_build_id
**/ios/Flutter/App.framework
**/ios/Flutter/Flutter.framework
**/ios/Flutter/Flutter.podspec
**/ios/Flutter/Generated.xcconfig
**/ios/Flutter/ephemeral
**/ios/Flutter/app.flx
**/ios/Flutter/app.zip
**/ios/Flutter/flutter_assets/
**/ios/Flutter/flutter_export_environment.sh
**/ios/ServiceDefinitions.json
**/ios/Runner/GeneratedPluginRegistrant.*

# macOS
**/macos/Flutter/GeneratedPluginRegistrant.swift
**/macos/Flutter/ephemeral

# Coverage
coverage/

# Symbols
app.*.symbols

# Exceptions to above rules.
!**/ios/**/default.mode1v3
!**/ios/**/default.mode2v3
!**/ios/**/default.pbxuser
!**/ios/**/default.perspectivev3
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
!/dev/ci/**/Gemfile.lock

# MkDocs
site/

# KitchenOwl
icons/

# Development
.devcontainer

Expand Down
70 changes: 70 additions & 0 deletions .github/workflows/deploy_backend_docker_hub.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: CI deploy backend to Docker Hub

# Controls when the workflow will run
on:
# Triggers the workflow on push events but only for tags
push:
branches: [ main ]
paths:
- backend/**
tags:
- "v*"
- "beta-v*"

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4

- name: decide docker tags
id: dockertag
run: |
if [[ $REF == "refs/tags/v"* ]]
then
echo "tags=$BASE_TAG:latest, $BASE_TAG:beta, $BASE_TAG:${REF#refs/tags/}" >> $GITHUB_ENV
elif [[ $REF == "refs/tags/beta-v"* ]]
then
echo "tags=$BASE_TAG:beta, $BASE_TAG:${REF#refs/tags/}" >> $GITHUB_ENV
else
echo "tags=$BASE_TAG:dev" >> $GITHUB_ENV
fi
env:
REF: ${{ github.ref }}
BASE_TAG: ${{ secrets.DOCKER_HUB_USERNAME }}/kitchenowl-backend

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3

- name: Build and push
id: docker_build
uses: docker/build-push-action@v5
with:
context: ./
file: backend/Dockerfile
platforms: linux/amd64,linux/arm64 #,linux/arm/v7 #,linux/386,linux/arm/v6
push: true
tags: ${{ env.tags }}
# cache-from: type=registry,ref=${{ secrets.DOCKER_HUB_USERNAME }}/kitchenowl:buildcache
# cache-to: type=registry,ref=${{ secrets.DOCKER_HUB_USERNAME }}/kitchenowl:buildcache,mode=max

- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
20 changes: 6 additions & 14 deletions .github/workflows/deploy_docker_hub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,8 @@ on:
push:
branches: [ main ]
paths:
- lib/**
- web/**
- assets/**
- Dockerfile
- entrypoint.sh
- pubspec.yaml
- default.conf.template
- kitchenowl/**
- backend/**
tags:
- "v*"
- "beta-v*"
Expand Down Expand Up @@ -45,10 +40,7 @@ jobs:
fi
env:
REF: ${{ github.ref }}
BASE_TAG: ${{ secrets.DOCKER_HUB_USERNAME }}/kitchenowl-web

- name: Tags
run: echo ${{ env.tags }}
BASE_TAG: ${{ secrets.DOCKER_HUB_USERNAME }}/kitchenowl

- name: Login to Docker Hub
uses: docker/login-action@v3
Expand All @@ -69,11 +61,11 @@ jobs:
with:
context: ./
file: ./Dockerfile
platforms: linux/amd64,linux/arm64,linux/386,linux/arm/v7,linux/arm/v6
platforms: linux/amd64,linux/arm64 #,linux/arm/v7 #,linux/386,linux/arm/v6
push: true
tags: ${{ env.tags }}
cache-from: type=registry,ref=${{ secrets.DOCKER_HUB_USERNAME }}/kitchenowl-web:buildcache
cache-to: type=registry,ref=${{ secrets.DOCKER_HUB_USERNAME }}/kitchenowl-web:buildcache,mode=max
# cache-from: type=registry,ref=${{ secrets.DOCKER_HUB_USERNAME }}/kitchenowl:buildcache
# cache-to: type=registry,ref=${{ secrets.DOCKER_HUB_USERNAME }}/kitchenowl:buildcache,mode=max

- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
1 change: 1 addition & 0 deletions .github/workflows/deploy_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
paths:
- docs/**
- mkdocs.yml
- docs-requirements.txt
workflow_dispatch:

jobs:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/deploy_play_store.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ jobs:
with:
channel: stable
- run: flutter config --no-analytics
- run: flutter doctor -v

# Checkout code and get packages.
- name: Checkout code
uses: actions/checkout@v4
- run: flutter packages get
working-directory: kitchenowl/android

# Decide track internal|beta|production (not in use yet)
- name: Decide track
Expand All @@ -55,7 +55,7 @@ jobs:
with:
ruby-version: "3.2"
bundler-cache: true
working-directory: android
working-directory: kitchenowl/android

- name: Configure Keystore
run: |
Expand All @@ -69,11 +69,11 @@ jobs:
KEYSTORE_KEY_ALIAS: ${{ secrets.KEYSTORE_KEY_ALIAS }}
KEYSTORE_KEY_PASSWORD: ${{ secrets.KEYSTORE_KEY_PASSWORD }}
KEYSTORE_STORE_PASSWORD: ${{ secrets.KEYSTORE_STORE_PASSWORD }}
working-directory: android
working-directory: kitchenowl/android

# Build and deploy with Fastlane (by default, to internal track) 🚀.
# Naturally, promote_to_production only deploys.
- run: bundle exec fastlane ${{ github.event.inputs.lane || 'internal' }}
env:
PLAY_STORE_CONFIG_JSON: ${{ secrets.PLAY_STORE_CONFIG_JSON }}
working-directory: android
working-directory: kitchenowl/android
70 changes: 70 additions & 0 deletions .github/workflows/deploy_web_docker_hub.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: CI deploy web to Docker Hub

# Controls when the workflow will run
on:
# Triggers the workflow on push events of tags
push:
branches: [ main ]
paths:
- kitchenowl/**
tags:
- "v*"
- "beta-v*"

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4

- name: decide docker tags
id: dockertag
run: |
if [[ $REF == "refs/tags/v"* ]]
then
echo "tags=$BASE_TAG:latest, $BASE_TAG:beta, $BASE_TAG:${REF#refs/tags/}" >> $GITHUB_ENV
elif [[ $REF == "refs/tags/beta-v"* ]]
then
echo "tags=$BASE_TAG:beta, $BASE_TAG:${REF#refs/tags/}" >> $GITHUB_ENV
else
echo "tags=$BASE_TAG:dev" >> $GITHUB_ENV
fi
env:
REF: ${{ github.ref }}
BASE_TAG: ${{ secrets.DOCKER_HUB_USERNAME }}/kitchenowl-web

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3

- name: Build and push
id: docker_build
uses: docker/build-push-action@v5
with:
context: ./
file: kitchenowl/Dockerfile
platforms: linux/amd64,linux/arm64,linux/386,linux/arm/v7,linux/arm/v6
push: true
tags: ${{ env.tags }}
cache-from: type=registry,ref=${{ secrets.DOCKER_HUB_USERNAME }}/kitchenowl-web:buildcache
cache-to: type=registry,ref=${{ secrets.DOCKER_HUB_USERNAME }}/kitchenowl-web:buildcache,mode=max

- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
46 changes: 46 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Pytesting

on:
push:
branches: [ main ]
paths:
- backend/**
pull_request:
branches: [ main ]
paths:
- backend/**

jobs:
build:

runs-on: ubuntu-latest

defaults:
run:
working-directory: backend

steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pip'
cache-dependency-path: backend/requirements.txt
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 app tests --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 app tests --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest
Loading

0 comments on commit 0e84e37

Please sign in to comment.