Compare commits
	
		
			5 Commits
		
	
	
		
			1d411cefb5
			...
			main
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| a29828e8d5 | |||
| 3169f32e4f | |||
| 9da2086018 | |||
| 040d521395 | |||
| 51a04207ab | 
@@ -1,31 +1,57 @@
 | 
				
			|||||||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
 | 
					 | 
				
			||||||
// README at: https://github.com/devcontainers/templates/tree/main/src/rust
 | 
					 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	"name": "Rust",
 | 
						"name": "Rust",
 | 
				
			||||||
	// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
 | 
					 | 
				
			||||||
	"image": "mcr.microsoft.com/devcontainers/rust:1-1-bullseye",
 | 
						"image": "mcr.microsoft.com/devcontainers/rust:1-1-bullseye",
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Features to add to the dev container. More info: https://containers.dev/features.
 | 
						// 先构建项目,但不自动运行
 | 
				
			||||||
	// "features": {},
 | 
						"postStartCommand": "cargo build && clear",
 | 
				
			||||||
	"postStartCommand": "cargo run",
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Configure tool-specific properties.
 | 
					 | 
				
			||||||
	"customizations": {
 | 
						"customizations": {
 | 
				
			||||||
		// Configure properties specific to VS Code.
 | 
					 | 
				
			||||||
		"vscode": {
 | 
							"vscode": {
 | 
				
			||||||
			"settings": {},
 | 
								"settings": {},
 | 
				
			||||||
			"extensions": [
 | 
								"extensions": [
 | 
				
			||||||
				"streetsidesoftware.code-spell-checker"
 | 
									"streetsidesoftware.code-spell-checker",
 | 
				
			||||||
			]
 | 
									"rust-lang.rust-analyzer",  // 添加 Rust 语言支持
 | 
				
			||||||
 | 
									"vadimcn.vscode-lldb"       // 添加 LLDB 调试器支持
 | 
				
			||||||
 | 
								],
 | 
				
			||||||
 | 
								
 | 
				
			||||||
 | 
								// 添加调试配置
 | 
				
			||||||
 | 
								"debug": {
 | 
				
			||||||
 | 
									"configurations": [
 | 
				
			||||||
 | 
										{
 | 
				
			||||||
 | 
											"type": "lldb",
 | 
				
			||||||
 | 
											"request": "launch",
 | 
				
			||||||
 | 
											"name": "Debug Rust Application",
 | 
				
			||||||
 | 
											"program": "${workspaceFolder}/target/debug/${workspaceFolderBasename}",
 | 
				
			||||||
 | 
											"args": [],
 | 
				
			||||||
 | 
											"cwd": "${workspaceFolder}",
 | 
				
			||||||
 | 
											"preLaunchTask": "cargo-build"
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
									]
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
								
 | 
				
			||||||
 | 
								// 添加构建任务
 | 
				
			||||||
 | 
								"tasks": {
 | 
				
			||||||
 | 
									"tasks": [
 | 
				
			||||||
 | 
										{
 | 
				
			||||||
 | 
											"type": "cargo",
 | 
				
			||||||
 | 
											"command": "build",
 | 
				
			||||||
 | 
											"problemMatcher": [
 | 
				
			||||||
 | 
												"$rustc"
 | 
				
			||||||
 | 
											],
 | 
				
			||||||
 | 
											"group": "build",
 | 
				
			||||||
 | 
											"label": "cargo-build"
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
									]
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						// 转发应用端口(根据你的实际端口修改)
 | 
				
			||||||
 | 
						"forwardPorts": [8080],
 | 
				
			||||||
 | 
						"portsAttributes": {
 | 
				
			||||||
 | 
							"8080": {
 | 
				
			||||||
 | 
								"label": "Rust Application",
 | 
				
			||||||
 | 
								"onAutoForward": "notify"
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
	// Use 'forwardPorts' to make a list of ports inside the container available locally.
 | 
					 | 
				
			||||||
	// "forwardPorts": [],
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	// Use 'postCreateCommand' to run commands after the container is created.
 | 
					 | 
				
			||||||
	// "postCreateCommand": "rustc --version",
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
 | 
					 | 
				
			||||||
	// "remoteUser": "root"
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
							
								
								
									
										41
									
								
								.gitea/workflows/ci.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								.gitea/workflows/ci.yaml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,41 @@
 | 
				
			|||||||
 | 
					name: Rust CI Pipeline
 | 
				
			||||||
 | 
					on:
 | 
				
			||||||
 | 
					  push:
 | 
				
			||||||
 | 
					    branches:
 | 
				
			||||||
 | 
					      - main
 | 
				
			||||||
 | 
					  pull_request:
 | 
				
			||||||
 | 
					    branches:
 | 
				
			||||||
 | 
					      - main
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					jobs:
 | 
				
			||||||
 | 
					  test-and-build:
 | 
				
			||||||
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
 | 
					    container:
 | 
				
			||||||
 | 
					      image: ghcr.io/rust-lang/rust:latest
 | 
				
			||||||
 | 
					    steps:
 | 
				
			||||||
 | 
					      # 1. 检出代码 - 使用 Gitea 本地的 actions 镜像
 | 
				
			||||||
 | 
					      - name: 🔍 Check out repository code
 | 
				
			||||||
 | 
					        uses: https://devstar.cn/actions/checkout@v4 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      # 2. 显示环境信息
 | 
				
			||||||
 | 
					      - name: ℹ️ Environment Info
 | 
				
			||||||
 | 
					        run: |
 | 
				
			||||||
 | 
					          rustc --version
 | 
				
			||||||
 | 
					          cargo --version
 | 
				
			||||||
 | 
					          echo "Building repository: ${{ gitea.repository }}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      # 3. 构建项目(调试模式)
 | 
				
			||||||
 | 
					      - name: 🔧 Build (Debug)
 | 
				
			||||||
 | 
					        run: cargo build --verbose
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      # 4. 构建项目(发布模式)
 | 
				
			||||||
 | 
					      - name: 🚀 Build (Release)
 | 
				
			||||||
 | 
					        run: cargo build --release --verbose
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      # 5. 运行测试
 | 
				
			||||||
 | 
					      - name: ✅ Run Tests
 | 
				
			||||||
 | 
					        run: cargo test --verbose
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      # 6. 清理构建缓存
 | 
				
			||||||
 | 
					      - name: 🧹 Cleanup
 | 
				
			||||||
 | 
					        run: cargo clean
 | 
				
			||||||
@@ -1,7 +0,0 @@
 | 
				
			|||||||
# For more details, see https://containers.dev/guide/dependabot
 | 
					 | 
				
			||||||
version: 2
 | 
					 | 
				
			||||||
updates:
 | 
					 | 
				
			||||||
  - package-ecosystem: "devcontainers"
 | 
					 | 
				
			||||||
    directory: "/"
 | 
					 | 
				
			||||||
    schedule:
 | 
					 | 
				
			||||||
      interval: weekly
 | 
					 | 
				
			||||||
							
								
								
									
										7
									
								
								.vscode/launch.json
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										7
									
								
								.vscode/launch.json
									
									
									
									
										vendored
									
									
								
							@@ -1,4 +1,3 @@
 | 
				
			|||||||
 | 
					 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    "version": "0.2.0",
 | 
					    "version": "0.2.0",
 | 
				
			||||||
    "configurations": [
 | 
					    "configurations": [
 | 
				
			||||||
@@ -17,7 +16,11 @@
 | 
				
			|||||||
                    "kind": "bin"
 | 
					                    "kind": "bin"
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            "args": []
 | 
					            "args": [],
 | 
				
			||||||
 | 
					            // 添加环境变量解决文件锁问题
 | 
				
			||||||
 | 
					            "env": {
 | 
				
			||||||
 | 
					                "CARGO_REGISTRIES_CRATES_IO_PROTOCOL": "sparse"
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    ]
 | 
					    ]
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
							
								
								
									
										25
									
								
								.vscode/task.json
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								.vscode/task.json
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,25 @@
 | 
				
			|||||||
 | 
					{
 | 
				
			||||||
 | 
					    "version": "2.0.0",
 | 
				
			||||||
 | 
					    "tasks": [
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            "label": "cargo-clean-build",
 | 
				
			||||||
 | 
					            "type": "process",
 | 
				
			||||||
 | 
					            "command": "cargo",
 | 
				
			||||||
 | 
					            "args": [
 | 
				
			||||||
 | 
					                "build",
 | 
				
			||||||
 | 
					                "--bin=hello_remote_world",
 | 
				
			||||||
 | 
					                "--package=hello_remote_world"
 | 
				
			||||||
 | 
					            ],
 | 
				
			||||||
 | 
					            "group": "build",
 | 
				
			||||||
 | 
					            "problemMatcher": ["$rustc"],
 | 
				
			||||||
 | 
					            "presentation": {
 | 
				
			||||||
 | 
					                "echo": true,
 | 
				
			||||||
 | 
					                "reveal": "always",
 | 
				
			||||||
 | 
					                "focus": false,
 | 
				
			||||||
 | 
					                "panel": "shared",
 | 
				
			||||||
 | 
					                "showReuseMessage": true,
 | 
				
			||||||
 | 
					                "clear": false
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    ]
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -1,7 +1,7 @@
 | 
				
			|||||||
[package]
 | 
					[package]
 | 
				
			||||||
name = "hello_remote_world"
 | 
					name = "hello_remote_world"
 | 
				
			||||||
version = "0.1.0"
 | 
					version = "0.1.0"
 | 
				
			||||||
authors = ["VS Code <vscode@microsoft.com>"]
 | 
					edition = "2021"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[lib]
 | 
					[lib]
 | 
				
			||||||
path ="./src/lib/lib.rs"
 | 
					path ="./src/lib/lib.rs"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,4 @@
 | 
				
			|||||||
# base
 | 
					# Rust
 | 
				
			||||||
 | 
					 | 
				
			||||||
Rust 基础开发环境镜像模板项目
 | 
					Rust 基础开发环境镜像模板项目
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Rust 项目工程模板
 | 
					Rust 项目工程模板
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										41
									
								
								SECURITY.md
									
									
									
									
									
								
							
							
						
						
									
										41
									
								
								SECURITY.md
									
									
									
									
									
								
							@@ -1,41 +0,0 @@
 | 
				
			|||||||
<!-- BEGIN MICROSOFT SECURITY.MD V0.0.8 BLOCK -->
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
## Security
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/).
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/opensource/security/definition), please report it to us as described below.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
## Reporting Security Issues
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
**Please do not report security vulnerabilities through public GitHub issues.**
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/opensource/security/create-report).
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com).  If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/opensource/security/pgpkey).
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://aka.ms/opensource/security/msrc). 
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  * Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
 | 
					 | 
				
			||||||
  * Full paths of source file(s) related to the manifestation of the issue
 | 
					 | 
				
			||||||
  * The location of the affected source code (tag/branch/commit or direct URL)
 | 
					 | 
				
			||||||
  * Any special configuration required to reproduce the issue
 | 
					 | 
				
			||||||
  * Step-by-step instructions to reproduce the issue
 | 
					 | 
				
			||||||
  * Proof-of-concept or exploit code (if possible)
 | 
					 | 
				
			||||||
  * Impact of the issue, including how an attacker might exploit the issue
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
This information will help us triage your report more quickly.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/opensource/security/bounty) page for more details about our active programs.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
## Preferred Languages
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
We prefer all communications to be in English.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
## Policy
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/opensource/security/cvd).
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
<!-- END MICROSOFT SECURITY.MD BLOCK -->
 | 
					 | 
				
			||||||
		Reference in New Issue
	
	Block a user