Initial commit
This commit is contained in:
149
BUILD.md
Normal file
149
BUILD.md
Normal file
@@ -0,0 +1,149 @@
|
||||
# Build Instructions
|
||||
|
||||
## Python
|
||||
|
||||
### Development
|
||||
```powershell
|
||||
cd python
|
||||
uv sync
|
||||
uv pip install -e .
|
||||
```
|
||||
|
||||
### Build Standalone Binary
|
||||
```powershell
|
||||
cd python
|
||||
python embed_assets.py # Embeds licenses and .gitignore into main.py
|
||||
uv add pyinstaller
|
||||
uv run pyinstaller --onefile --name gitreposetup main.py
|
||||
# Binary: dist/gitreposetup.exe
|
||||
```
|
||||
|
||||
### Run Tests
|
||||
```powershell
|
||||
cd python
|
||||
uv run pytest -v
|
||||
uv run mypy main.py
|
||||
uv run ruff check .
|
||||
```
|
||||
|
||||
## Rust
|
||||
|
||||
### Development
|
||||
```powershell
|
||||
cd rust
|
||||
cargo build
|
||||
```
|
||||
|
||||
### Build Release Binary
|
||||
```powershell
|
||||
cd rust
|
||||
cargo build --release
|
||||
# Binary: target/release/gitreposetup.exe
|
||||
```
|
||||
|
||||
### Run Tests
|
||||
```powershell
|
||||
cd rust
|
||||
cargo test
|
||||
cargo clippy -- -D warnings
|
||||
cargo fmt --check
|
||||
```
|
||||
|
||||
## Go
|
||||
|
||||
### Development
|
||||
```powershell
|
||||
cd go
|
||||
go build -o gitreposetup.exe .
|
||||
```
|
||||
|
||||
### Build Release Binaries (Cross-platform)
|
||||
```powershell
|
||||
cd go
|
||||
|
||||
# Windows
|
||||
$env:CGO_ENABLED="0"; $env:GOOS="windows"; $env:GOARCH="amd64"; go build -o gitreposetup-windows-amd64.exe .
|
||||
|
||||
# Linux
|
||||
$env:CGO_ENABLED="0"; $env:GOOS="linux"; $env:GOARCH="amd64"; go build -o gitreposetup-linux-amd64 .
|
||||
|
||||
# macOS Intel
|
||||
$env:CGO_ENABLED="0"; $env:GOOS="darwin"; $env:GOARCH="amd64"; go build -o gitreposetup-darwin-amd64 .
|
||||
|
||||
# macOS ARM
|
||||
$env:CGO_ENABLED="0"; $env:GOOS="darwin"; $env:GOARCH="arm64"; go build -o gitreposetup-darwin-arm64 .
|
||||
```
|
||||
|
||||
### Run Tests
|
||||
```powershell
|
||||
cd go
|
||||
go test -v ./...
|
||||
go vet ./...
|
||||
go fmt ./...
|
||||
```
|
||||
|
||||
## Quick Test
|
||||
|
||||
After building any version, test with:
|
||||
|
||||
```powershell
|
||||
# Create a temp directory
|
||||
mkdir test-repo
|
||||
cd test-repo
|
||||
|
||||
# Run the tool
|
||||
..\python\dist\gitreposetup.exe --owner TestOrg --name TestRepo --license MIT
|
||||
# Or
|
||||
..\rust\target\release\gitreposetup.exe --owner TestOrg --name TestRepo --license MIT
|
||||
# Or
|
||||
..\go\gitreposetup.exe --owner TestOrg --name TestRepo --license MIT
|
||||
|
||||
# Verify
|
||||
git remote -v
|
||||
git log --oneline
|
||||
git branch -a
|
||||
cat LICENSE
|
||||
```
|
||||
|
||||
## CI/CD Integration
|
||||
|
||||
The tools are designed to work in CI environments. Example Gitea workflow:
|
||||
|
||||
```yaml
|
||||
- name: Setup repository
|
||||
run: |
|
||||
gitreposetup \
|
||||
--owner ${{ github.repository_owner }} \
|
||||
--name ${{ github.event.repository.name }} \
|
||||
--deploy-type docker
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Python: ModuleNotFoundError: No module named 'yaml'
|
||||
```powershell
|
||||
uv add pyyaml
|
||||
```
|
||||
|
||||
### Rust: error: linker `link.exe` not found
|
||||
Install Visual Studio Build Tools with C++ development tools.
|
||||
|
||||
### Go: imports not found
|
||||
```powershell
|
||||
cd go
|
||||
go mod tidy
|
||||
go mod download
|
||||
```
|
||||
|
||||
### Git push fails
|
||||
This is expected if the remote doesn't exist yet. The tool will warn and configure locally. Create the remote repository in Gitea/GitHub first, then:
|
||||
```powershell
|
||||
git push -u origin main
|
||||
git push -u origin dev
|
||||
```
|
||||
|
||||
### Config file location
|
||||
- Windows: `%USERPROFILE%\.config\GMS\.config.yaml`
|
||||
- Linux/macOS: `~/.config/GMS/.config.yaml`
|
||||
|
||||
Edit manually or let the tool create defaults on first run.
|
||||
Reference in New Issue
Block a user