Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve CI/CD with check fmt and clippy #74

Open
petrvecera opened this issue Mar 1, 2024 · 10 comments · May be fixed by #168
Open

Improve CI/CD with check fmt and clippy #74

petrvecera opened this issue Mar 1, 2024 · 10 comments · May be fixed by #168
Assignees
Labels
hacktoberfest rust BE - Rust code stuff

Comments

@petrvecera
Copy link
Member

I'd recommend adding check, fmt, and clippy here as well for some general linting of the Rust code. There's an example of the setup here: https://github.com/ryantaylor/vault/blob/master/.github/workflows/checks.yml

@petrvecera petrvecera added the rust BE - Rust code stuff label Mar 1, 2024
@HeyZoos
Copy link
Contributor

HeyZoos commented Oct 2, 2024

Lol I completely forgot about the Hacktoberfest thing, this tag has inspired me to register for it 😂 - mind if I tackle this one next?

@petrvecera
Copy link
Member Author

petrvecera commented Oct 3, 2024

Sure! :) Ideally we would add this before the build https://github.com/cohstats/coh3-stats-desktop-app/blob/master/.github/workflows/tests.yaml#L84 because the build will fail in forks due to missing dependencies.

@petrvecera
Copy link
Member Author

Btw @HeyZoos I am not sure if you are familiar with Rust - I have personally done only stuff with Copilot in it :D
But in our CI/CD tests when we run the tests, I don't understand why it Compiles all the dependencies again when it compiled them already before in the build step :/

https://github.com/cohstats/coh3-stats-desktop-app/actions/runs/11159161292/job/31016994798

Also I am not sure about this error:

Updating git repository `[https://github.com/tauri-apps/plugins-workspace`](https://github.com/tauri-apps/plugins-workspace%60)
error: invalid character `{` in package name: `tauri-plugin-{{name}}`, characters must be Unicode XID characters (numbers, `-`, `_`, or most letters)
 --> C:\Users\runneradmin\.cargo\git\checkouts\plugins-workspace-fd0259fcb18f51ad\cea1d4f\shared\template\Cargo.toml:2:8
  |
2 | name = "tauri-plugin-{{name}}"
  |        ^^^^^^^^^^^^^^^^^^^^^^^
  |

This is just bonus stuff in case you would know how it can be fixed. Thanks a lot for looking into this 🙏

@HeyZoos
Copy link
Contributor

HeyZoos commented Oct 8, 2024

No worries, I'm not sure I understand the behavior either. I've gotten a bit busy with work but just wanted to let you know I'm still looking into this. 👍

@HeyZoos
Copy link
Contributor

HeyZoos commented Oct 24, 2024

Hey so unfortunately it seems like the checks need to happen after the build.

   Compiling coh3-stats-desktop-app v1.5.3 (D:\a\coh3-stats-desktop-app\coh3-stats-desktop-app\src-tauri)
error: proc macro panicked
  --> src/main.rs:76:14
   |
76 |         .run(tauri::generate_context!())
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: message: The `distDir` configuration is set to `"../dist"` but this path doesn't exist

error: could not compile `coh3-stats-desktop-app` (bin "coh3-stats-desktop-app") due to 1 previous error
Error: Process completed with exit code 1.

This distDir issue indicates that in order to compile the Rust backend it's expecting the output of the frontend build to exist.

@HeyZoos
Copy link
Contributor

HeyZoos commented Oct 24, 2024

How do you feel about removing the updater configuration from the tests.yaml workflow?

In the publish.yaml you bring it back when doing a full release when pushing a tag:

name: "publish"
on:
  push:
    tags:
      - "*"
            - name: "Full Bundle Tauri Release"
              run: |
                rm ./src-tauri/tauri.conf.json
                mv ./src-tauri/full-bundle-tauri.conf.json ./src-tauri/tauri.conf.json

            - name: "Build and release the app"
              uses: tauri-apps/tauri-action@v0
              env:
                GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
                TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
                TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
              with:
                tagName: __VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version
                releaseName: "__VERSION__"
                releaseBody: "See the assets to download this version and install."
                releaseDraft: true
                prerelease: false
                includeUpdaterJson: false

@HeyZoos HeyZoos linked a pull request Oct 24, 2024 that will close this issue
@HeyZoos
Copy link
Contributor

HeyZoos commented Oct 24, 2024

For the name = "tauri-plugin-{{name}}" issue I wonder if it's because most of the tauri-plugin-* dependencies are on the dev branch and not against the published libraries. It looks like most of these crates have 2.0.0 versions so this might be fixed when you migrate to Tauri 2

@HeyZoos
Copy link
Contributor

HeyZoos commented Oct 24, 2024

Actually, it's transitively pulling in a template folder through one of the dependencies, this might be easy to fix

C:\Users\jesse\.cargo\git\checkouts\plugins-workspace-fd0259fcb18f51ad\cea1d4f\shared\template\Cargo.toml

@HeyZoos
Copy link
Contributor

HeyZoos commented Oct 24, 2024

Yeah setting all the tauri-plugin-* dependencies to v1 seems to have done the trick

d0c6f12

@HeyZoos
Copy link
Contributor

HeyZoos commented Oct 24, 2024

But in our CI/CD tests when we run the tests, I don't understand why it Compiles all the dependencies again when it compiled them already before in the build step :/

For this, I've noticed the builds are mixing the compilation modes, I wonder if that's causing cache misses. For example, these are all logs from the same build

2024-10-24T01:07:33.0986767Z �[1m�[32m   Compiling�[0m tauri-plugin-log v0.1.0 (https://github.com/tauri-apps/plugins-workspace?branch=dev#cea1d4f7)
2024-10-24T01:08:34.9747359Z �[1m�[32m    Finished�[0m `release` profile [optimized] target(s) in 3m 52s
2024-10-24T01:10:40.2872755Z �[1m�[32m   Compiling�[0m coh3-stats-desktop-app v1.5.3 (D:\a\coh3-stats-desktop-app\coh3-stats-desktop-app\src-tauri)
2024-10-24T01:10:43.2838308Z �[1m�[32m    Finished�[0m `dev` profile [unoptimized + debuginfo] target(s) in 1m 51s
2024-10-24T01:10:46.0688728Z �[1m�[32m   Compiling�[0m coh3-stats-desktop-app v1.5.3 (D:\a\coh3-stats-desktop-app\coh3-stats-desktop-app\src-tauri)
2024-10-24T01:10:49.3633437Z �[1m�[32m    Finished�[0m `dev` profile [unoptimized + debuginfo] target(s) in 3.88s
2024-10-24T01:13:13.9291127Z �[1m�[32m   Compiling�[0m rev_lines v0.3.0
2024-10-24T01:13:19.2614107Z �[1m�[32m    Finished�[0m `test` profile [unoptimized + debuginfo] target(s) in 2m 29s
2024-10-24T01:13:19.2961716Z �[1m�[32m     Running�[0m unittests src\lib.rs (target\debug\deps\coh3_stats_desktop_app-718d9e165d5639b4.exe)
2024-10-24T01:13:53.9517150Z �[1m�[32m    Finished�[0m `release` profile [optimized] target(s) in 34.20s
2024-10-24T01:13:53.9737040Z �[1m�[32m  Installing�[0m C:\Users\runneradmin/.cargo\bin\tauri-driver.exe
2024-10-24T01:13:53.9744019Z �[1m�[32m   Installed�[0m package `tauri-driver v2.0.1` (executable `tauri-driver.exe`)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest rust BE - Rust code stuff
Projects
None yet
2 participants