-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add taskfile * build workflow * fix build command * setup docker workflow
- Loading branch information
1 parent
4de70c2
commit c192e54
Showing
29 changed files
with
6,295 additions
and
5,996 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,53 @@ | ||
name: Build | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build-client: | ||
name: Build Client | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: arduino/setup-task@v2 | ||
with: | ||
version: 3.x | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18.x | ||
- uses: Swatinem/rust-cache@v2 | ||
- run: npm ci | ||
- run: task client:build --output group | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
path: target/frontend | ||
name: app | ||
retention-days: 3 | ||
|
||
build-server: | ||
name: Build Server | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: arduino/setup-task@v2 | ||
with: | ||
version: 3.x | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
- uses: awalsh128/cache-apt-pkgs-action@latest | ||
with: | ||
packages: musl-tools | ||
- uses: dtolnay/rust-toolchain@stable | ||
with: | ||
targets: x86_64-unknown-linux-musl | ||
- uses: Swatinem/rust-cache@v2 | ||
- run: cargo build --bin start --release --target x86_64-unknown-linux-musl | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
path: target/x86_64-unknown-linux-musl/release/start | ||
name: bin | ||
retention-days: 3 |
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,48 @@ | ||
name: Docker | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: "Version tag of the image (e.g. 0.2.0-beta)" | ||
required: true | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
jobs: | ||
build-docker: | ||
name: Publish Docker Image | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: dawidd6/action-download-artifact@v2 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
workflow: build.yml | ||
commit: ${{ github.sha }} | ||
path: docker/dist | ||
- uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- uses: docker/setup-buildx-action@v3 | ||
- uses: docker/metadata-action@v5 | ||
id: meta | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
tags: | | ||
type=sha | ||
type=sha,format=long | ||
type=raw,value=${{ github.event.inputs.version }} | ||
type=raw,value=latest | ||
- uses: docker/build-push-action@v5 | ||
with: | ||
push: true | ||
context: docker | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
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,39 @@ | ||
name: Lint | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
lint-typescript: | ||
name: Lint Client | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
- uses: arduino/setup-task@v2 | ||
with: | ||
version: 3.x | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18.x | ||
- run: npm ci | ||
- run: task client:check | ||
|
||
lint-rust: | ||
name: Lint Server | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: arduino/setup-task@v2 | ||
with: | ||
version: 3.x | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
- uses: dtolnay/rust-toolchain@stable | ||
- uses: Swatinem/rust-cache@v2 | ||
- run: task server:check |
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,4 @@ | ||
module.exports = { | ||
tabWidth: 4, | ||
endOfLine: "auto", | ||
}; |
This file was deleted.
Oops, something went wrong.
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,70 @@ | ||
version: '3' | ||
|
||
tasks: | ||
install: | ||
desc: Install tools and dependencies | ||
cmds: | ||
- rustup update | ||
- cargo install cargo-watch | ||
- npm i | ||
|
||
client:dev: | ||
desc: Run client in watch mode | ||
cmds: | ||
- npx vite -- --host | ||
|
||
client:build: | ||
desc: Build client | ||
cmds: | ||
- npx tsc | ||
- npx vite build | ||
|
||
client:check: | ||
desc: Check for lint and format errors | ||
cmds: | ||
# - task: client:eslint | ||
# vars: | ||
# ESLINT_ARGS: "" | ||
- task: client:prettier | ||
vars: | ||
PRETTIER_ARGS: --check | ||
|
||
client:fix: | ||
desc: Fix lint and format errors | ||
cmds: | ||
- task: client:prettier | ||
vars: | ||
PRETTIER_ARGS: --write | ||
# - task: client:eslint | ||
# vars: | ||
# ESLINT_ARGS: --fix | ||
|
||
client:prettier: | ||
cmds: | ||
- npx prettier "./**/*.{ts,tsx,json,js,jsx,cjs,css}" {{.PRETTIER_ARGS}} | ||
|
||
client:eslint: | ||
cmds: | ||
- npx eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 0 --cache {{.ESLINT_ARGS}} | ||
|
||
server:dev: | ||
desc: Run server in watch mode | ||
cmds: | ||
- cargo watch -x run | ||
|
||
server:build: | ||
desc: Build server | ||
cmds: | ||
- cargo build --release | ||
|
||
server:check: | ||
desc: Check for lint and format errors | ||
cmds: | ||
- cargo clippy -- -D warnings -D clippy::todo | ||
- cargo fmt --check | ||
|
||
server:fix: | ||
desc: Fix lint and format errors | ||
cmds: | ||
- cargo fmt --all | ||
|
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,10 @@ | ||
FROM alpine:latest | ||
EXPOSE 80 | ||
ENV APP_DIR=/opt/app | ||
COPY ./dist $APP_DIR | ||
COPY ../img $APP_DIR/img | ||
RUN chmod +x $APP_DIR/bin/start | ||
|
||
WORKDIR $APP_DIR | ||
|
||
CMD ["./bin/start", "80", "dist/"] |
Oops, something went wrong.