Local runner for GitHub autograder

Fix Flake Inputs

bwc9876.dev 782c0a0b e2acf9d5

verified
+39 -20
+4 -2
.github/workflows/release.yml
··· 35 36 - name: Block if There's a Release 37 if: ${{ steps.check-tag.outputs.exists != 'false' }} 38 - run: echo "::error file=Cargo.toml,title=Refusing to Release::Tag ${{ steps.check-tag.outputs.tag }} already exists" && exit 1 39 40 - name: Build 41 run: | ··· 44 - name: Generate artifact attestation 45 uses: actions/attest-build-provenance@v2 46 with: 47 - subject-path: 'target/release/gh-grader-preview' 48 49 - name: Upload Binary Artifact 50 uses: actions/upload-artifact@v4
··· 35 36 - name: Block if There's a Release 37 if: ${{ steps.check-tag.outputs.exists != 'false' }} 38 + run: 39 + echo "::error file=Cargo.toml,title=Refusing to Release::Tag ${{ 40 + steps.check-tag.outputs.tag }} already exists" && exit 1 41 42 - name: Build 43 run: | ··· 46 - name: Generate artifact attestation 47 uses: actions/attest-build-provenance@v2 48 with: 49 + subject-path: "target/release/gh-grader-preview" 50 51 - name: Upload Binary Artifact 52 uses: actions/upload-artifact@v4
+15 -8
README.md
··· 1 # GitHub Grader Preview 2 3 - Simple program that runs test cases specified in an autograding.json file and reports results. Useful for previewing how GitHub will run your autograder and project. 4 5 > [!WARNING] 6 - > 7 - > While this works on Windows, the GitHub classroom runner uses Linux by default, and so some professors may write commands 8 - > specific to Linux meaning they won't work for you. 9 10 ## Usage 11 ··· 13 gh-grader-preview 14 ``` 15 16 - Will auto-find the `autograding.json` file located in `.github/classroom` relative to the current dir. 17 18 You can specify `-f` to choose a different file. 19 ··· 35 36 ### Installation 37 38 - Copy the binary from `target/release/gh-grader-preview` to a directory in your PATH. 39 40 - Run `gh-grader-preview --man-page` to print the man page to stdout, and then save it to a file. 41 42 - Run `gh-grader-preview --completions=SHELL` (replace `SHELL` with `bash`, `fish`, or `zsh`) to generate a shell completion script.
··· 1 # GitHub Grader Preview 2 3 + Simple program that runs test cases specified in an autograding.json file and 4 + reports results. Useful for previewing how GitHub will run your autograder and 5 + project. 6 7 > [!WARNING] 8 + > 9 + > While this works on Windows, the GitHub classroom runner uses Linux by 10 + > default, and so some professors may write commands specific to Linux meaning 11 + > they won't work for you. 12 13 ## Usage 14 ··· 16 gh-grader-preview 17 ``` 18 19 + Will auto-find the `autograding.json` file located in `.github/classroom` 20 + relative to the current dir. 21 22 You can specify `-f` to choose a different file. 23 ··· 39 40 ### Installation 41 42 + Copy the binary from `target/release/gh-grader-preview` to a directory in your 43 + PATH. 44 45 + Run `gh-grader-preview --man-page` to print the man page to stdout, and then 46 + save it to a file. 47 48 + Run `gh-grader-preview --completions=SHELL` (replace `SHELL` with `bash`, 49 + `fish`, or `zsh`) to generate a shell completion script.
+7 -4
flake.lock
··· 22 ] 23 }, 24 "locked": { 25 - "lastModified": 1757940502, 26 - "narHash": "sha256-Xm0YaqIn11duN7EkFLQs0YDLWC0+rEdsE1RuQ4VABmU=", 27 "owner": "nix-community", 28 "repo": "flakelight", 29 - "rev": "71a933a4ce3683ba5f2bfabace834dd99f6c426a", 30 "type": "github" 31 }, 32 "original": { ··· 38 "flakelight-rust": { 39 "inputs": { 40 "crane": "crane", 41 - "flakelight": "flakelight" 42 }, 43 "locked": { 44 "lastModified": 1758026969, ··· 72 }, 73 "root": { 74 "inputs": { 75 "flakelight-rust": "flakelight-rust", 76 "nixpkgs": "nixpkgs" 77 }
··· 22 ] 23 }, 24 "locked": { 25 + "lastModified": 1758214611, 26 + "narHash": "sha256-5YLeUhF7Nu85fNi5ElWexJ4ViiY041I0mBLLzOhg2DQ=", 27 "owner": "nix-community", 28 "repo": "flakelight", 29 + "rev": "464ab0a32efcc4310eef119cfc6c470e267cd42a", 30 "type": "github" 31 }, 32 "original": { ··· 38 "flakelight-rust": { 39 "inputs": { 40 "crane": "crane", 41 + "flakelight": [ 42 + "flakelight" 43 + ] 44 }, 45 "locked": { 46 "lastModified": 1758026969, ··· 74 }, 75 "root": { 76 "inputs": { 77 + "flakelight": "flakelight", 78 "flakelight-rust": "flakelight-rust", 79 "nixpkgs": "nixpkgs" 80 }
+11 -4
flake.nix
··· 1 { 2 - inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; 3 - inputs.flakelight-rust.inputs.flakelight.inputs.nixpkgs.follows = "nixpkgs"; 4 - inputs.flakelight-rust.url = "github:accelbread/flakelight-rust"; 5 - outputs = {flakelight-rust, ...}: flakelight-rust ./. {}; 6 }
··· 1 { 2 + inputs = { 3 + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; 4 + flakelight.url = "github:nix-community/flakelight"; 5 + flakelight.inputs.nixpkgs.follows = "nixpkgs"; 6 + flakelight-rust.url = "github:accelbread/flakelight-rust"; 7 + flakelight-rust.inputs = { 8 + flakelight.follows = "flakelight"; 9 + }; 10 + }; 11 + 12 + outputs = { flakelight-rust, ... }: flakelight-rust ./. { }; 13 }
+1 -1
src/cli.rs
··· 1 - use clap::{Parser, command}; 2 3 #[derive(Parser)] 4 #[command(name="gh-grader-preview", author, version, about, long_about = None)]
··· 1 + use clap::{command, Parser}; 2 3 #[derive(Parser)] 4 #[command(name="gh-grader-preview", author, version, about, long_about = None)]
+1 -1
src/runner.rs
··· 4 time::Duration, 5 }; 6 7 - use anyhow::{Result, anyhow}; 8 use wait_timeout::ChildExt; 9 10 #[cfg(not(windows))]
··· 4 time::Duration, 5 }; 6 7 + use anyhow::{anyhow, Result}; 8 use wait_timeout::ChildExt; 9 10 #[cfg(not(windows))]