diff --git a/.github/workflows/backend.yml b/.github/workflows/backend.yml new file mode 100644 index 00000000..982a55c7 --- /dev/null +++ b/.github/workflows/backend.yml @@ -0,0 +1,24 @@ +name: Backend + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + release: + runs-on: ubuntu-latest + if: github.ref == 'refs/heads/master' + steps: + - uses: actions/checkout@v2 + - uses: docker/build-push-action@v1 + with: + dockerfile: backend/Dockerfile + username: ${{ github.actor }} + password: ${{ github.token }} + registry: docker.pkg.github.com/polycortex/polydodo + repository: backend + tags: latest diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml new file mode 100644 index 00000000..1508c38b --- /dev/null +++ b/.github/workflows/mobile.yml @@ -0,0 +1,45 @@ +name: Mobile + +on: + push: + branches: + - master + pull_request: + branches: + - master + +defaults: + run: + working-directory: mobile + +jobs: + build: + runs-on: macos-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v1 + with: + java-version: "12.x" + - uses: subosito/flutter-action@v1 + - uses: abelfodil/protoc-action@v1 + with: + enable-dart: true + + - run: protoc --proto_path=protos protos/* --dart_out=mobile/lib/protos + working-directory: . + + - run: flutter pub get + + - run: flutter test + + - run: flutter build apk + - uses: actions/upload-artifact@v2 + with: + name: Android app + path: mobile/build/app/outputs/flutter-apk/app-release.apk + + - run: flutter build ios --release --no-codesign + - uses: actions/upload-artifact@v2 + with: + name: iOS app + path: mobile/build/ios/iphoneos/Runner.app diff --git a/.github/workflows/web.yml b/.github/workflows/web.yml new file mode 100644 index 00000000..f84c8195 --- /dev/null +++ b/.github/workflows/web.yml @@ -0,0 +1,38 @@ +name: Web + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: abelfodil/protoc-action@v1 + - uses: borales/actions-yarn@v2.3.0 + with: + cmd: --cwd web install + - run: protoc --proto_path=protos protos/* --js_out=web/src/protos + - uses: borales/actions-yarn@v2.3.0 + with: + cmd: --cwd web build + + release: + runs-on: ubuntu-latest + needs: build + if: github.ref == 'refs/heads/master' + steps: + - uses: actions/checkout@v2 + - uses: docker/build-push-action@v1 + with: + dockerfile: web/Dockerfile + username: ${{ github.actor }} + password: ${{ github.token }} + registry: docker.pkg.github.com/polycortex/polydodo + repository: web + tags: latest diff --git a/backend/Dockerfile b/backend/Dockerfile new file mode 100644 index 00000000..97c0b228 --- /dev/null +++ b/backend/Dockerfile @@ -0,0 +1,11 @@ +FROM namely/protoc-all as generator +WORKDIR / +COPY protos protos +COPY backend backend +RUN protoc --proto_path=protos protos/* --python_out=backend/protos + +FROM python +COPY --from=generator /backend /backend +WORKDIR /backend +RUN pip install -r requirements.txt --no-cache-dir +ENTRYPOINT ["python", "app.py"] diff --git a/web/Dockerfile b/web/Dockerfile new file mode 100644 index 00000000..e4008934 --- /dev/null +++ b/web/Dockerfile @@ -0,0 +1,14 @@ +FROM namely/protoc-all as generator +WORKDIR / +COPY protos protos +COPY web web +RUN protoc --proto_path=protos protos/* --js_out=web/src/protos + +FROM node:14 as builder +COPY --from=generator /web /web +WORKDIR /web +RUN yarn install +RUN yarn build + +FROM nginx:alpine +COPY --from=builder /web/build/ /usr/share/nginx/html