mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-12 15:25:57 +00:00
* feat(other): major improvement of deployment Motivation ---------- Kubernetes: * backend becomes a statefulset (exclusive volume mount) See: https://spacelift.io/blog/statefulset-vs-deployment * implement neo4j backup with job Docker: * consistent targets across all dockerfiles * remove redundant labels * remove unnecessary build args * remove obsolete networks * remove development dependencies for production Rebranding: * add image tags for local tagging and pulling * use Github's docker build workflows * use Github container registry * ONBUILD to simplify caller Dockerfiles * docker compose for branding Tooling: * same node --version as in dockerfile Docs: * missing step in README.md * refactor: remove submodules It's better to keep them all in a separate repository * improve kubernetes chart * better image tag defaults * split neo4j into its own chart (for re-use) * use application defaults where possible * optional resources for all pods * remove obsolete key/value pair from secrets * remove obsolete build argsand and add labels for neo4j enterprise * env vars for webapp * allow to define redirect domains Define a list of Domains that redirect to the domain of the project. The idea is to provide the ability to redirect eg. www.domain.tld to domain.tld * remove maintenance part regarding database * move backup job outside template folder * name the ingress * updated ingress * handle empty case of middlewares * try to default the ingress * use quote * restore todo-next-update * fix docu check * fix naming * try using prod:migrate * try using override config * copy src folder * try using base as image instead of build * fix test build * force build * comment for the problem * fix webapp tests (potentially) --------- Co-authored-by: Ulf Gebhardt <ulf.gebhardt@webcraft-media.de>
119 lines
3.8 KiB
YAML
119 lines
3.8 KiB
YAML
name: ocelot.social webapp test CI
|
|
|
|
|
|
on: push
|
|
|
|
jobs:
|
|
files-changed:
|
|
name: Detect File Changes - Webapp
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
docker: ${{ steps.changes.outputs.docker }}
|
|
webapp: ${{ steps.changes.outputs.webapp }}
|
|
steps:
|
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.1.7
|
|
|
|
- name: Check for frontend file changes
|
|
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
|
|
id: changes
|
|
with:
|
|
token: ${{ github.token }}
|
|
filters: .github/file-filters.yml
|
|
list-files: shell
|
|
|
|
prepare:
|
|
name: Prepare
|
|
if: needs.files-changed.outputs.webapp == 'true'
|
|
needs: files-changed
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.1.7
|
|
|
|
- name: Check translation files
|
|
run: |
|
|
scripts/translations/sort.sh
|
|
scripts/translations/missing-keys.sh
|
|
|
|
build_test_webapp:
|
|
name: Docker Build Test - Webapp
|
|
if: needs.files-changed.outputs.docker == 'true' || needs.files-changed.outputs.webapp == 'true'
|
|
needs: [files-changed, prepare]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.1.7
|
|
|
|
- name: Webapp | Build 'test' image
|
|
run: |
|
|
docker build --target test -t "ocelotsocialnetwork/webapp:test" webapp/
|
|
docker save "ocelotsocialnetwork/webapp:test" > /tmp/webapp.tar
|
|
|
|
- name: Cache docker image
|
|
uses: actions/cache@0c907a75c2c80ebcb7f088228285e798b750cf8f # v4.0.2
|
|
with:
|
|
path: /tmp/webapp.tar
|
|
key: ${{ github.run_id }}-webapp-cache
|
|
|
|
lint_webapp:
|
|
name: Lint Webapp
|
|
if: needs.files-changed.outputs.webapp == 'true'
|
|
needs: files-changed
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.1.7
|
|
|
|
- name: webapp | Lint
|
|
run: cd webapp && yarn && yarn run lint
|
|
|
|
unit_test_webapp:
|
|
name: Unit Tests - Webapp
|
|
if: needs.files-changed.outputs.docker == 'true' || needs.files-changed.outputs.webapp == 'true'
|
|
needs: [files-changed, build_test_webapp]
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
checks: write
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.1.7
|
|
|
|
- name: Restore webapp cache
|
|
uses: actions/cache@0c907a75c2c80ebcb7f088228285e798b750cf8f # v4.0.2
|
|
with:
|
|
path: /tmp/webapp.tar
|
|
key: ${{ github.run_id }}-webapp-cache
|
|
|
|
- name: Load Docker Image
|
|
run: docker load < /tmp/webapp.tar
|
|
|
|
- name: Copy env files
|
|
run: |
|
|
cp webapp/.env.template webapp/.env
|
|
cp frontend/.env.dist frontend/.env
|
|
cp backend/.env.template backend/.env
|
|
|
|
- name: backend | docker compose
|
|
# doesn't work without the --build flag - this either means we should not load the cached images or cache the correct image
|
|
run: docker compose -f docker-compose.yml -f docker-compose.test.yml up --detach --no-deps webapp --build
|
|
|
|
- name: webapp | Unit tests incl. coverage check
|
|
run: docker compose exec -T webapp yarn test
|
|
|
|
cleanup:
|
|
name: Cleanup
|
|
if: ${{ needs.files-changed.outputs.docker == 'true' || needs.files-changed.outputs.webapp == 'true' }}
|
|
needs: [files-changed, unit_test_webapp]
|
|
runs-on: ubuntu-latest
|
|
permissions: write-all
|
|
continue-on-error: true
|
|
steps:
|
|
- name: Delete cache
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
gh extension install actions/gh-actions-cache
|
|
KEY="${{ github.run_id }}-webapp-cache"
|
|
gh actions-cache delete $KEY -R Ocelot-Social-Community/Ocelot-Social --confirm
|
|
|