Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
github-classroom[bot] authored Dec 24, 2022
0 parents commit 4f95fd2
Show file tree
Hide file tree
Showing 158 changed files with 12,146 additions and 0 deletions.
1,680 changes: 1,680 additions & 0 deletions .all-contributorsrc

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions .editorconfig
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
21 changes: 21 additions & 0 deletions .github/classroom/checkresult.js
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;
3 changes: 3 additions & 0 deletions .github/result/check_result.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"exercises": []
}
73 changes: 73 additions & 0 deletions .github/workflows/rust.yml
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 }}
128 changes: 128 additions & 0 deletions .gitignore
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

7 changes: 7 additions & 0 deletions .gitpod.yml
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]
2 changes: 2 additions & 0 deletions .replit
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"
5 changes: 5 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"recommendations": [
"rust-lang.rust-analyzer"
]
}
Loading

0 comments on commit 4f95fd2

Please sign in to comment.