From 1d985bd25442834148587dde2ed525770a1962ca Mon Sep 17 00:00:00 2001 From: Adhiraj Singh Chauhan Date: Thu, 4 Jan 2024 07:37:08 +0530 Subject: [PATCH 1/3] fix: auto-update, build_artifacts & release workflows were broken --- .github/workflows/build_artifacts.yml | 10 +++++----- .github/workflows/ci.yml | 16 ++++++++-------- .github/workflows/release.yml | 13 +++++++------ src/core/update.rs | 6 +++--- 4 files changed, 23 insertions(+), 22 deletions(-) diff --git a/.github/workflows/build_artifacts.yml b/.github/workflows/build_artifacts.yml index 203794c..6c9515e 100644 --- a/.github/workflows/build_artifacts.yml +++ b/.github/workflows/build_artifacts.yml @@ -51,15 +51,15 @@ jobs: run: mkdir -p bin - name: Renaming binaries [Windows] if: matrix.os == 'windows-latest' - run: mv target/release/uad_gui.exe bin/uad_gui-${{ matrix.build_target }}${{ matrix.renderer }}.exe + run: mv target/release/uad-ng.exe bin/uad-ng-${{ matrix.build_target }}${{ matrix.renderer }}.exe - name: Renaming binaries [Others] if: matrix.os != 'windows-latest' - run: mv target/release/uad_gui bin/uad_gui${{ matrix.update_name }}-${{ matrix.build_target }}${{ matrix.renderer }} + run: mv target/release/uad-ng bin/uad-ng${{ matrix.update_name }}-${{ matrix.build_target }}${{ matrix.renderer }} - name: Tarball Linux/MacOS binary if: matrix.os != 'windows-latest' - run: tar -czf bin/uad_gui${{ matrix.update_name }}-${{ matrix.build_target }}${{ matrix.renderer }}{.tar.gz,} + run: tar -czf bin/uad-ng${{ matrix.update_name }}-${{ matrix.build_target }}${{ matrix.renderer }}{.tar.gz,} - name: Upload artifacts uses: actions/upload-artifact@v3 with: - name: uad_gui${{ matrix.update_name }}-${{ matrix.build_target }}${{ matrix.renderer }} - path: bin/uad_gui-* + name: uad-ng${{ matrix.update_name }}-${{ matrix.build_target }}${{ matrix.renderer }} + path: bin/uad-ng-* diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cdec1aa..fead483 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,16 +2,16 @@ name: Continuous Integration on: push: paths: - - "**.rs" - - "Cargo.lock" - - "Cargo.toml" - - "**.json" + - Cargo.lock + - Cargo.toml + - resources/assets/*.ttf + - src/** pull_request: paths: - - "**.rs" - - "Cargo.lock" - - "Cargo.toml" - - "**.json" + - Cargo.lock + - Cargo.toml + - resources/assets/*.ttf + - src/** jobs: lint: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f65581e..2d5905b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,9 +5,10 @@ on: branches: - main paths: - - "**.rs" - - "Cargo.lock" - - "Cargo.toml" + - Cargo.lock + - Cargo.toml + - resources/assets/*.ttf + - src/** tags-ignore: - dev-build @@ -18,6 +19,7 @@ jobs: build: uses: ./.github/workflows/build_artifacts.yml release: + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') runs-on: ubuntu-latest needs: build permissions: @@ -29,11 +31,10 @@ jobs: with: path: bin - name: Create pre-release - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') uses: softprops/action-gh-release@v1 with: body_path: ${{ github.workspace }}/CHANGELOG.md - files: bin/*/uad_gui-* + files: bin/*/uad-ng-* prerelease: true # - name: Update dev-build tag # if: ${{ github.event_name == 'push' }} @@ -47,6 +48,6 @@ jobs: # uses: softprops/action-gh-release@v1 # with: # generate_release_notes: true - # files: bin/*/uad_gui-* + # files: bin/*/uad-ng-* # prerelease: true # tag_name: ${{ env.dev_tag }} diff --git a/src/core/update.rs b/src/core/update.rs index ad68b2a..0a33a03 100644 --- a/src/core/update.rs +++ b/src/core/update.rs @@ -229,17 +229,17 @@ pub fn extract_binary_from_tar(archive_path: &Path, temp_file: &Path) -> io::Res pub const fn bin_name() -> &'static str { #[cfg(target_os = "windows")] { - "uad_gui.exe" + "uad-ng.exe" } #[cfg(target_os = "macos")] { - "uad_gui-macos" + "uad-ng-macos" } #[cfg(not(any(target_os = "macos", target_os = "windows")))] { - "uad_gui-linux" + "uad-ng-linux" } } From a283202c9cf59cd286aeec2683acff1adfd3bf9d Mon Sep 17 00:00:00 2001 From: Adhiraj Singh Chauhan Date: Thu, 4 Jan 2024 07:39:12 +0530 Subject: [PATCH 2/3] fix: cache/log directory was mistakenly changed from uad -> uad-ng --- src/core/utils.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/utils.rs b/src/core/utils.rs index fab2794..5d94734 100644 --- a/src/core/utils.rs +++ b/src/core/utils.rs @@ -61,7 +61,7 @@ pub fn string_to_theme(theme: &str) -> Theme { } pub fn setup_uad_dir(dir: Option) -> PathBuf { - let dir = dir.unwrap().join("uad-ng"); + let dir = dir.unwrap().join("uad"); fs::create_dir_all(&dir).expect("Can't create cache directory"); dir } From 410e6a0720895c822fce9b5a550fa6d678551f02 Mon Sep 17 00:00:00 2001 From: Adhiraj Singh Chauhan Date: Thu, 4 Jan 2024 07:40:22 +0530 Subject: [PATCH 3/3] fix: incorrect log level configuration for our own crate --- src/main.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 8f2b3d6..fac4894 100644 --- a/src/main.rs +++ b/src/main.rs @@ -57,13 +57,15 @@ pub fn setup_logger() -> Result<(), fern::InitError> { let file_dispatcher = fern::Dispatch::new() .format(make_formatter(false)) .level(default_log_level) - .level_for("uad_gui", log::LevelFilter::Debug) + // Rust compiler makes module names use _ instead of - + .level_for("uad_ng", log::LevelFilter::Debug) .chain(log_file); let stdout_dispatcher = fern::Dispatch::new() .format(make_formatter(true)) .level(default_log_level) - .level_for("uad_gui", log::LevelFilter::Warn) + // Rust compiler makes module names use _ instead of - + .level_for("uad_ng", log::LevelFilter::Warn) .chain(std::io::stdout()); fern::Dispatch::new()