Skip to content

Commit 57e7794

Browse files
Initial commit
0 parents  commit 57e7794

File tree

158 files changed

+12146
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

158 files changed

+12146
-0
lines changed

.all-contributorsrc

Lines changed: 1680 additions & 0 deletions
Large diffs are not rendered by default.

.editorconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
root = true
2+
3+
[*.rs]
4+
end_of_line = lf
5+
insert_final_newline = true
6+
indent_style = space
7+
indent_size = 4

.github/classroom/checkresult.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// TODO 判断文件是否存在
2+
3+
4+
function judge(outputFile) {
5+
try {
6+
let jsonResult = JSON.parse(outputFile);
7+
let points = {};
8+
jsonResult.exercises.forEach(({ name, result }) => {
9+
if (result) {
10+
points[name] = [1,1]
11+
} else {
12+
points[name] = [0,1]
13+
}
14+
})
15+
return points;
16+
} catch(e) {
17+
return {};
18+
}
19+
}
20+
21+
module.exports.judge = judge;

.github/result/check_result.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"exercises": []
3+
}

.github/workflows/rust.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: GitHub Classroom Workflow
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
paths-ignore:
7+
- 'README.md'
8+
- '.github/**'
9+
pull_request:
10+
branches: [ main ]
11+
workflow_dispatch:
12+
13+
env:
14+
CARGO_TERM_COLOR: always
15+
TZ: Asia/Shanghai # 设置时区
16+
17+
jobs:
18+
build:
19+
name: Autograding
20+
runs-on: ubuntu-latest
21+
outputs:
22+
details: ${{ steps.autograding.outputs.details }}
23+
points: ${{ steps.autograding.outputs.points}}
24+
25+
steps:
26+
- uses: actions/checkout@v3
27+
- name: checkouttoml
28+
run: curl -o check.toml https://raw.githubusercontent.com/livstyle/os-autograding-rust/main/check.toml
29+
- name: Run tests
30+
run: cargo test --test check --verbose
31+
- uses: yfblock/os-autograding@master
32+
id: autograding
33+
with:
34+
outputFile: .github/result/check_result.json
35+
deploy:
36+
name: Deploy to pages
37+
needs: build
38+
runs-on: ubuntu-latest
39+
steps:
40+
- uses: actions/checkout@v3
41+
continue-on-error: true
42+
with:
43+
ref: 'gh-pages'
44+
- name: Save Log File
45+
run: |
46+
mkdir autograding_logs
47+
cd autograding_logs
48+
if [ -f "../latest.json" ]; then
49+
cp ../latest.json older.json
50+
else
51+
echo "{}" > older.json
52+
fi
53+
FILE_NAME=`date +%Y_%m_%d_%H_%M_%S`.txt
54+
echo -ne "${{ needs.build.outputs.details }}\n" > $FILE_NAME
55+
echo -ne "Points: ${{ needs.build.outputs.points }}" >> $FILE_NAME
56+
cat older.json | jq ".default |= \"$FILE_NAME\"" > latest.json
57+
rm older.json
58+
echo -ne "# Got Points\n" > README.md
59+
echo "![Points bar](../../blob/gh-pages/points-badge.svg)" >> README.md
60+
- name: Make points svg
61+
uses: markpatterson27/points-bar@v1
62+
with:
63+
points: '${{ needs.build.outputs.points }}'
64+
path: 'autograding_logs/points-badge.svg'
65+
type: 'badge'
66+
- name: GitHub Pages
67+
uses: crazy-max/ghaction-github-pages@v3
68+
with:
69+
target_branch: gh-pages
70+
build_dir: autograding_logs
71+
keep_history: true
72+
env:
73+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
*.swp
2+
target/
3+
**/*.rs.bk
4+
.DS_Store
5+
*.pdb
6+
exercises/clippy/Cargo.toml
7+
exercises/clippy/Cargo.lock
8+
rust-project.json
9+
.idea
10+
.vscode/*
11+
!.vscode/extensions.json
12+
*.iml
13+
*.o
14+
15+
*.swp
16+
target/
17+
**/*.rs.bk
18+
.DS_Store
19+
*.pdb
20+
exercises/clippy/Cargo.toml
21+
exercises/clippy/Cargo.lock
22+
rust-project.json
23+
.idea
24+
.vscode/*
25+
!.vscode/extensions.json
26+
*.iml
27+
*.o
28+
info.toml
29+
.github/result/check_result.json
30+
31+
# Ignore test runner output
32+
__tests__/runner/*
33+
34+
# Ignore test execution output
35+
*.class
36+
37+
# Ignore node_modules by default (not for release)
38+
node_modules
39+
40+
# =========================
41+
# Node.js-Specific Ignores
42+
# =========================
43+
44+
# Logs
45+
logs
46+
*.log
47+
npm-debug.log*
48+
yarn-debug.log*
49+
yarn-error.log*
50+
51+
# node-waf configuration
52+
.lock-wscript
53+
54+
# Dependency directories
55+
jspm_packages/
56+
57+
# Typescript v1 declaration files
58+
typings/
59+
60+
# Optional npm cache directory
61+
.npm
62+
63+
# Optional eslint cache
64+
.eslintcache
65+
66+
# Optional REPL history
67+
.node_repl_history
68+
69+
# Output of 'npm pack'
70+
*.tgz
71+
72+
# Yarn Integrity file
73+
.yarn-integrity
74+
75+
# dotenv environment variables file
76+
.env
77+
.env*
78+
79+
# =========================
80+
# Operating System Files
81+
# =========================
82+
83+
# OSX
84+
# =========================
85+
86+
.DS_Store
87+
.AppleDouble
88+
.LSOverride
89+
90+
# Thumbnails
91+
._*
92+
93+
# Files that might appear on external disk
94+
.Spotlight-V100
95+
.Trashes
96+
97+
# Directories potentially created on remote AFP share
98+
.AppleDB
99+
.AppleDesktop
100+
Network Trash Folder
101+
Temporary Items
102+
.apdisk
103+
104+
# Windows
105+
# =========================
106+
107+
# Windows image file caches
108+
Thumbs.db
109+
ehthumbs.db
110+
111+
# Folder config file
112+
Desktop.ini
113+
114+
# Recycle Bin used on file shares
115+
$RECYCLE.BIN/
116+
117+
# Windows Installer files
118+
*.cab
119+
*.msi
120+
*.msm
121+
*.msp
122+
123+
# Windows shortcuts
124+
*.lnk
125+
126+
# Snippets
127+
NOTES.md
128+

.gitpod.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
tasks:
2+
- init: /workspace/rustlings/install.sh
3+
command: /workspace/.cargo/bin/rustlings watch
4+
5+
vscode:
6+
extensions:
7+

.replit

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
language = "rust"
2+
run = "[ -x ~/.cargo/bin/rustlings ] && ~/.cargo/bin/rustlings watch || ./install.sh"

.vscode/extensions.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"recommendations": [
3+
"rust-lang.rust-analyzer"
4+
]
5+
}

0 commit comments

Comments
 (0)