diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..dec7161 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,66 @@ +name: PR Pipeline + +on: + pull_request: + branches: + - "main" + workflow_dispatch: + +concurrency: + group: ${{ github.head_ref || github.ref }} + cancel-in-progress: true + +env: + CARGO_TERM_COLOR: always + +jobs: + pr: + name: Run PR-Job + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v5 + with: + fetch-depth: 0 + token: ${{ secrets.BOT_TOKEN }} + ref: ${{ github.event.pull_request.head.sha }} + + - name: Extract last commit message + id: last_commit + run: | + last_commit_msg=$(git log -1 --pretty=%s) + echo "lastcommit=$last_commit_msg" >> $GITHUB_ENV + + - name: Build + run: cargo build --verbose + + - name: Execute tests + run: cargo test + + - name: Check on unwanted file changes + run: | + git status --short + git add -A + git diff --cached --exit-code + + - name: Format code + if: >- + ${{ + !contains(env.lastcommit, '🎨 Formatted code') + }} + run: cargo fmt + + - name: Add formatting-commit + if: >- + ${{ + !contains(env.lastcommit, '🎨 Formatted code') + }} + run: | + git config --global user.name 'OpenFoxes Maintenance Bot' + git config --global user.email 'openfoxes@bono-fox.de' + git checkout ${{ github.event.pull_request.head.ref }} + git add . + git diff-index --quiet ${{ github.event.pull_request.head.ref }} || { + git commit -m "🎨 Formatted code" + git push origin ${{ github.event.pull_request.head.ref }} + } diff --git a/Cargo.lock b/Cargo.lock index 09286ee..e22a684 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -939,9 +939,9 @@ checksum = "b5418c17512bdf42730f9032c74e1ae39afc408745ebb2acf72fbc4691c17945" [[package]] name = "glob" -version = "0.3.1" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" +checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280" [[package]] name = "glow" @@ -1440,7 +1440,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c2a198fb6b0eada2a8df47933734e6d35d350665a33a3593d7164fa52c75c19" dependencies = [ "cfg-if", - "windows-targets 0.48.5", + "windows-targets 0.52.4", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 92801cb..b590f8d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,15 +16,15 @@ categories = ["hardware-support"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -iced = { version = "0.10", features = ["image", "tokio"] } -nix = { version = "0.29", features = ["ioctl"] } -errno = "0" -hex = "0" -glob = "0" -enum_dispatch = "0.3" -rosc = "~0.10" -thiserror = "1.0" -hexdump = "0.1" +iced = { version = "0.10.0", features = ["image", "tokio"] } +nix = { version = "0.29.0", features = ["ioctl"] } +errno = "0.3.14" +hex = "0.4.3" +glob = "0.3.3" +enum_dispatch = "0.3.13" +rosc = "0.10.1" +thiserror = "1.0.69" +hexdump = "0.1.2" clap = { version = "4.4.18", features = ["derive"] } [[bin]]