Skip to content

Commit

Permalink
TG-1096 Maintenance - Refresh react-continuous-delivery with Content …
Browse files Browse the repository at this point in the history
…from nextjs-continuous-delivery (#32)

* TG-1101 Replace repo contents

* TG-1102 Update readme files

* Improve gitignore

* Fix readme clone link

* TG-1096 Restore github ci workflows

* Improve readme commands

* Remove docker image workflow

* Fix and restore github workflows

* Remove libpd-dev from bootstrap Dockerfile

* Update LICENSE year

* Improve Makefile

* Fix minors EOF

* Upgrade remote.Dockerfile to node 18

---------

Co-authored-by: Luca <[email protected]>
Co-authored-by: Matteo Vitali <[email protected]>
  • Loading branch information
3 people authored Jan 23, 2024
1 parent f08ac84 commit ac397a7
Show file tree
Hide file tree
Showing 166 changed files with 13,528 additions and 5,940 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/publish-docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Publish Docker image

on:
release:
types: [published]

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: 20tab/talos-nextjs-light
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }},20tab/talos-nextjs-light:latest
labels: ${{ steps.meta.outputs.labels }}
31 changes: 31 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python application

on:
push:
branches: [master]
pull_request:
branches: [master]

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools
python -m pip install -r requirements/test.txt
- name: Run Test
run: |
python3 -m unittest
138 changes: 131 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,107 @@ __pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
Expand All @@ -17,33 +115,59 @@ ENV/
env.bak/
venv.bak/

# Terraform
.terraform.lock*
.terraform/
*.tfstate*
terraform.tfvars

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# END https://github.com/github/gitignore/blob/master/Python.gitignore

# JetBrains
.idea/
# START local

# Eclipse / Kate
*.swp
frontend/

# SublimeText
*.sublime-project
*.sublime-workspace
# JetBrains
.idea/

# Vim
[._]*.un~

# VisualStudioCode
.devcontainer/
.vscode/

# macOS
.DS_Store

# requirements
*/requirements/*.txt

# Ruff
.ruff_cache

# END local
25 changes: 25 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM python:3.12-slim-bookworm

ARG DEBIAN_FRONTEND=noninteractive
ARG OUTPUT_BASE_DIR=/data
ENV OUTPUT_BASE_DIR=${OUTPUT_BASE_DIR}
WORKDIR /app
RUN apt-get update \
&& apt-get install --assume-yes --no-install-recommends \
curl \
git \
gnupg \
software-properties-common \
&& curl https://apt.releases.hashicorp.com/gpg | gpg --dearmor > /usr/share/keyrings/hashicorp-archive-keyring.gpg \
&& gpg --no-default-keyring --keyring /usr/share/keyrings/hashicorp-archive-keyring.gpg --fingerprint \
&& echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/hashicorp.list \
&& apt-get update \
&& apt-get install --assume-yes --no-install-recommends \
terraform \
&& rm -rf /var/lib/apt/lists/*
COPY ./requirements/common.txt requirements/common.txt
RUN python3 -m pip install --no-cache-dir --upgrade pip setuptools \
&& python3 -m pip install --no-cache-dir -r requirements/common.txt
COPY . .
RUN mkdir ${OUTPUT_BASE_DIR}
ENTRYPOINT [ "python", "/app/start.py" ]
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# The MIT License (MIT)

Copyright (c) 2014-2019 20tab srl
Copyright (c) 2014-2024 20tab srl

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
Expand Down
60 changes: 60 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
.DEFAULT_GOAL := help

.PHONY: check
check: ## Check code formatting and import sorting
python3 -m black --check .
python3 -m ruff check .

.PHONY: fix
fix: ## Fix code formatting, linting and sorting imports
python3 -m black .
python3 -m ruff --fix .

.PHONY: local
local: pip_update ## Install local requirements and dependencies
python3 -m piptools sync requirements/local.txt

.PHONY: outdated
outdated: ## Check outdated requirements and dependencies
python3 -m pip list --outdated

.PHONY: pip
pip: pip_update ## Compile requirements
python3 -m piptools compile --generate-hashes --no-header --quiet --resolver=backtracking --strip-extras --upgrade --output-file requirements/common.txt requirements/common.in
python3 -m piptools compile --generate-hashes --no-header --quiet --resolver=backtracking --strip-extras --upgrade --output-file requirements/local.txt requirements/local.in
python3 -m piptools compile --generate-hashes --no-header --quiet --resolver=backtracking --strip-extras --upgrade --output-file requirements/test.txt requirements/test.in

.PHONY: pip_update
pip_update: ## Update requirements and dependencies
python3 -m pip install --quiet --upgrade pip~=23.3.0 pip-tools~=7.3.0 setuptools~=69.0.0 wheel~=0.42.0

.PHONY: precommit
precommit: ## Fix code formatting, linting and sorting imports
python3 -m pre_commit run --all-files

.PHONY: precommit_update
precommit_update: ## Update pre_commit
python3 -m pre_commit autoupdate

ifeq (simpletest,$(firstword $(MAKECMDGOALS)))
simpletestargs := $(wordlist 2, $(words $(MAKECMDGOALS)), $(MAKECMDGOALS))
$(eval $(simpletestargs):;@true)
endif

.PHONY: simpletest
simpletest: ## Run debug tests
python3 -m unittest $(simpletestargs)

.PHONY: test
test: ## Run full test and coverage
python3 -m coverage run -m unittest
python3 -m coverage html
python3 -m coverage report

.PHONY: update
update: pip precommit_update ## Run update

.PHONY: help
help:
@echo "[Help] Makefile list commands:"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
Loading

0 comments on commit ac397a7

Please sign in to comment.