Skip to content

Commit

Permalink
Deno port (#77)
Browse files Browse the repository at this point in the history
* Switch Ts/Js engine to Deno

* Add deno backend
* Remove Tests
* Add client
* Add cli for server
* Add  VSCode config and task
* Port backend to deno/oak
* Add import file to map imports
* Switch docker base to deno
* Add linting to project
* Add better input validation with zod
* Fix webpush not working with Safari push service (add mailto: to sub inside vapid token)
* Remove cloudflare files (wrangler, cloudflare docs, env)
* Remove helper scripts and add them in main cli

* Update 2

* Add vscode tasks as well as launch profiles (WIP)
* Refactor server into mod
* Update references to server

* Fix Launch options, Add Launch option for frontend and backend Update frontend deps

* Fix cors

* Fix cors to debug local instance
* Format config json

* Add tasks

* Add build task
* Update makefile to write a deploy dir

* Update workflows

* Format workflows
* Add new Deploy to branch so deno deploy can be called with the branch without the need to compile the code yourself
* Update docker file to use deploy file

* Update dependabot.yml

* Fix error

* Add preload to compiled frontend

* Update deploy-deno-deploy-files.yml

* Update Makefile

* Update deploy-demo.yml

* Update deploy-demo.yml

* Update deploy-demo.yml

* Update deploy-deno-deploy-files.yml

* Move permissions to correct file

* Update deploy-demo.yml

* Update deploy.ts

* Update staticsettings.js

* Update staticsettings.js

* Update package.json

* Update preact.config.js

* Add push secret validation

* Rename workflows, delete todo

* Update dockerfile

* Add type parser

* Remove debug push triggers

* Update lint-backend.yml

* Add example

* Update auth.ts

* Update docker-compose.yml

* Update documentation

* Update install.md

* Delete docker-compose.yml

* Update documentation

* Add default env vars

* Add documentation

* Update readme.md

* Update docs for release

* Add ios warning banner

* Update readme.md

* Update app.tsx

* Update baremetal.md

* Add deployment on tag push

* Add note of precompiled fiels

* Update readme.md

* Update readme.md
  • Loading branch information
K0IN authored Jul 31, 2023
1 parent da3448f commit 2b2e2db
Show file tree
Hide file tree
Showing 133 changed files with 37,437 additions and 58,644 deletions.
21 changes: 0 additions & 21 deletions .devcontainer/Dockerfile

This file was deleted.

27 changes: 0 additions & 27 deletions .devcontainer/devcontainer.json

This file was deleted.

7 changes: 6 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,9 @@ build
size-plugin.json
coverage
images/
*.deb
*.deb
*.exe
.vscode
.github
doc/
*.md
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
version: 2
updates:
- package-ecosystem: "npm" # See documentation for possible values
directory: "/" # Location of package manifests
directory: "app/frontend/" # Location of package manifests
schedule:
interval: "weekly"
42 changes: 19 additions & 23 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ name: "CodeQL"

on:
push:
branches: [ main ]
branches: [main]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
branches: [main]
schedule:
- cron: '39 12 * * 6'
- cron: "39 12 * * 6"

jobs:
analyze:
Expand All @@ -21,26 +21,22 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
language: ["javascript"]

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

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
queries: +security-extended # ,+security-and-quality
config-file: ./.github/codeql/codeql-config.yml

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
queries: +security-extended # ,+security-and-quality
config-file: ./.github/codeql/codeql-config.yml

- name: Autobuild
uses: github/codeql-action/autobuild@v2
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# - name: build
# working-directory: ./app
# run: npm i && npm run build_all

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
55 changes: 35 additions & 20 deletions .github/workflows/deploy-demo.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,39 @@
name: Build and publish demo to Cloudflare
name: Deploy to Demo

on:
push:
branches:
- 'main'
push:
tags:
- "v*.*.*"

jobs:
build-and-deploy-worker:
environment: deploy
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./app/
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Deploy app to cloudflare
uses: cloudflare/wrangler-action@1.3.0
with:
apiToken: ${{ secrets.CF_TOKEN }}
environment: 'demo'
workingDirectory: 'app'
deploy:
name: Deploy
runs-on: ubuntu-latest
permissions:
id-token: write # Needed for auth with Deno Deploy
contents: read # Needed to clone the repository

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

- uses: denoland/setup-deno@v1
with:
deno-version: vx.x.x

- uses: actions/setup-node@v3
with:
node-version: 18

- name: Install make
run: sudo apt update && sudo apt install make -y

- name: build deploy folder
run: make deploy

- name: Upload to Deno Deploy
uses: denoland/deployctl@v1
with:
project: "notify-demo"
entrypoint: "deploy.ts"
root: "deploy"
37 changes: 37 additions & 0 deletions .github/workflows/deploy-deno-deploy-files.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: push build to deploy branch

on:
push:
tags:
- "v*.*.*"

jobs:
build:
runs-on: ubuntu-latest
name: Build and Push
steps:
- name: git-checkout
uses: actions/checkout@v3

- uses: denoland/setup-deno@v1
with:
deno-version: vx.x.x

- uses: actions/setup-node@v3
with:
node-version: 18

- name: Install make
run: sudo apt update && sudo apt install make -y

- name: build deploy folder
run: make deploy

- name: Push
uses: s0/git-publish-subdir-action@develop
env:
REPO: self
BRANCH: deno-deploy-data
FOLDER: deploy
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MESSAGE: "Build: ({sha}) {msg}"
103 changes: 50 additions & 53 deletions .github/workflows/deploy-image.yml
Original file line number Diff line number Diff line change
@@ -1,60 +1,57 @@
name: Build and publish a Docker image
name: publish a docker image

on:
push:
branches:
- '*'
push:
tags:
- "v*.*.*"

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push-image:
name: Build ${{ matrix.platform }} docker image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

strategy:
matrix:
platform: [linux/amd64, linux/arm/v6, linux/arm/v7, linux/arm64/v8]

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

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

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
build-and-push-image:
name: Build ${{ matrix.platform }} docker image
runs-on: ubuntu-latest

strategy:
matrix:
platform: [linux/amd64, linux/arm64/v8] # linux/arm/v6, linux/arm/v7,

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

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=latest
type=raw,value={{branch}}-{{sha}}
type=raw,value={{branch}}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
builder: ${{ steps.buildx.outputs.name }}
platforms: ${{ matrix.platform }}
context: .
push: ${{ github.ref == 'refs/heads/main' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

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

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

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

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

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=latest
type=raw,value={{branch}}-{{sha}}
type=raw,value={{branch}}
type=semver,pattern={{raw}}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
builder: ${{ steps.buildx.outputs.name }}
platforms: ${{ matrix.platform }}
context: .
push: ${{ github.ref == 'refs/heads/main' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
24 changes: 24 additions & 0 deletions .github/workflows/lint-backend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Run linter on backend

on:
push:
branches:
- "*"
schedule:
- cron: "39 12 * * 6"

jobs:
run-linter:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- uses: denoland/setup-deno@v1
with:
deno-version: vx.x.x

- name: Run linter
run: |
cd app/backend
deno lint
Loading

0 comments on commit 2b2e2db

Please sign in to comment.