diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 84d5f3d7..f248c031 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -1,6 +1,6 @@ name: Bug report description: File a bug report -labels: [ bug ] +labels: [bug] title: "[BUG]: " body: - type: textarea @@ -11,7 +11,7 @@ body: description: > Please provide a short summary of the bug, along with any information you feel is relevant to replicating the bug. - + You may include screenshots and videos in this section. - type: textarea validations: @@ -21,10 +21,10 @@ body: description: > Please provide information about the versions of Windows and komorebi running on your machine. - + Do not submit a bug if you are not using an official version of Windows such as AtlasOS; only official versions of Windows are supported. - + ``` systeminfo | findstr /B /C:"OS Name" /B /C:"OS Version" ``` diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 195abe59..436c1fb9 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -5,4 +5,4 @@ contact_links: about: Please search the documentation website before opening an issue - name: Komorebi Quickstart Tutorial Video url: https://www.youtube.com/watch?v=MMZUAtHbTYY - about: If you are new, please make sure you watch the quickstart tutorial video \ No newline at end of file + about: If you are new, please make sure you watch the quickstart tutorial video diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml index f3b2cfc8..07d7cd61 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -1,6 +1,6 @@ name: Feature request description: Suggest a new feature -labels: [ enhancement ] +labels: [enhancement] title: "[FEAT]: " body: - type: dropdown diff --git a/.github/workflows/windows.yaml b/.github/workflows/windows.yaml index 47700fab..af4c232c 100644 --- a/.github/workflows/windows.yaml +++ b/.github/workflows/windows.yaml @@ -18,106 +18,84 @@ on: jobs: build: - name: Build - runs-on: windows-latest + strategy: + fail-fast: true + matrix: + platform: + - os-name: Windows-x86_64 + runs-on: windows-latest + target: x86_64-pc-windows-msvc + - os-name: Windows-aarch64 + runs-on: windows-latest + target: aarch64-pc-windows-msvc + runs-on: ${{ matrix.platform.runs-on }} permissions: write-all env: - RUSTFLAGS: -Ctarget-feature=+crt-static + RUSTFLAGS: -Ctarget-feature=+crt-static -Dwarnings GH_TOKEN: ${{ github.token }} - strategy: - fail-fast: false - matrix: - target: - - x86_64-pc-windows-msvc steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Prep cargo dirs - run: | - New-Item "${env:USERPROFILE}\.cargo\registry" -ItemType Directory -Force - New-Item "${env:USERPROFILE}\.cargo\git" -ItemType Directory -Force - shell: powershell - - name: Set environment variables appropriately for the build - run: | - echo "%USERPROFILE%\.cargo\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 - echo "TARGET=${{ matrix.target }}" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8 - echo "SKIP_TESTS=" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8 - - name: Cache cargo registry, git trees and binaries - uses: actions/cache@v4 + - run: rustup toolchain install stable --profile minimal + - run: rustup toolchain install nightly --allow-downgrade -c rustfmt + - uses: Swatinem/rust-cache@v2 with: - path: | - ~/.cargo/registry - ~/.cargo/git - ~/.cargo/bin - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - - name: Get rustc commit hash - id: cargo-target-cache - run: | - echo "::set-output name=rust_hash::$(rustc -Vv | grep commit-hash | awk '{print $2}')" - shell: bash - - name: Cache cargo build - uses: actions/cache@v4 + cache-on-failure: "true" + cache-all-crates: "true" + key: ${{ matrix.platform.target }} + - run: cargo +nightly fmt --check + - run: cargo clippy + - uses: houseabsolute/actions-rust-cross@v0 with: - path: target - key: ${{ github.base_ref }}-${{ github.head_ref }}-${{ matrix.target }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }} - restore-keys: ${{ github.base_ref }}-${{ matrix.target }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }} - - name: Install Rustup using win.rustup.rs - run: | - # Disable the download progress bar which can cause perf issues - $ProgressPreference = "SilentlyContinue" - Invoke-WebRequest https://win.rustup.rs/ -OutFile rustup-init.exe - .\rustup-init.exe -y --default-host=x86_64-pc-windows-msvc --profile=minimal - shell: powershell - - name: Ensure stable toolchain is up to date - run: rustup update stable - shell: bash - - name: Install the target - run: | - rustup target install ${{ matrix.target }} - - name: Run Cargo checks - run: | - cargo fmt --check - cargo check - cargo clippy - - name: Run a full build - run: | - cargo build --locked --release --target ${{ matrix.target }} - - name: Create MSI installer - run: | + command: "build" + target: ${{ matrix.platform.target }} + args: "--locked --release" + - run: | cargo install cargo-wix - cargo wix -p komorebi --nocapture -I .\wix\main.wxs --target x86_64-pc-windows-msvc - - name: Upload the built artifacts - uses: actions/upload-artifact@v4 + cargo wix --no-build -p komorebi --nocapture -I .\wix\main.wxs --target ${{ matrix.platform.target }} + - uses: actions/upload-artifact@v4 with: - name: komorebi-${{ matrix.target }} + name: komorebi-${{ matrix.platform.target }}-${{ github.sha }} path: | - target/${{ matrix.target }}/release/komorebi.exe - target/${{ matrix.target }}/release/komorebic.exe - target/${{ matrix.target }}/release/komorebic-no-console.exe - target/${{ matrix.target }}/release/komorebi-bar.exe - target/${{ matrix.target }}/release/komorebi-gui.exe - target/${{ matrix.target }}/release/komorebi.pdb - target/${{ matrix.target }}/release/komorebic.pdb - target/${{ matrix.target }}/release/komorebi_gui.pdb + target/${{ matrix.platform.target }}/release/*.exe + target/${{ matrix.platform.target }}/release/*.pdb target/wix/komorebi-*.msi - retention-days: 7 - - name: Check GoReleaser - uses: goreleaser/goreleaser-action@v3 - env: - GORELEASER_CURRENT_TAG: v0.1.29 + retention-days: 14 + + nightly: + needs: build + runs-on: windows-latest + permissions: write-all + if: ${{ github.ref == 'refs/heads/master' && github.event_name == 'schedule' }} + env: + GH_TOKEN: ${{ github.token }} + steps: + - uses: actions/checkout@v4 with: - version: latest - args: build --skip=validate --clean - - name: Prepare nightly artifacts - if: ${{ github.ref == 'refs/heads/master' && github.event_name == 'schedule' }} + fetch-depth: 0 + - shell: bash + run: echo "VERSION=nightly" >> $GITHUB_ENV + - uses: actions/download-artifact@v4 + - run: | + Compress-Archive -Force ./komorebi-x86_64-pc-windows-msvc-${{ github.sha }}/x86_64-pc-windows-msvc/release/*.exe komorebi-$Env:VERSION-x86_64-pc-windows-msvc.zip + Copy-Item ./komorebi-x86_64-pc-windows-msvc-${{ github.sha }}/wix/*x86_64.msi -Destination ./komorebi-$Env:VERSION-x86_64.msi + echo "$((Get-FileHash komorebi-$Env:VERSION-x86_64-pc-windows-msvc.zip).Hash.ToLower()) komorebi-$Env:VERSION-x86_64-pc-windows-msvc.zip" >checksums.txt + + Compress-Archive -Force ./komorebi-aarch64-pc-windows-msvc-${{ github.sha }}/aarch64-pc-windows-msvc/release/*.exe komorebi-$Env:VERSION-aarch64-pc-windows-msvc.zip + Copy-Item ./komorebi-aarch64-pc-windows-msvc-${{ github.sha }}/wix/*aarch64.msi -Destination ./komorebi-$Env:VERSION-aarch64.msi + echo "$((Get-FileHash komorebi-$Env:VERSION-aarch64-pc-windows-msvc.zip).Hash.ToLower()) komorebi-$Env:VERSION-aarch64-pc-windows-msvc.zip" >>checksums.txt + - uses: Swatinem/rust-cache@v2 + with: + cache-on-failure: "true" + cache-all-crates: "true" + - shell: bash run: | - Compress-Archive .\target\${{ matrix.target }}\release\*.exe komorebi-nightly-x86_64-pc-windows-msvc.zip - Copy-Item ./target/wix/*.msi -Destination ./komorebi-nightly-x86_64.msi - echo "$((Get-FileHash komorebi-nightly-x86_64-pc-windows-msvc.zip).Hash.ToLower()) komorebi-nightly-x86_64-pc-windows-msvc.zip" >checksums.txt - - name: Update nightly - if: ${{ github.ref == 'refs/heads/master' && github.event_name == 'schedule' }} - shell: bash + if ! type kokai >/dev/null; then cargo install --locked kokai --force; fi + git tag -d nightly || true + git tag nightly + kokai release --no-emoji --add-links github:commits,issues --ref nightly >"CHANGELOG.md" + - shell: bash run: | gh release delete nightly --yes || true git push origin :nightly || true @@ -125,39 +103,100 @@ jobs: --target $GITHUB_SHA \ --prerelease \ --title "komorebi nightly (${GITHUB_SHA})" \ - --notes "This nightly release of komorebi corresponds to [this commit](https://github.com/LGUG2Z/komorebi/commit/${GITHUB_SHA})." \ + --notes-file CHANGELOG.md komorebi-nightly-x86_64-pc-windows-msvc.zip \ komorebi-nightly-x86_64.msi \ + komorebi-nightly-aarch64-pc-windows-msvc.zip \ + komorebi-nightly-aarch64.msi \ checksums.txt - # Release - - name: Generate changelog - if: startsWith(github.ref, 'refs/tags/v') - shell: bash + + release-dry-run: + needs: build + runs-on: windows-latest + permissions: write-all + if: ${{ github.ref == 'refs/heads/master' }} + env: + GH_TOKEN: ${{ github.token }} + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - shell: bash + run: | + TAG=${{ github.event.release.tag_name }} + echo "VERSION=${TAG#v}" >> $GITHUB_ENV + - uses: actions/download-artifact@v4 + - run: | + Compress-Archive -Force ./komorebi-x86_64-pc-windows-msvc-${{ github.sha }}/x86_64-pc-windows-msvc/release/*.exe komorebi-$Env:VERSION-x86_64-pc-windows-msvc.zip + Copy-Item ./komorebi-x86_64-pc-windows-msvc-${{ github.sha }}/wix/*x86_64.msi -Destination ./komorebi-$Env:VERSION-x86_64.msi + echo "$((Get-FileHash komorebi-$Env:VERSION-x86_64-pc-windows-msvc.zip).Hash.ToLower()) komorebi-$Env:VERSION-x86_64-pc-windows-msvc.zip" >checksums.txt + + Compress-Archive -Force ./komorebi-aarch64-pc-windows-msvc-${{ github.sha }}/aarch64-pc-windows-msvc/release/*.exe komorebi-$Env:VERSION-aarch64-pc-windows-msvc.zip + Copy-Item ./komorebi-aarch64-pc-windows-msvc-${{ github.sha }}/wix/*aarch64.msi -Destination ./komorebi-$Env:VERSION-aarch64.msi + echo "$((Get-FileHash komorebi-$Env:VERSION-aarch64-pc-windows-msvc.zip).Hash.ToLower()) komorebi-$Env:VERSION-aarch64-pc-windows-msvc.zip" >>checksums.txt + - uses: Swatinem/rust-cache@v2 + with: + cache-on-failure: "true" + cache-all-crates: "true" + - shell: bash run: | if ! type kokai >/dev/null; then cargo install --locked kokai --force; fi - git tag -d nightly + git tag -d nightly || true + kokai release --no-emoji --add-links github:commits,issues --ref "${{ github.ref_name }}" >"CHANGELOG.md" + - uses: softprops/action-gh-release@v2 + with: + draft: true + body_path: "CHANGELOG.md" + files: | + checksums.txt + *.zip + *.msi + + release: + needs: build + runs-on: windows-latest + permissions: write-all + if: startsWith(github.ref, 'refs/tags/v') + env: + GH_TOKEN: ${{ github.token }} + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - shell: bash + run: | + TAG=${{ github.event.release.tag_name }} + echo "VERSION=${TAG#v}" >> $GITHUB_ENV + - uses: actions/download-artifact@v4 + - run: | + Compress-Archive -Force ./komorebi-x86_64-pc-windows-msvc-${{ github.sha }}/x86_64-pc-windows-msvc/release/*.exe komorebi-$Env:VERSION-x86_64-pc-windows-msvc.zip + Copy-Item ./komorebi-x86_64-pc-windows-msvc-${{ github.sha }}/wix/*x86_64.msi -Destination ./komorebi-$Env:VERSION-x86_64.msi + echo "$((Get-FileHash komorebi-$Env:VERSION-x86_64-pc-windows-msvc.zip).Hash.ToLower()) komorebi-$Env:VERSION-x86_64-pc-windows-msvc.zip" >checksums.txt + + Compress-Archive -Force ./komorebi-aarch64-pc-windows-msvc-${{ github.sha }}/aarch64-pc-windows-msvc/release/*.exe komorebi-$Env:VERSION-aarch64-pc-windows-msvc.zip + Copy-Item ./komorebi-aarch64-pc-windows-msvc-${{ github.sha }}/wix/*aarch64.msi -Destination ./komorebi-$Env:VERSION-aarch64.msi + echo "$((Get-FileHash komorebi-$Env:VERSION-aarch64-pc-windows-msvc.zip).Hash.ToLower()) komorebi-$Env:VERSION-aarch64-pc-windows-msvc.zip" >>checksums.txt + - uses: Swatinem/rust-cache@v2 + with: + cache-on-failure: "true" + cache-all-crates: "true" + - shell: bash + run: | + if ! type kokai >/dev/null; then cargo install --locked kokai --force; fi + git tag -d nightly || true kokai release --no-emoji --add-links github:commits,issues --ref "$(git tag --points-at HEAD)" >"CHANGELOG.md" - - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v3 - if: startsWith(github.ref, 'refs/tags/v') + - uses: softprops/action-gh-release@v2 with: - version: latest - args: release --skip=validate --clean --release-notes=CHANGELOG.md - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SCOOP_TOKEN: ${{ secrets.SCOOP_TOKEN }} - - name: Add MSI to release - uses: softprops/action-gh-release@v2 - if: startsWith(github.ref, 'refs/tags/v') - with: - files: "target/wix/komorebi-*.msi" + body_path: "CHANGELOG.md" + files: | + checksums.txt + *.zip + *.msi winget: - name: Publish to WinGet runs-on: ubuntu-latest - needs: build + needs: release if: startsWith(github.ref, 'refs/tags/v') - steps: - uses: vedantmgoyal2009/winget-releaser@v2 with: diff --git a/.goreleaser.yml b/.goreleaser.yml deleted file mode 100644 index 3cdeeaa9..00000000 --- a/.goreleaser.yml +++ /dev/null @@ -1,68 +0,0 @@ -# Adapted from https://jondot.medium.com/shipping-rust-binaries-with-goreleaser-d5aa42a46be0 -project_name: komorebi - -before: - hooks: - - powershell.exe -Command "New-Item -Path . -Name dummy.go -ItemType file -Force" - - powershell.exe -Command "Add-Content -Path .\dummy.go -Value 'package main'" - - powershell.exe -Command "Add-Content -Path .\dummy.go -Value 'func main() {}'" - -builds: - - id: komorebi - main: dummy.go - goos: [ "windows" ] - goarch: [ "amd64" ] - binary: komorebi - hooks: - post: - - mkdir -p dist/windows_amd64 - - cp ".\target\x86_64-pc-windows-msvc\release\komorebi.exe" ".\dist\komorebi_windows_amd64_v1\komorebi.exe" - - id: komorebic - main: dummy.go - goos: [ "windows" ] - goarch: [ "amd64" ] - binary: komorebic - hooks: - post: - - mkdir -p dist/windows_amd64 - - cp ".\target\x86_64-pc-windows-msvc\release\komorebic.exe" ".\dist\komorebic_windows_amd64_v1\komorebic.exe" - - id: komorebic-no-console - main: dummy.go - goos: [ "windows" ] - goarch: [ "amd64" ] - binary: komorebic-no-console - hooks: - post: - - mkdir -p dist/windows_amd64 - - cp ".\target\x86_64-pc-windows-msvc\release\komorebic-no-console.exe" ".\dist\komorebic-no-console_windows_amd64_v1\komorebic-no-console.exe" - - id: komorebi-gui - main: dummy.go - goos: [ "windows" ] - goarch: [ "amd64" ] - binary: komorebi-gui - hooks: - post: - - mkdir -p dist/windows_amd64 - - cp ".\target\x86_64-pc-windows-msvc\release\komorebi-gui.exe" ".\dist\komorebi-gui_windows_amd64_v1\komorebi-gui.exe" - - id: komorebi-bar - main: dummy.go - goos: [ "windows" ] - goarch: [ "amd64" ] - binary: komorebi-bar - hooks: - post: - - mkdir -p dist/windows_amd64 - - cp ".\target\x86_64-pc-windows-msvc\release\komorebi-bar.exe" ".\dist\komorebi-bar_windows_amd64_v1\komorebi-bar.exe" - -archives: - - name_template: "{{ .ProjectName }}-{{ .Version }}-x86_64-pc-windows-msvc" - format: zip - files: - - LICENSE.md - - CHANGELOG.md - -checksum: - name_template: checksums.txt - -changelog: - sort: asc diff --git a/justfile b/justfile index bf0c0ca1..51df8b26 100644 --- a/justfile +++ b/justfile @@ -7,8 +7,9 @@ clean: fmt: cargo +nightly fmt cargo +stable clippy - prettier --write README.md - prettier --write .goreleaser.yml + prettier --write .github/ISSUE_TEMPLATE/bug_report.yml + prettier --write .github/ISSUE_TEMPLATE/config.yml + prettier --write .github/ISSUE_TEMPLATE/feature_request.yml prettier --write .github/dependabot.yml prettier --write .github/FUNDING.yml prettier --write .github/workflows/windows.yaml diff --git a/wix/main.wxs b/wix/main.wxs index 826d4d00..991c202c 100644 --- a/wix/main.wxs +++ b/wix/main.wxs @@ -61,7 +61,7 @@ - +