Last active
March 27, 2026 15:04
-
-
Save lejonmanen/25840cf05769e8ae523bf3a5f9d843c0 to your computer and use it in GitHub Desktop.
Exempel på YAML för Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Python CI/CD | |
| # Talar om när jobben ska köras. Denna inställning bevakar när man gör push eller pull request mot branchen "main". | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| jobs: | |
| build-and-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # 1. Hämta koden | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| # 2. Installera Python | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.14" | |
| # 3. Installera beroenden | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| pip install flake8 pytest | |
| # 4. Linting | |
| - name: Lint code with flake8 | |
| run: | | |
| flake8 src tests | |
| # 5. Kör tester | |
| - name: Run tests with pytest | |
| run: | | |
| pytest --maxfail=1 --disable-warnings -q | |
| # För CD behöver man ett jobb "deploy" som publicerar en ny version av appen, så den kan användas. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment