🤝 Contribution Guide & Workflows
We welcome contributions from the developer community! Follow this guide to set up your GitHub repository fork, configure repository secrets, understand automated CI workflows, and submit pull requests.
Setting Up Your GitHub Repository Fork
To contribute code to TGDCFS, you should create a personal fork of the main repository.
1. Fork the Repository
- Navigate to the main repository at https://github.com/Xyvran/tgdcfs.
- Click the Fork button in the top-right corner to create a copy under your GitHub user account (e.g.,
github.com/your-username/tgdcfs).
2. Clone Your Fork Locally
Clone your fork to your workstation:
git clone https://github.com/your-username/tgdcfs.git
cd tgdcfs
3. Add the Upstream Remote
Configure the original repository as an upstream remote so you can sync changes from master:
git remote add upstream https://github.com/Xyvran/tgdcfs.git
git remote -v
To keep your local master branch up to date:
git checkout master
git fetch upstream
git merge upstream/master
git push origin master
Configuring GitHub Repository Secrets (For Forks)
When running GitHub Actions workflows on your own fork or upstream repository, certain workflows utilize repository secrets:
| Secret Name | Required? | Purpose & Description |
|---|---|---|
DOCKERHUB_USERNAME | Optional | Your Docker Hub account username. Used by docker-preview.yml, docker-publish.yml, and release.yml to log into Docker Hub. |
DOCKERHUB_TOKEN | Optional | Personal access token / write token for Docker Hub. Required alongside DOCKERHUB_USERNAME to push built images to a Docker registry. |
CODECOV_TOKEN | Optional | Token from Codecov used by test.yml to upload test coverage reports. |
How GitHub Actions Behaves on Forks Without Secrets:
- No Secret Errors: Workflows are designed to detect missing registry secrets gracefully.
docker-preview.yml: In a fork or PR withoutDOCKERHUB_TOKEN, the workflow still checks out code, builds both Docker images (tgdcfsandtgdcfs-fe), runs the automated SFTP and Nginx smoke tests, and verifies data directory pinning (TGDCFS_DATA_DIR). It simply skips thedocker loginand imagepushsteps.test.yml: Runs fullpytestsuite,mypytypechecks, andrufflinting. Codecov upload step is skipped or non-blocking ifCODECOV_TOKENis absent.
Contribution Workflow Step-by-Step
Step 1: Create a Feature Branch
Create a new branch off master with a descriptive name:
git checkout master
git pull upstream master
git checkout -b feature/your-feature-name
Step 2: Implement Your Changes
- Write clean, well-typed Python 3.13 code.
- Ensure new features include unit tests in
tests/. - Ensure all docstrings and user-facing features are updated in documentation.
Step 3: Record Changes in CHANGELOG.md
Every pull request that modifies behavior or adds features must update CHANGELOG.md under the [Unreleased] section:
## [Unreleased]
### Added
- Added support for custom upload buffer paths in SFTP configuration.
### Fixed
- Fixed transient timeout issue during large multi-source downloads.
Step 4: Run Tests & Quality Checks
Before committing, verify that all quality checks pass locally:
poetry run pytest
poetry run mypy .
poetry run ruff check .
Step 5: Commit & Push
Commit your changes with concise, standard commit messages (50 chars max for subject line):
git add .
git commit -m "feat(sftp): add support for custom upload buffer path"
git push origin feature/your-feature-name
Step 6: Open a Pull Request
Go to the Xyvran/tgdcfs GitHub Repository and open a Pull Request targeting master.
Deep Dive: GitHub Actions CI/CD Workflows
TGDCFS uses 5 distinct GitHub Actions workflows in .github/workflows/:
1. Test and Coverage (.github/workflows/test.yml)
- Triggers: On every
push(all branches) andpull_requesttargetingmaster. - Steps:
- Sets up Python 3.13 and Poetry.
- Caches Python virtual environments (
.venv). - Runs
mypystatic type analysis (poetry run python -m mypy .). - Runs
ruffcode formatting and linting (poetry run python -m ruff check .). - Runs complete unit test suite with coverage (
poetry run pytest --cov). - Uploads coverage report to Codecov.
2. Docker Preview Builds (.github/workflows/docker-preview.yml)
- Triggers: On
pushto any branch exceptmaster. - Matrix: Builds both
tgdcfs(backend) andtgdcfs-fe(frontend). - Steps:
- Tags preview image with commit hash:
preview-<commit_hash>andpreview. - Uses Docker Buildx with GitHub Actions cache.
- Local Container Verification: Runs container smoke tests:
- For backend: Runs
python scripts/docker_smoke_check.pyand verifiesTGDCFS_DATA_DIRpath pinning with default and unprivileged UIDs (--user 12345). - For frontend: Starts Nginx container and curls
http://127.0.0.1:8080/tgdcfs/.
- For backend: Runs
- Conditional Registry Push: If
DOCKERHUB_TOKENsecret is present, publishes preview tags to Docker Hub.
- Tags preview image with commit hash:
3. Docker Publish on Master (.github/workflows/docker-publish.yml)
- Triggers: Automatically runs via
workflow_runwhenTest and Coverageworkflow successfully completes on branchmaster. - Builds & Pushes: Multi-architecture (
linux/amd64,linux/arm64) images tagged:latestand:<commit_hash>for bothxyvran/tgdcfsandxyvran/tgdcfs-fe.
4. Release Automation (.github/workflows/release.yml)
- Triggers: On push of git tag
vX.Y.Zor when a commit onmasterbumps theversioninpyproject.toml. - Steps:
- Auto-creates git release tag
vX.Y.Zif not already created. - Parses release notes for
[X.Y.Z]fromCHANGELOG.mdusingscripts/changelog.py. - Creates or updates GitHub Release entry.
- Attaches Docker release tags (
X.Y.ZandX.Y) to the published images usingdocker buildx imagetools.
- Auto-creates git release tag
5. GitHub Pages Deployment (.github/workflows/gh-pages.yml)
- Triggers: On push to
master. - Steps: Builds Next.js web application (
tgdcfs-gh-pages/) and deploys static export to GitHub Pages.
Release Process (For Maintainers)
TGDCFS strictly follows Semantic Versioning (SemVer).
When cutting a new release on master:
- Rename
[Unreleased]inCHANGELOG.mdto[X.Y.Z] - YYYY-MM-DDand add a new empty[Unreleased]section above it. - Bump
versioninpyproject.tomltoX.Y.Z. - Commit and push to
master. - Create and push tag
vX.Y.Z:git tag vX.Y.Zgit push origin vX.Y.Z - GitHub Actions
release.ymlwill automatically publish the release notes and build multi-arch Docker tags (xyvran/tgdcfs:X.Y.Zandxyvran/tgdcfs:X.Y).