diff --git a/.github/workflows/build-wasm.yml b/.github/workflows/build-wasm.yml new file mode 100644 index 0000000..ced7868 --- /dev/null +++ b/.github/workflows/build-wasm.yml @@ -0,0 +1,57 @@ +name: Build wasm + +on: [push, pull_request] + +jobs: + build: + name: Build for wasm + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + + - uses: dtolnay/rust-toolchain@stable + with: + toolchain: 1.74.1 + targets: wasm32-unknown-unknown + + - name: Rust Cache + uses: Swatinem/rust-cache@v2.7.0 + + - name: Download wasi-sdk + uses: suisei-cn/actions-download-file@v1.3.0 + with: + url: "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz" + + - name: Install dependencies + run: | + mkdir -p ${{ github.workspace }}/wasi-sdk/ && tar -xzvf wasi-sdk-20.0-linux.tar.gz --strip-components=1 -C ${{ github.workspace }}/wasi-sdk/ + cargo install trunk + + - name: Build + run: trunk build --release + env: + CC: "${{ github.workspace }}/wasi-sdk/bin/clang --sysroot=${{ github.workspace }}/wasi-sdk/share/wasi-sysroot" + working-directory: ${{ github.workspace }}/bff-gui/ + + - name: Upload Pages artifact + uses: actions/upload-pages-artifact@v3 + with: + path: ${{ github.workspace }}/bff-gui/dist/ + + deploy: + needs: build + + permissions: + pages: write + id-token: write + + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + + runs-on: ubuntu-latest + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 35fd25d..b87e118 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,18 +16,13 @@ jobs: bin_extension: .exe - name: macos os: macos-latest - - name: wasm - os: ubuntu-latest - target: wasm32-unknown-unknown steps: - uses: actions/checkout@v1 - uses: dtolnay/rust-toolchain@stable with: - profile: minimal toolchain: 1.74.1 - targets: ${{ matrix.target }} - name: Rust Cache uses: Swatinem/rust-cache@v2.7.0 @@ -36,25 +31,10 @@ jobs: run: sudo apt-get -y install libgtk-3-dev libasound2-dev if: matrix.name == 'linux' - - name: Download wasi-sdk (wasm) - uses: suisei-cn/actions-download-file@v1.3.0 - with: - url: "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-20/wasi-sdk-20.0-linux.tar.gz" - if: matrix.name == 'wasm' - - - name: Install dependencies (wasm) - run: | - mkdir -p ${{ github.workspace }}/wasi-sdk/ && tar -xzvf wasi-sdk-20.0-linux.tar.gz --strip-components=1 -C ${{ github.workspace }}/wasi-sdk/ - cargo install trunk - if: matrix.name == 'wasm' - - name: Build - run: cmake -E env CARGO_PROFILE_RELEASE_LTO=true cargo build --release --locked --bins - if: matrix.name != 'wasm' - - - name: Build (wasm) - run: /usr/bin/env -C bff-gui CC="${{ github.workspace }}/wasi-sdk/bin/clang --sysroot=${{ github.workspace }}/wasi-sdk/share/wasi-sysroot" trunk build --release - if: matrix.name == 'wasm' + run: cargo build --release --locked --bins + env: + CARGO_PROFILE_RELEASE_LTO: "true" - name: Archive Artifacts uses: actions/upload-artifact@v3 diff --git a/.gitignore b/.gitignore index fe35f7e..2ac183b 100644 --- a/.gitignore +++ b/.gitignore @@ -18,8 +18,8 @@ # data /data/ -/bff-gui/dist -/bff-gui/node_modules +# bff-gui +/bff-gui/dist/ # cargo flamegraph /flamegraph.svg