This is a project scaffold for Python Project with Continuous Intregation.
-
Configure ssh key in your enviroment (AWS, GCP, Azure) shell:
- generate ssh key with
ssh-keygen -t rsa
andenter
enter
enter
- print the public key
cat path/to/public/key
and copy it - go to github.com -> setting -> ssh -> add ssh key -> paste your public key -> save it
- generate ssh key with
-
Configure git name and email
- git config --global user.name "name"
- git config --global user.email "email@email.com"
-
Create a Python virtual enviroment:
- Go to your home
cd ~/
- Crete the virtual enviroment with
python3 -m venv ~/.<YOUR_REPO_NAME>
- Activate the virtual enviroment with
source .<YOUR_REPO_NAME/bin/activate
- Go to your home
-
Create a github repository with name, description, add readme, add .gitignore for python project
-
Go to the new repository page, click Code, click SSH and copy the SSH url
-
In your enviroment shell, clone the repository locally with
git clone <PASTE_SSH_URL>
-
Create Makefile with build instructions:
touch Makefile
and write it (look at this Makefile for inspiration) -
Create requirements.txt:
touch requirements.txt
and write it (look at this requirements.txt for inspiration) -
Write your python code: *.py files
-
Write tests for your code: test_*.py
-
Run your Makefile instruction locally:
make [Makefilecommand]
(for examplemake all
) -
Save and publish your work:
git add .*
,git commit -m "message"
andgit push
- In the repository page, go to Actions
- Click on New workflow
- write the workflow as this main.yml
- Commit your changes
- Your should see the Action running in the Actions page.
- Optionally, to see the status of the action in your repository first page: add a badge to the README.md file by going to your repository's Actions page, select your workflow in the left side, click in the three dots in the right side, select Create status badge and copy the text. Then edit the README.md, paste the text there and commit changes.