Files
WorldTeacher/BUILD.md
2025-11-04 15:28:26 +01:00

2.8 KiB

Build Instructions

Python

Development

cd python
uv sync
uv pip install -e .

Build Standalone Binary

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

cd python
uv run pytest -v
uv run mypy main.py
uv run ruff check .

Rust

Development

cd rust
cargo build

Build Release Binary

cd rust
cargo build --release
# Binary: target/release/gitreposetup.exe

Run Tests

cd rust
cargo test
cargo clippy -- -D warnings
cargo fmt --check

Go

Development

cd go
go build -o gitreposetup.exe .

Build Release Binaries (Cross-platform)

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

cd go
go test -v ./...
go vet ./...
go fmt ./...

Quick Test

After building any version, test with:

# 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:

- name: Setup repository
  run: |
    gitreposetup \
      --owner ${{ github.repository_owner }} \
      --name ${{ github.event.repository.name }} \
      --deploy-type docker

Troubleshooting

Python: ModuleNotFoundError: No module named 'yaml'

uv add pyyaml

Rust: error: linker link.exe not found

Install Visual Studio Build Tools with C++ development tools.

Go: imports not found

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:

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.