Skip to content

Commit

Permalink
Merge branch 'development' of https://github.com/hotosm/fmtm into fea…
Browse files Browse the repository at this point in the history
…t-error-page
  • Loading branch information
NSUWAL123 committed Sep 29, 2023
2 parents a7d6c22 + d804065 commit 53d830a
Show file tree
Hide file tree
Showing 18 changed files with 1,097 additions and 685 deletions.
46 changes: 27 additions & 19 deletions .github/workflows/build_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,38 +22,46 @@ jobs:
frontend-tests:
uses: ./.github/workflows/r-frontend_tests.yml

extract-versions:
extract-vars:
needs:
- pytest
- frontend-tests
uses: ./.github/workflows/r-extract_versions.yml
uses: ./.github/workflows/r-extract_vars.yml
with:
environment: ${{ github.ref_name }}

backend-build:
uses: ./.github/workflows/r-build_backend.yml
needs: extract-versions
uses: hotosm/gh-workflows/.github/workflows/image_build.yml@main
needs: [extract-vars]
with:
api_version: ${{ needs.extract-versions.outputs.api_version }}
context: src/backend
dockerfile: src/backend/Dockerfile
build_target: prod
image_tags: |
"ghcr.io/hotosm/fmtm/backend:${{ needs.extract-versions.outputs.api_version }}-${{ github.ref_name }}"
"ghcr.io/hotosm/fmtm/backend:${{ needs.extract-vars.outputs.api_version }}-${{ github.ref_name }}"
"ghcr.io/hotosm/fmtm/backend:latest"
build_args: |
APP_VERSION=${{ needs.extract-vars.outputs.api_version }}
frontend-main-build:
uses: ./.github/workflows/r-build_frontend.yml
needs: extract-versions
uses: hotosm/gh-workflows/.github/workflows/image_build.yml@main
needs: [extract-vars]
with:
environment: ${{ github.ref_name }}
name: main
app_version: ${{ needs.extract-versions.outputs.frontend_main_version }}
context: src/frontend
dockerfile: src/frontend/prod.dockerfile
build_target: prod
image_tags: |
"ghcr.io/hotosm/fmtm/frontend:${{ needs.extract-versions.outputs.frontend_main_version }}-${{ github.ref_name }}"
"ghcr.io/hotosm/fmtm/frontend:${{ needs.extract-vars.outputs.frontend_main_version }}-${{ github.ref_name }}"
"ghcr.io/hotosm/fmtm/frontend:latest"
build_args: |
APP_VERSION=${{ needs.extract-vars.outputs.frontend_main_version }}
API_URL=${{ needs.extract-vars.outputs.api_url }}
FRONTEND_MAIN_URL=${{ needs.extract-vars.outputs.frontend_main_url }}
smoke-test-backend:
runs-on: ubuntu-latest
needs:
- extract-versions
- extract-vars
- backend-build
environment:
name: ${{ github.ref_name }}
Expand All @@ -65,8 +73,8 @@ jobs:
- name: Environment to .env
env:
GIT_BRANCH: ${{ github.ref_name }}
API_VERSION: ${{ needs.extract-versions.outputs.api_version }}
FRONTEND_MAIN_VERSION: ${{ needs.extract-versions.outputs.frontend_main_version }}
API_VERSION: ${{ needs.extract-vars.outputs.api_version }}
FRONTEND_MAIN_VERSION: ${{ needs.extract-vars.outputs.frontend_main_version }}
run: |
echo "${{ secrets.DOTENV }}" > .env
echo "GIT_BRANCH=${GIT_BRANCH}" >> .env
Expand Down Expand Up @@ -109,7 +117,7 @@ jobs:
smoke-test-frontend:
runs-on: ubuntu-latest
needs:
- extract-versions
- extract-vars
- frontend-main-build
environment:
name: ${{ github.ref_name }}
Expand All @@ -124,7 +132,7 @@ jobs:
deploy-containers:
runs-on: ubuntu-latest
needs:
- extract-versions
- extract-vars
- smoke-test-backend
- smoke-test-frontend
environment:
Expand All @@ -137,8 +145,8 @@ jobs:
- name: Environment to .env
env:
GIT_BRANCH: ${{ github.ref_name }}
API_VERSION: ${{ needs.extract-versions.outputs.api_version }}
FRONTEND_MAIN_VERSION: ${{ needs.extract-versions.outputs.frontend_main_version }}
API_VERSION: ${{ needs.extract-vars.outputs.api_version }}
FRONTEND_MAIN_VERSION: ${{ needs.extract-vars.outputs.frontend_main_version }}
run: |
echo "${{ secrets.DOTENV }}" > .env
echo "GIT_BRANCH=${GIT_BRANCH}" >> .env
Expand Down
15 changes: 9 additions & 6 deletions .github/workflows/build_ci_img.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,18 @@ on:
workflow_dispatch:

jobs:
extract-versions:
uses: ./.github/workflows/r-extract_versions.yml
extract-vars:
uses: ./.github/workflows/r-extract_vars.yml

backend-ci-build:
uses: ./.github/workflows/r-build_backend.yml
needs: [extract-versions]
uses: hotosm/gh-workflows/.github/workflows/image_build.yml@main
needs: [extract-vars]
with:
api_version: ${{ needs.extract-versions.outputs.api_version }}
context: src/backend
dockerfile: src/backend/Dockerfile
build_target: ci
image_tags: |
"ghcr.io/hotosm/fmtm/backend:${{ needs.extract-versions.outputs.api_version }}-ci-${{ github.ref_name }}"
"ghcr.io/hotosm/fmtm/backend:${{ needs.extract-vars.outputs.api_version }}-ci-${{ github.ref_name }}"
"ghcr.io/hotosm/fmtm/backend:ci-${{ github.ref_name }}"
build_args: |
APP_VERSION=${{ needs.extract-vars.outputs.api_version }}
53 changes: 18 additions & 35 deletions .github/workflows/build_odk_imgs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,39 +12,22 @@ on:
workflow_dispatch:

jobs:
build-and-push-images:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
build-odkcentral:
uses: hotosm/gh-workflows/.github/workflows/image_build.yml@main
with:
context: odkcentral/api
dockerfile: odkcentral/api/Dockerfile
image_tags: |
"ghcr.io/hotosm/fmtm/odkcentral:${{ vars.ODK_CENTRAL_VERSION }}"
"ghcr.io/hotosm/fmtm/odkcentral:latest"
build_args: |
ODK_CENTRAL_VERSION=${{ vars.ODK_CENTRAL_VERSION }}
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push odkcentral api
uses: docker/build-push-action@v4
with:
context: odkcentral/api
push: true
tags: |
"ghcr.io/hotosm/fmtm/odkcentral:${{ vars.ODK_CENTRAL_VERSION }}"
"ghcr.io/hotosm/fmtm/odkcentral:latest"
build-args: |
ODK_CENTRAL_VERSION=${{ vars.ODK_CENTRAL_VERSION }}
- name: Build and push odkcentral proxy
uses: docker/build-push-action@v4
with:
context: odkcentral/proxy
push: true
tags: |
"ghcr.io/hotosm/fmtm/odkcentral-proxy:${{ vars.ODK_CENTRAL_VERSION }}"
"ghcr.io/hotosm/fmtm/odkcentral-proxy:latest"
build-proxy:
uses: hotosm/gh-workflows/.github/workflows/image_build.yml@main
with:
context: odkcentral/proxy
dockerfile: odkcentral/proxy/Dockerfile
image_tags: |
"ghcr.io/hotosm/fmtm/odkcentral-proxy:${{ vars.ODK_CENTRAL_VERSION }}"
"ghcr.io/hotosm/fmtm/odkcentral-proxy:latest"
108 changes: 30 additions & 78 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,90 +10,42 @@ on:
# Allow manual trigger (workflow_dispatch)
workflow_dispatch:

permissions:
contents: write

jobs:
build_doxygen:
name: Build Doxygen Docs
get_cache_key:
runs-on: ubuntu-latest
outputs:
cache_key: ${{ steps.set_cache_key.outputs.cache_key }}
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup Doxygen
run: sudo apt-get update && sudo apt-get install -y doxygen
- name: Set cache key
id: set_cache_key
run: echo "cache_key=docs-build-$(date --utc '+%V')" >> $GITHUB_OUTPUT

- name: Write cache
uses: actions/cache@v3
with:
path: |
.cache
docs/apidocs
docs/openapi.json
key: doc-build-${{ env.cache_id }}

- name: Build Doxygen Docs
run: |
cd docs
doxygen
build_doxygen:
uses: hotosm/gh-workflows/.github/workflows/doxygen_build.yml@main
needs: [get_cache_key]
with:
cache_paths: |
docs/apidocs
cache_key: ${{ needs.get_cache_key.outputs.cache_key }}

build_openapi_json:
name: Build OpenAPI
runs-on: ubuntu-latest
container:
uses: hotosm/gh-workflows/.github/workflows/openapi_build.yml@main
needs: [get_cache_key]
with:
image: ghcr.io/hotosm/fmtm/backend:ci-main
options: --user root

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Read cache
uses: actions/cache@v3
with:
path: |
.cache
docs/apidocs
docs/openapi.json
key: doc-build-${{ env.cache_id }}
restore-keys: |
doc-build-
- name: Build OpenAPi JSON
run: |
chmod -R 777 .
gosu appuser python scripts/gen_openapi_json.py -o docs/openapi.json
example_env_file_path: ".env.example"
cache_paths: |
docs/openapi.json
cache_key: ${{ needs.get_cache_key.outputs.cache_key }}

publish_docs:
name: Publish Docs
runs-on: ubuntu-latest
container:
image: ghcr.io/hotosm/fmtm/backend:ci-main
options: --user root
needs: [build_doxygen, build_openapi_json]

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Read cache
uses: actions/cache@v3
with:
path: |
.cache
docs/apidocs
docs/openapi.json
key: doc-build-${{ env.cache_id }}
restore-keys: |
doc-build-
- name: Install Git
run: |
apt-get update
apt-get install -y git --no-install-recommends
- name: Publish
run: |
chmod -R 777 .
gosu appuser mkdocs gh-deploy --force
uses: hotosm/gh-workflows/.github/workflows/mkdocs_build.yml@main
needs:
- get_cache_key
- build_doxygen
- build_openapi_json
with:
cache_paths: |
docs/apidocs
docs/openapi.json
cache_key: ${{ needs.get_cache_key.outputs.cache_key }}
42 changes: 0 additions & 42 deletions .github/workflows/r-build_backend.yml

This file was deleted.

Loading

0 comments on commit 53d830a

Please sign in to comment.