From fb800a01a7c91dfcd02bb6fe4c723328d7a32796 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Freitas?= Date: Sat, 10 Aug 2024 16:37:46 +0100 Subject: [PATCH] Deploy github pages with project docs (#74) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add from clippy --fix * wasm deploy + docs --------- Co-authored-by: João Pinheiro --- .github/workflows/main.yml | 34 ++++++++++++++++++++++++++++++++-- bin/pre-commit | 5 +++-- fpt-egui/src/main.rs | 4 ++-- 3 files changed, 37 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7276027..6ef4a09 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,11 +16,41 @@ jobs: steps: - uses: actions/checkout@v4 - uses: Swatinem/rust-cache@v2 - - name: Version - run: rustc --version - name: Run rustfmt run: cargo fmt --check - name: Unit tests run: cargo test -- --include-ignored --nocapture - name: Clippy run: cargo clippy --all-features + + deploy: + needs: CI + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + permissions: + pages: write + id-token: write + concurrency: + group: "pages" + cancel-in-progress: false + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: Swatinem/rust-cache@v2 + - name: Trunk + run: | + rustup target add wasm32-unknown-unknown + cargo install trunk + trunk build --public-url 'https://pineman.github.io/fpt' --release fpt-egui/index.html + - name: Docs + run: | + cargo doc --no-deps + cp -r target/doc/* fpt-egui/dist + - uses: actions/upload-pages-artifact@v3 + with: + path: fpt-egui/dist + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/bin/pre-commit b/bin/pre-commit index 7a2548e..1285ebc 100755 --- a/bin/pre-commit +++ b/bin/pre-commit @@ -4,7 +4,8 @@ FILES=$(git diff --cached --name-only --diff-filter=ACMR | sed 's| |\\ |g') cargo fmt if CARGO_TERM_COLOR=always cargo clippy --all-features --fix --allow-dirty --allow-staged 2>&1 | tee >(grep -q "warning"); then - exit 0 + git add $FILES + exit 0 else - exit 1 + exit 1 fi diff --git a/fpt-egui/src/main.rs b/fpt-egui/src/main.rs index fcc79dc..4d1f24d 100644 --- a/fpt-egui/src/main.rs +++ b/fpt-egui/src/main.rs @@ -574,8 +574,8 @@ impl FPT { fn load_rom(&mut self, ui: &mut Ui) { if let Ok(text) = self.rom_channel.1.try_recv() { self.gb.load_rom(&text); - if let Some(BootromToFake::DMG0) = bootrom { - self..gb.boot_fake(); + if let Some(BootromToFake::DMG0) = self.bootrom { + self.gb.boot_fake(); } else { self.gb.boot_real(); }