-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge backend and frontend to a monorepo
- Loading branch information
Showing
716 changed files
with
137,192 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# Blacklisted folders | ||
################################################# | ||
node_modules | ||
**/node_modules | ||
|
||
# tests | ||
**/__tests__ | ||
**/__mocks__ | ||
**/cypress | ||
|
||
.git | ||
.github | ||
|
||
**/.env* | ||
|
||
# build just in case | ||
**/build | ||
**/dist | ||
|
||
# caches | ||
**/.swc | ||
**/.turbo | ||
**/.next | ||
|
||
# old just in case | ||
**/.yarn | ||
|
||
# pipelines | ||
**/*azure-pipelines*.yml | ||
|
||
# logs | ||
**/*.log | ||
|
||
# misc | ||
**/.local/ | ||
certificates/ | ||
|
||
# docs | ||
**/README.md | ||
**/LICENSE | ||
**/CHANGELOG.md | ||
|
||
# configs | ||
**/.nvmrc | ||
**/.eslintrc* | ||
**/.babelrc* | ||
**/.prettierignore | ||
**/.huskyrc | ||
**/.eslintignore | ||
**/.editorconfig | ||
**/.prettierrc | ||
**/stylelint.config.js | ||
**/jest.config.js | ||
**/jest.setup.js | ||
**/codegen.yml | ||
|
||
# backend | ||
backend/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
gql-types.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
# Generic workflow to build a frontend application and push it to the GitHub Container Registry. | ||
name: "Build docker" | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
# Docker build arg / package name suffix: valid values are "admin-ui" or "ui" | ||
app-name: | ||
required: true | ||
type: string | ||
# Root url for the application relative to hostname | ||
base-url: | ||
required: true | ||
type: string | ||
|
||
env: | ||
SKIP_ENV_VALIDATION: "true" | ||
REGISTRY: "ghcr.io" | ||
|
||
jobs: | ||
build-and-push: | ||
name: "Build and push Docker images to GitHub Packages" | ||
runs-on: ubuntu-latest | ||
env: | ||
BUILD_APP: ${{ inputs.app-name }} | ||
# Relative location for the package registry | ||
REPO_NAME: ${{ github.repository }} | ||
# Have to be build variable | ||
NEXT_PUBLIC_BASE_URL: ${{ inputs.base-url }} | ||
# required because error pages use build time env vars, not runtime env vars | ||
# it's the same on every environment | ||
EMAIL_VARAAMO_EXT_LINK: "https://lomake.hel.fi/varaamo-palaute" | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: "Checkout code" | ||
uses: actions/checkout@v4 | ||
|
||
- name: "Set up Docker Buildx" | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: "Log in to the Container registry" | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# Repository name needs to be lowercase | ||
- name: "Create repository name" | ||
id: repo | ||
run: >- | ||
echo "repo=$( | ||
echo ${{ env.REGISTRY }}/${{ env.REPO_NAME }}-${{ env.BUILD_APP }} | tr '[:upper:]' '[:lower:]' | ||
)" >> $GITHUB_OUTPUT | ||
- name: "Extract ui metadata (tags, labels) for Docker" | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
env: | ||
DOCKER_METADATA_PR_HEAD_SHA: true | ||
with: | ||
images: ${{ steps.repo.outputs.repo }} | ||
tags: | | ||
type=ref,event=tag,priority=3 | ||
type=sha,prefix=,priority=2 | ||
type=ref,event=branch,priority=1 | ||
labels: | | ||
org.opencontainers.image.title=Tilavarauspalvelu ${{ env.BUILD_APP }} | ||
org.opencontainers.image.description=Tilavarauspalvelu ${{ env.BUILD_APP }} ${{ github.ref_name }}. | ||
org.opencontainers.image.version=${{ github.ref_name }} | ||
- name: "Build container" | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: . | ||
push: true | ||
secrets: | | ||
"sentry_auth_token=${{ secrets.SENTRY_AUTH_TOKEN }}" | ||
build-args: | | ||
APP=${{ env.BUILD_APP }} | ||
NEXT_PUBLIC_BASE_URL=${{ env.NEXT_PUBLIC_BASE_URL }} | ||
EMAIL_VARAAMO_EXT_LINK=${{ env.EMAIL_VARAAMO_EXT_LINK }} | ||
NEXT_PUBLIC_SOURCE_VERSION=${{ github.sha }} | ||
NEXT_PUBLIC_SOURCE_BRANCH_NAME=${{ github.ref_name }} | ||
CI=true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
annotations: ${{ steps.meta.outputs.annotations }} | ||
# Use a shared cache to speed up builds | ||
cache-from: type=registry,ref=${{ steps.repo.outputs.repo }}:cache | ||
cache-to: type=registry,ref=${{ steps.repo.outputs.repo }}:cache,mode=max |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
on: | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- "v*" | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
# Cancel a workflow from the same PR, branch or tag when a new workflow is triggered. | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
# Build both ui and admin-ui dockers | ||
build-ui-docker: | ||
name: "Build ui docker" | ||
uses: ./.github/workflows/build-docker.yml | ||
with: | ||
app-name: "ui" | ||
base-url: "" | ||
secrets: inherit | ||
|
||
build-admin-ui-docker: | ||
name: "Build admin ui docker" | ||
uses: ./.github/workflows/build-docker.yml | ||
with: | ||
app-name: "admin-ui" | ||
base-url: "/kasittely" | ||
secrets: inherit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# Turbo dry run to determine which apps have changed between the latest commit and target or previous commit | ||
# For PR:s this comparison is done against the main branch | ||
name: 'Determine changed packages' | ||
|
||
on: | ||
workflow_call: | ||
outputs: | ||
changed_packages: | ||
description: 'Stringified JSON array of changed packages in this changeset' | ||
value: ${{ jobs.dry-run.outputs.changed_packages }} | ||
admin_changed: | ||
description: 'Indicates if the Admin UI or its dependencies have changed' | ||
value: ${{ jobs.dry-run.outputs.admin_changed }} | ||
ui_changed: | ||
description: 'Indicates if the UI or its dependencies have changed' | ||
value: ${{ jobs.dry-run.outputs.ui_changed }} | ||
|
||
jobs: | ||
dry-run: | ||
runs-on: ubuntu-latest | ||
env: | ||
# TODO why is this named so? why isn't it just GIT_HASH? | ||
TURBO_REF_FILTER: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }} | ||
outputs: | ||
changed_packages: ${{ steps.output-changed-packages.outputs.changed_packages }} | ||
admin_changed: ${{ steps.admin-changed.outputs.result }} | ||
ui_changed: ${{ steps.ui-changed.outputs.result }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Changeset | ||
id: changeset | ||
run: | | ||
echo 'Generating a changeset for ' $TURBO_REF_FILTER | ||
echo 'result<<CHANGESET_DELIMITER' >> $GITHUB_OUTPUT | ||
# TODO why is there a global-deps flag? removing it didn't fix the issue | ||
# FIXME this part is probably broken (the next step fails on CI) | ||
echo "$(npx -y turbo build --dry-run=json --filter=...[$TURBO_REF_FILTER] --global-deps=.github/*)" >> $GITHUB_OUTPUT | ||
echo 'CHANGESET_DELIMITER' >> $GITHUB_OUTPUT | ||
- name: Output changed packages | ||
id: output-changed-packages | ||
run: | | ||
echo 'Saving the changeset for ' $TURBO_REF_FILTER | ||
echo 'changed_packages<<CHANGED_PACKAGES_DELIMITER' >> $GITHUB_OUTPUT | ||
echo "${{ toJSON(fromJSON(steps.changeset.outputs.result).packages) }}" >> $GITHUB_OUTPUT | ||
echo 'CHANGED_PACKAGES_DELIMITER' >> $GITHUB_OUTPUT | ||
- name: Did the Admin UI or its dependencies change? | ||
id: admin-changed | ||
if: ${{ contains(fromJSON(steps.changeset.outputs.result).packages, 'admin-ui') }} | ||
run: echo "result=true" >> $GITHUB_OUTPUT | ||
|
||
- name: Did the UI or its dependencies change? | ||
id: ui-changed | ||
if: ${{ contains(fromJSON(steps.changeset.outputs.result).packages, 'ui') }} | ||
run: echo "result=true" >> $GITHUB_OUTPUT |
Oops, something went wrong.