This workshop, through a Python project, seeks to show how a CI/CD pipeline can be implemented using GitLab CI/CD.
- Have a GitHub account.
- Have a project on GitHub.
- Have Git installed.
- To get started, fork this repository into your GitLab account.
If you have forked before, you can update your repository as follows:
git remote add upstream https://<repositorio-workshop>/training_cicd.git git fetch upstream git pull upstream master
- The next step is to clone or update your repository on your local machine. To do this, run the following commands in your terminal:
- Clone repository:
git clone https://<your-repository>/training_cicd.git cd workshop-cicd
- Or update repository:
git fetch origin git pull origin main
- Clone repository:
- Open the project in GitHub
- Click on 'Actions' in the top menu.
- Click on 'Configure' that appears in the selection.
- Edit the line shown in this image and remove "3.8 and 3.9" (you don't need to check this code in 3 different versions of python with 3.10 is enough)
- Press the "commit" button
- Click on 'Actions' in the top menu again and if everything Works right you will see:
- Open file .github/workflows/pylint.yml
- Modify the following part to install pytest and coverage
run: | python -m pip install --upgrade pip pip install pylint pytest coverage
- Add new step by adding this line at the bottom of the file
- name: Test with pytest run: | pytest test.py coverage run -m pytest test.py coverage report
-
Configure "Build":
- name: Install pypa/build run: >- python3 -m pip install build --user - name: Build a binary wheel and a source tarball run: python3 -m build - name: Store the distribution packages uses: actions/upload-artifact@v4 with: name: python-package-distributions path: dist/
- add download configuration
- name: "Download python Modules - v4" uses: actions/download-artifact@v4 with: name: python-package-distributions path: dist/