diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 281cef61..2cc0e418 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -10,20 +10,37 @@ name: CI schedule: - cron: "0 0 * * TUE" jobs: - build: - name: Build + build-rust: + name: Build Rust runs-on: ubuntu-latest env: RUSTFLAGS: -D warnings RUST_BACKTRACE: 1 + CARGO_NET_GIT_FETCH_WITH_CLI: true steps: - name: Checkout repository uses: actions/checkout@v3 + - name: Set toolchain versions + run: | + echo "::set-output name=rust::$(cat rust-toolchain)" + echo "::set-output name=emscripten::$(cat emscripten-toolchain)" + id: toolchain_versions + - name: Install Rust toolchain - uses: actions-rs/toolchain@v1 - with: - profile: minimal + run: | + echo "::group::rustup toolchain install" + rustup toolchain install ${{ steps.toolchain_versions.outputs.rust }} --profile minimal + echo "::endgroup::" + echo "::group::rustup version" + rustup -Vv + echo "::endgroup::" + echo "::group::rustc version" + rustc -Vv + echo "::endgroup::" + echo "::group::cargo version" + cargo version --verbose + echo "::endgroup::" - uses: Swatinem/rust-cache@v1 @@ -36,12 +53,13 @@ jobs: - name: Test run: cargo test --workspace - rust: - name: Lint and format Rust + build-webapp: + name: Build Webapp runs-on: ubuntu-latest env: RUSTFLAGS: -D warnings RUST_BACKTRACE: 1 + CARGO_NET_GIT_FETCH_WITH_CLI: true steps: - name: Checkout repository uses: actions/checkout@v3 @@ -53,11 +71,19 @@ jobs: id: toolchain_versions - name: Install Rust toolchain - uses: actions-rs/toolchain@v1 - with: - profile: minimal - components: rustfmt, clippy - target: wasm32-unknown-emscripten + run: | + echo "::group::rustup toolchain install" + rustup toolchain install ${{ steps.toolchain_versions.outputs.rust }} --profile minimal --target wasm32-unknown-emscripten + echo "::endgroup::" + echo "::group::rustup version" + rustup -Vv + echo "::endgroup::" + echo "::group::rustc version" + rustc -Vv + echo "::endgroup::" + echo "::group::cargo version" + cargo version --verbose + echo "::endgroup::" - uses: Swatinem/rust-cache@v1 @@ -67,6 +93,58 @@ jobs: ruby-version: ".ruby-version" bundler-cache: true + - name: Install Emscripten toolchain + uses: mymindstorm/setup-emsdk@v11 + with: + version: ${{ steps.toolchain_versions.outputs.emscripten }} + no-cache: true + + - name: Verify emcc version + run: emcc -v + + - name: Install Nodejs toolchain + run: npm ci + + - name: Compile Wasm + run: ruby scripts/build-wasm.rb --release --verbose + + - name: Build Webapp + run: node build.mjs --release + + rust: + name: Lint and format Rust + runs-on: ubuntu-latest + env: + RUSTFLAGS: -D warnings + RUST_BACKTRACE: 1 + CARGO_NET_GIT_FETCH_WITH_CLI: true + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set toolchain versions + run: | + echo "::set-output name=rust::$(cat rust-toolchain)" + echo "::set-output name=emscripten::$(cat emscripten-toolchain)" + id: toolchain_versions + + - name: Install Rust toolchain + run: | + echo "::group::rustup toolchain install" + rustup toolchain install ${{ steps.toolchain_versions.outputs.rust }} --profile minimal --target wasm32-unknown-emscripten --component rustfmt clippy + echo "::endgroup::" + echo "::group::rustup version" + rustup -Vv + echo "::endgroup::" + echo "::group::rustc version" + rustc -Vv + echo "::endgroup::" + echo "::group::cargo version" + cargo version --verbose + echo "::endgroup::" + + - uses: Swatinem/rust-cache@v1 + - name: Install Emscripten toolchain uses: mymindstorm/setup-emsdk@v11 with: @@ -76,19 +154,13 @@ jobs: run: emcc -v - name: Check formatting - run: cargo fmt -- --check --color=auto + run: cargo fmt --check - name: Lint with Clippy - uses: actions-rs/clippy-check@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - args: --workspace --all-features --all-targets + run: cargo clippy --workspace --all-features --all-targets - name: Lint with Clippy on emscripten target - uses: actions-rs/clippy-check@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - args: --workspace --all-features --all-targets --target wasm32-unknown-emscripten + run: cargo clippy --workspace --all-features --all-targets --target wasm32-unknown-emscripten ruby: name: Lint and format Ruby diff --git a/.github/workflows/playground.yaml b/.github/workflows/publish.yaml similarity index 64% rename from .github/workflows/playground.yaml rename to .github/workflows/publish.yaml index a7f4b942..cdf61eff 100644 --- a/.github/workflows/playground.yaml +++ b/.github/workflows/publish.yaml @@ -1,23 +1,29 @@ --- -name: Playground +name: Publish "on": push: branches: - trunk - pull_request: - branches: - - trunk - schedule: - - cron: "0 0 * * TUE" + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + concurrency: - group: playground-${{ github.head_ref }} + group: "pages" + cancel-in-progress: true + jobs: + # Build job build: name: Build Playground runs-on: ubuntu-latest env: RUSTFLAGS: -D warnings RUST_BACKTRACE: 1 + CARGO_NET_GIT_FETCH_WITH_CLI: true steps: - name: Checkout repository @@ -30,11 +36,19 @@ jobs: id: toolchain_versions - name: Install Rust toolchain - uses: actions-rs/toolchain@v1 - with: - target: wasm32-unknown-emscripten - profile: minimal - override: true + run: | + echo "::group::rustup toolchain install" + rustup toolchain install ${{ steps.toolchain_versions.outputs.rust }} --profile minimal --target wasm32-unknown-emscripten + echo "::endgroup::" + echo "::group::rustup version" + rustup -Vv + echo "::endgroup::" + echo "::group::rustc version" + rustc -Vv + echo "::endgroup::" + echo "::group::cargo version" + cargo version --verbose + echo "::endgroup::" - uses: Swatinem/rust-cache@v1 @@ -44,18 +58,11 @@ jobs: ruby-version: ".ruby-version" bundler-cache: true - - name: Cache emsdk - uses: actions/cache@v3 - id: cache - with: - path: "emsdk-cache" - key: emscripten-emsdk-${{ runner.os }}-emsdk-${{ steps.toolchain_versions.outputs.emscripten }} - - name: Install Emscripten toolchain uses: mymindstorm/setup-emsdk@v11 with: version: ${{ steps.toolchain_versions.outputs.emscripten }} - actions-cache-folder: "emsdk-cache" + no-cache: true - name: Verify emcc version run: emcc -v @@ -69,9 +76,9 @@ jobs: - name: Build Webapp run: node build.mjs --release + # Publish step - name: Deploy Playground uses: peaceiris/actions-gh-pages@v3 - if: github.ref == 'refs/heads/trunk' with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./dist