Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/actions/setup-devenv/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Setup devenv and cachix
description: Install devenv and cachix

inputs:
GITHUB_TOKEN:
required: true
CACHIX_AUTH_TOKEN:
required: true

runs:
using: "composite"
steps:
- uses: cachix/install-nix-action@v31
with:
github_access_token: ${{ inputs.GITHUB_TOKEN }}
- uses: cachix/cachix-action@v16
with:
# https://app.cachix.org/cache/rustpolnak
name: rustpolnak
authToken: "${{ inputs.CACHIX_AUTH_TOKEN }}"
- name: install devenv
shell: bash
run: nix profile add nixpkgs#devenv
53 changes: 23 additions & 30 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: Build
name: Build and test

on:
push:
on: [push]

env:
CARGO_TERM_COLOR: always
Expand All @@ -10,34 +9,28 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- run: sudo apt update
- run: sudo apt install libgtk-3-dev libsoup-3.0-dev libjavascriptcoregtk-4.1-dev libwebkit2gtk-4.1-dev libudev-dev libxdo-dev
- uses: Swatinem/rust-cache@v2
- run: cargo build --profile release
- run: cargo test --profile release
- uses: actions/upload-artifact@v4
with:
name: rustpolnak
path: target/release/rustpolnak
if-no-files-found: error
- uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: target/release/rustpolnak
- uses: actions/checkout@v5
- uses: ./.github/actions/setup-devenv
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
- uses: Swatinem/rust-cache@v2
- name: test the app
run: devenv shell test-app
- uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: target/release/rustpolnak

precommit:
runs-on: ubuntu-latest
steps:
- run: sudo apt update
- run: sudo apt install libgtk-3-dev libsoup-3.0-dev libjavascriptcoregtk-4.1-dev libwebkit2gtk-4.1-dev libudev-dev libxdo-dev
- run: |
curl -L "https://github.com/DioxusLabs/dioxus/releases/download/v0.6.3/dx-x86_64-unknown-linux-gnu-v0.6.3.tar.gz" -o dx.tar.gz
tar -xzf dx.tar.gz
sudo mv dx /usr/local/bin/
dx --version
- uses: actions/checkout@v5
- uses: actions/setup-python@v6
- uses: pre-commit/action@v3.0.1
with:
extra_args: --all-files
- uses: actions/checkout@v5
- uses: ./.github/actions/setup-devenv
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
- uses: actions/setup-python@v6
- uses: pre-commit/action@v3.0.1
with:
extra_args: --all-files
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ rustpolnak.toml
.devenv*
devenv.local.nix
.devenv.flake.nix
stubs/dev
stubs
26 changes: 26 additions & 0 deletions devenv.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,20 @@ let
openGlPaths = lib.makeLibraryPath openGlDeps;
in
{
name = "rustpolnak";
git-hooks.hooks = {
# various
end-of-file-fixer.enable = true;
trim-trailing-whitespace.enable = true;
check-yaml.enable = true;
# rust
rustfmt.enable = true;
cargo-check.enable = true;
# piton
ruff-format.enable = true;
ruff.enable = true;

};
languages.rust.enable = true;
languages.python.enable = true;
languages.python.uv.enable = true;
Expand All @@ -30,10 +44,22 @@ in
LD_LIBRARY_PATH = openGlPaths;
WEBKIT_DISABLE_COMPOSITING_MODE = 1;
};
# enterTest = ''
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

# cargo build --profile release
# cargo test --profile release
# '';
processes = {
dx.exec = "dx serve";
api.exec = "uv --directory stubs run fastapi dev";
rfid.exec = "uv --directory stubs run rfid.py";
rfiddump.exec = "cargo run --bin rfiddump";
};
scripts = {
test-app.exec = ''
cargo build --profile release
cargo test --profile release
'';
};
}


Loading