generated from os2edu/rustlings
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 4f95fd2
Showing
158 changed files
with
12,146 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
root = true | ||
|
||
[*.rs] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
indent_style = space | ||
indent_size = 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// TODO 判断文件是否存在 | ||
|
||
|
||
function judge(outputFile) { | ||
try { | ||
let jsonResult = JSON.parse(outputFile); | ||
let points = {}; | ||
jsonResult.exercises.forEach(({ name, result }) => { | ||
if (result) { | ||
points[name] = [1,1] | ||
} else { | ||
points[name] = [0,1] | ||
} | ||
}) | ||
return points; | ||
} catch(e) { | ||
return {}; | ||
} | ||
} | ||
|
||
module.exports.judge = judge; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"exercises": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
name: GitHub Classroom Workflow | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
paths-ignore: | ||
- 'README.md' | ||
- '.github/**' | ||
pull_request: | ||
branches: [ main ] | ||
workflow_dispatch: | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
TZ: Asia/Shanghai # 设置时区 | ||
|
||
jobs: | ||
build: | ||
name: Autograding | ||
runs-on: ubuntu-latest | ||
outputs: | ||
details: ${{ steps.autograding.outputs.details }} | ||
points: ${{ steps.autograding.outputs.points}} | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: checkouttoml | ||
run: curl -o check.toml https://raw.githubusercontent.com/livstyle/os-autograding-rust/main/check.toml | ||
- name: Run tests | ||
run: cargo test --test check --verbose | ||
- uses: yfblock/os-autograding@master | ||
id: autograding | ||
with: | ||
outputFile: .github/result/check_result.json | ||
deploy: | ||
name: Deploy to pages | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
continue-on-error: true | ||
with: | ||
ref: 'gh-pages' | ||
- name: Save Log File | ||
run: | | ||
mkdir autograding_logs | ||
cd autograding_logs | ||
if [ -f "../latest.json" ]; then | ||
cp ../latest.json older.json | ||
else | ||
echo "{}" > older.json | ||
fi | ||
FILE_NAME=`date +%Y_%m_%d_%H_%M_%S`.txt | ||
echo -ne "${{ needs.build.outputs.details }}\n" > $FILE_NAME | ||
echo -ne "Points: ${{ needs.build.outputs.points }}" >> $FILE_NAME | ||
cat older.json | jq ".default |= \"$FILE_NAME\"" > latest.json | ||
rm older.json | ||
echo -ne "# Got Points\n" > README.md | ||
echo "![Points bar](../../blob/gh-pages/points-badge.svg)" >> README.md | ||
- name: Make points svg | ||
uses: markpatterson27/points-bar@v1 | ||
with: | ||
points: '${{ needs.build.outputs.points }}' | ||
path: 'autograding_logs/points-badge.svg' | ||
type: 'badge' | ||
- name: GitHub Pages | ||
uses: crazy-max/ghaction-github-pages@v3 | ||
with: | ||
target_branch: gh-pages | ||
build_dir: autograding_logs | ||
keep_history: true | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
*.swp | ||
target/ | ||
**/*.rs.bk | ||
.DS_Store | ||
*.pdb | ||
exercises/clippy/Cargo.toml | ||
exercises/clippy/Cargo.lock | ||
rust-project.json | ||
.idea | ||
.vscode/* | ||
!.vscode/extensions.json | ||
*.iml | ||
*.o | ||
|
||
*.swp | ||
target/ | ||
**/*.rs.bk | ||
.DS_Store | ||
*.pdb | ||
exercises/clippy/Cargo.toml | ||
exercises/clippy/Cargo.lock | ||
rust-project.json | ||
.idea | ||
.vscode/* | ||
!.vscode/extensions.json | ||
*.iml | ||
*.o | ||
info.toml | ||
.github/result/check_result.json | ||
|
||
# Ignore test runner output | ||
__tests__/runner/* | ||
|
||
# Ignore test execution output | ||
*.class | ||
|
||
# Ignore node_modules by default (not for release) | ||
node_modules | ||
|
||
# ========================= | ||
# Node.js-Specific Ignores | ||
# ========================= | ||
|
||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Dependency directories | ||
jspm_packages/ | ||
|
||
# Typescript v1 declaration files | ||
typings/ | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
.env | ||
.env* | ||
|
||
# ========================= | ||
# Operating System Files | ||
# ========================= | ||
|
||
# OSX | ||
# ========================= | ||
|
||
.DS_Store | ||
.AppleDouble | ||
.LSOverride | ||
|
||
# Thumbnails | ||
._* | ||
|
||
# Files that might appear on external disk | ||
.Spotlight-V100 | ||
.Trashes | ||
|
||
# Directories potentially created on remote AFP share | ||
.AppleDB | ||
.AppleDesktop | ||
Network Trash Folder | ||
Temporary Items | ||
.apdisk | ||
|
||
# Windows | ||
# ========================= | ||
|
||
# Windows image file caches | ||
Thumbs.db | ||
ehthumbs.db | ||
|
||
# Folder config file | ||
Desktop.ini | ||
|
||
# Recycle Bin used on file shares | ||
$RECYCLE.BIN/ | ||
|
||
# Windows Installer files | ||
*.cab | ||
*.msi | ||
*.msm | ||
*.msp | ||
|
||
# Windows shortcuts | ||
*.lnk | ||
|
||
# Snippets | ||
NOTES.md | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
tasks: | ||
- init: /workspace/rustlings/install.sh | ||
command: /workspace/.cargo/bin/rustlings watch | ||
|
||
vscode: | ||
extensions: | ||
- [email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
language = "rust" | ||
run = "[ -x ~/.cargo/bin/rustlings ] && ~/.cargo/bin/rustlings watch || ./install.sh" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"recommendations": [ | ||
"rust-lang.rust-analyzer" | ||
] | ||
} |
Oops, something went wrong.