Skip to content

Commit

Permalink
Build assets and server in CI (#73)
Browse files Browse the repository at this point in the history
* add build workflows

* add cargo target directly

* add artifacts

* fix typo

* add rust-cache to other workflows

* parallelize docs and client build
  • Loading branch information
Pistonight authored Sep 30, 2023
1 parent 0e4b2aa commit 6a187c6
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 2 deletions.
88 changes: 88 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
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@v1
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-node@v3
with:
node-version: 18.x
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- uses: baptiste0928/cargo-install@v2
with:
crate: regen-lang
- uses: baptiste0928/cargo-install@v2
with:
crate: wasm-pack
- run: task themes:ci client:ci --output group
- run: task build:client --output group
- uses: actions/upload-artifact@v3
with:
path: web-client/dist
name: app-${{ github.sha }}

build-docs:
name: Build Docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: arduino/setup-task@v1
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-node@v3
with:
node-version: 18.x
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- uses: baptiste0928/cargo-install@v2
with:
crate: txtpp
features: cli
- run: task docs:ci
- run: task docs:build
- uses: actions/upload-artifact@v3
with:
path: docs/src/.vitepress/dist
name: docs-${{ github.sha }}

build-server:
name: Build Server
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: arduino/setup-task@v1
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
- uses: baptiste0928/cargo-install@v2
with:
crate: regen-lang
- run: task core:grammar
- run: cargo build --bin celerserver --release --target x86_64-unknown-linux-musl
- uses: actions/upload-artifact@v3
with:
path: target/x86_64-unknown-linux-musl/release/celerserver
name: celerserver-${{ github.sha }}

1 change: 1 addition & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ jobs:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- uses: baptiste0928/cargo-install@v2
with:
crate: regen-lang
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
with:
node-version: 18.x
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- uses: baptiste0928/cargo-install@v2
with:
crate: regen-lang
Expand All @@ -41,6 +42,7 @@ jobs:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- uses: baptiste0928/cargo-install@v2
with:
crate: regen-lang
Expand Down
4 changes: 2 additions & 2 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,10 @@ tasks:
deps:
- core:grammar
cmds:
- cargo run --bin buildwasm --release > ../.task/build_wasm.out.log 2> ../.task/build_wasm.err.log
- cargo run --bin buildwasm --release

build:types:
dir: ./compiler-types
cmds:
- cargo run --bin buildtypes --release > ../.task/build_types.out.log 2> ../.task/build_types.err.log
- cargo run --bin buildtypes --release

0 comments on commit 6a187c6

Please sign in to comment.