Skip to content

Commit

Permalink
feat: start landing page
Browse files Browse the repository at this point in the history
Closes #35

fix: switch to scss

feat: finish up layout

chore: switch to mask + small other fixes

Switched to mask as our task runner from Just.
Mask seems to provide a much nicer cli than just and also is much easier
to write than the just files, since its markdown. Ideally they should
add support for submoudles and some things to help with code
duplication. Like global variables, global scripts, cascading flags,
catch all extra arguments, ect... However these are not big enough
issues for us to not use it since just/make is very unmaintainable and very
messy when we have a lot of tasks.

I made an issue on their repo for the submodule idea.
jacobdeichert/mask#96

Some small fixes:
- .gitignores on mac
- prettier not formatting all files

feat: start landing page

Closes #35

fix: switch to scss

fix: remove unused file

feat: fix magic text positioning

chore: format

fix: capitalization

chore: add code coverage

Add code coverage with Codecov.

closes #50

feat: add blurred circles to background

chore: format

fix: remove unused <script>

fix: text selection on top of blurred circles

feat: added blurred-circle animation

feat(api): initial api implementation + glibc

Upon testing the API we noticed that when the app is compiled with musl
the API would perform roughly 80% worse than the glibc counter part.
We will have to do real benchmarks to see where this performance drop
off is coming from and likely have to ticket it to the musl / rust /
tokio devs.

ci: add docker ci builds

Adding docker builds to CI so that we can have regularly updated docker
images pushed to GHCR.

closes #46
  • Loading branch information
mmattbtw authored and TroyKomodo committed Feb 24, 2023
1 parent f21a818 commit d9f1323
Show file tree
Hide file tree
Showing 52 changed files with 2,611 additions and 312 deletions.
2 changes: 0 additions & 2 deletions .cargo/config.toml

This file was deleted.

4 changes: 4 additions & 0 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ on:
jobs:
security-audit:
runs-on: ubuntu-latest
permissions:
issues: write
checks: write

steps:
- uses: actions/checkout@v3

Expand Down
263 changes: 198 additions & 65 deletions .github/workflows/lint-test-build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Lint, Test & Build

on:
workflow_dispatch:
pull_request:
branches:
- main
Expand All @@ -15,10 +16,10 @@ concurrency:
cancel-in-progress: true

jobs:
lint-test-rust:
name: Run Lint + Test Rust
lint-test:
name: Run Lint + Test
runs-on: ubuntu-latest
container: ghcr.io/scuffletv/build:1.67.1
container: ghcr.io/scuffletv/build:425e9d58cd6fab8e3d202681188c54b55c9e71f1
services:
postgres:
image: postgres:15.2
Expand Down Expand Up @@ -51,87 +52,47 @@ jobs:
/usr/local/cargo/registry/index/
/usr/local/cargo/registry/cache/
/usr/local/cargo/git/db/
key: musl-rust-registry-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml') }}
key: gnu-rust-registry-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml') }}
restore-keys: |
musl-rust-registry-
gnu-rust-registry-
- name: Set up cargo target cache
uses: actions/cache@v3
continue-on-error: false
with:
path: |
target/
key: musl-rust-target-lint-test-rust-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml') }}
key: gnu-rust-target-lint-test-rust-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml') }}
restore-keys: |
musl-rust-target-lint-test-rust-
- name: Install sqlx-cli
run: |
curl -L https://github.com/ScuffleTV/ci-binaries/releases/download/sqlx-cli/sqlx-cli.tar.gz | tar -xz -C $CARGO_HOME/bin
gnu-rust-target-lint-test-rust-
- name: Install dependencies
run: just setup-deps
run: mask bootstrap --no-db --no-docker --no-env --no-stack --no-rust

- name: Run migrations
run: just db-migrate
run: mask db migrate

- name: Run Lint
run: just lint
run: mask lint

- name: Run Test Rust
run: just test-rust

test-js:
name: Run Tests JavaScript
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
run: mask test --no-js

- name: Setup Node
uses: actions/setup-node@v3
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
cache: "yarn"
node-version: 18

- name: Setup Rust Wasm
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: wasm32-unknown-unknown
override: true

- name: Set up cargo cache
uses: actions/cache@v3
continue-on-error: false
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: gnu-rust-test-js-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml') }}
restore-keys: |
gnu-rust-test-js-
- uses: taiki-e/install-action@just

- name: Install dependencies
run: just setup-deps

- name: Setup tests
run: just setup-tests
token: ${{ secrets.CODECOV_TOKEN }}
files: lcov.info
fail_ci_if_error: true

- name: Run Test JavaScript
run: just test-js
run: mask test --no-rust

build:
name: Run Build
runs-on: ubuntu-latest
container: ghcr.io/scuffletv/build:1.67.1
needs: [lint-test-rust, test-js]
container: ghcr.io/scuffletv/build:425e9d58cd6fab8e3d202681188c54b55c9e71f1
needs: [lint-test]

steps:
- uses: actions/checkout@v3
Expand All @@ -152,22 +113,194 @@ jobs:
/usr/local/cargo/registry/index/
/usr/local/cargo/registry/cache/
/usr/local/cargo/git/db/
key: musl-rust-registry-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml') }}
key: gnu-rust-registry-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml') }}
restore-keys: |
musl-rust-registry-
gnu-rust-registry-
- name: Set up cargo target cache
uses: actions/cache@v3
continue-on-error: false
with:
path: |
target/
key: musl-rust-target-build-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml') }}
key: gnu-rust-target-build-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml') }}
restore-keys: |
musl-rust-target-build-
gnu-rust-target-build-
- name: Install dependencies
run: just setup-deps
run: mask bootstrap --no-db --no-docker --no-env --no-js-tests --no-stack --no-rust

- name: Run Build
run: just build
run: mask build

- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: build
path: |
target/x86_64-unknown-linux-gnu/release/api
target/x86_64-unknown-linux-gnu/release/edge
target/x86_64-unknown-linux-gnu/release/ingest
target/x86_64-unknown-linux-gnu/release/edge
target/x86_64-unknown-linux-gnu/release/transcoder
frontend/website/build
docker:
name: Build docker images
runs-on: ubuntu-latest
needs: [build]
permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Download build artifacts
uses: actions/download-artifact@v3
with:
name: build

- name: Set up Docker Buildx
uses: docker/[email protected]

- name: Login to GitHub Container Registry
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push API image
id: docker_build_api
uses: docker/[email protected]
with:
context: .
file: ./docker/api.Dockerfile
load: true
tags: ghcr.io/scuffletv/api:${{ github.sha }}

- name: Build and push Edge image
id: docker_build_edge
uses: docker/[email protected]
with:
context: .
file: ./docker/edge.Dockerfile
load: true
tags: ghcr.io/scuffletv/edge:${{ github.sha }}

- name: Build and push Ingest image
id: docker_build_ingest
uses: docker/[email protected]
with:
context: .
file: ./docker/ingest.Dockerfile
load: true
tags: ghcr.io/scuffletv/ingest:${{ github.sha }}

- name: Build and push Transcoder image
id: docker_build_transcoder
uses: docker/[email protected]
with:
context: .
file: ./docker/transcoder.Dockerfile
load: true
tags: ghcr.io/scuffletv/transcoder:${{ github.sha }}

- name: Build and push Website image
id: docker_build_website
uses: docker/[email protected]
with:
context: .
file: ./docker/website.Dockerfile
load: true
tags: ghcr.io/scuffletv/website:${{ github.sha }}

- name: Scan API image
uses: aquasecurity/trivy-action@master
if: ${{ always() && steps.docker_build_api.outcome == 'success' }}
with:
image-ref: ghcr.io/scuffletv/api:${{ github.sha }}
format: "table"
exit-code: "1"
ignore-unfixed: true
vuln-type: "os,library"
severity: "CRITICAL,HIGH"

- name: Scan Edge image
uses: aquasecurity/trivy-action@master
if: ${{ always() && steps.docker_build_edge.outcome == 'success' }}
with:
image-ref: ghcr.io/scuffletv/edge:${{ github.sha }}
format: "table"
exit-code: "1"
ignore-unfixed: true
vuln-type: "os,library"
severity: "CRITICAL,HIGH"

- name: Scan Ingest image
uses: aquasecurity/trivy-action@master
if: ${{ always() && steps.docker_build_ingest.outcome == 'success' }}
with:
image-ref: ghcr.io/scuffletv/ingest:${{ github.sha }}
format: "table"
exit-code: "1"
ignore-unfixed: true
vuln-type: "os,library"
severity: "CRITICAL,HIGH"

- name: Scan Transcoder image
uses: aquasecurity/trivy-action@master
if: ${{ always() && steps.docker_build_transcoder.outcome == 'success' }}
with:
image-ref: ghcr.io/scuffletv/transcoder:${{ github.sha }}
format: "table"
exit-code: "1"
ignore-unfixed: true
vuln-type: "os,library"
severity: "CRITICAL,HIGH"

- name: Scan Website image
uses: aquasecurity/trivy-action@master
if: ${{ always() && steps.docker_build_website.outcome == 'success' }}
with:
image-ref: ghcr.io/scuffletv/website:${{ github.sha }}
format: "table"
exit-code: "1"
ignore-unfixed: true
vuln-type: "os,library"
severity: "CRITICAL,HIGH"

- name: Tag images and push
if: ${{ (github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/feature/'))) || github.event_name == 'workflow_dispatch' }}
# If the push is to the main branch, tag the image as latest
# If the workflow is triggered by a workflow_dispatch event, tag the image as workflow_dispatch
# Otherwise, tag the image with the branch name, in the format of feature-branch-name
env:
TAG: ${{ github.ref == 'refs/heads/main' && 'latest' || github.event_name == 'workflow_dispatch' && 'workflow_dispatch' || github.ref_name }}
run: |
# We need to replace the / in the branch name with a - so that it can be used as a tag
TAG="${TAG//\//-}"
docker tag ghcr.io/scuffletv/api:${{ github.sha }} ghcr.io/scuffletv/api:$TAG
docker tag ghcr.io/scuffletv/edge:${{ github.sha }} ghcr.io/scuffletv/edge:$TAG
docker tag ghcr.io/scuffletv/ingest:${{ github.sha }} ghcr.io/scuffletv/ingest:$TAG
docker tag ghcr.io/scuffletv/transcoder:${{ github.sha }} ghcr.io/scuffletv/transcoder:$TAG
docker tag ghcr.io/scuffletv/website:${{ github.sha }} ghcr.io/scuffletv/website:$TAG
docker push ghcr.io/scuffletv/api:${{ github.sha }}
docker push ghcr.io/scuffletv/api:$TAG
docker push ghcr.io/scuffletv/edge:${{ github.sha }}
docker push ghcr.io/scuffletv/edge:$TAG
docker push ghcr.io/scuffletv/ingest:${{ github.sha }}
docker push ghcr.io/scuffletv/ingest:$TAG
docker push ghcr.io/scuffletv/transcoder:${{ github.sha }}
docker push ghcr.io/scuffletv/transcoder:$TAG
docker push ghcr.io/scuffletv/website:${{ github.sha }}
docker push ghcr.io/scuffletv/website:$TAG
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@ target/
!.vscode/extensions.json
node_modules/
.env*
dev-stack/stack.docker-compose.yaml
dev-stack/docker-compose.yml
*.log
.DS_Store
*.lcov
lcov.info
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

just lint
mask lint
3 changes: 2 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"prisma.prisma",
"swellaby.rust-pack",
"svelte.svelte-vscode",
"zxh404.vscode-proto3"
"zxh404.vscode-proto3",
"ryanluker.vscode-coverage-gutters"
]
}
Loading

0 comments on commit d9f1323

Please sign in to comment.