Skip to content

Latest commit

 

History

History
88 lines (61 loc) · 2.28 KB

File metadata and controls

88 lines (61 loc) · 2.28 KB

URL Shortener - GitHub Actions CI/CD Project

https://github.com/markrahimi/url_shortener

About This Project

This project was written before for personal use. Now it is made public to show GitHub Actions CI/CD implementation.

The main goal of this project is to create GitHub Actions workflows for automatic testing, code checking, and deployment.

Project Goals

This project shows how to use GitHub Actions for CI/CD. Here are the requirements:

Run tests on different versions

What I did: I created a workflow that tests the code on multiple Python and Go versions.

  • Tests run on Python 3.9, 3.10, and 3.11
  • Tests run on Go 1.20, 1.21, and 1.22
  • This happens on every commit

Check code quality

What I did: I created automatic code analysis that runs on every commit.

  • Check code style (black, flake8 for Python / gofmt for Go)
  • Find code problems (pylint, go vet, staticcheck)
  • Find secrets in code (gitleaks)
  • Check for security problems (trivy)

Create releases automatically

What I did: I created a workflow that makes releases when I create a tag.

  • Run all tests first
  • If tests pass, create a GitHub Release
  • Generate changelog from git history automatically
  • Upload build files and test reports

Publish documentation

What I did: I created a workflow that publishes documentation to GitHub Pages.

  • Only runs on the main branch
  • Builds documentation with MkDocs
  • Deploys to GitHub Pages automatically

Code Documentation

Full code documentation is in docs/index.md

Project Structure

├── python/              # Python code
│   ├── url_shortener.py
│   ├── test_url_shortener.py
│   └── requirements.txt
├── go/                  # Go code
│   ├── urlshortener.go
│   ├── urlshortener_test.go
│   └── go.mod
├── docs/               # Documentation
│   └── index.md
├── .github/workflows/  # GitHub Actions
│   ├── ci.yml         # Tests and code analysis
│   ├── release.yml    # Automatic releases
│   └── docs.yml       # Documentation deployment
└── README.md

Start

Python

cd python
pip install -r requirements.txt
python -m pytest test_url_shortener.py -v

Go

cd go
go test -v