51 lines
1.1 KiB
YAML
51 lines
1.1 KiB
YAML
when:
|
|
event: [ push ]
|
|
|
|
steps:
|
|
- name: clone
|
|
image: alpine/git
|
|
commands:
|
|
- git clone ${CI_REPO_CLONE_URL} .
|
|
|
|
- name: run-tests
|
|
image: python:3.11
|
|
commands:
|
|
- pip install pytest
|
|
- pytest
|
|
|
|
- name: sonar-scan
|
|
image: sonarsource/sonar-scanner-cli
|
|
environment:
|
|
SONAR_TOKEN:
|
|
from_secret: SONAR_TOKEN
|
|
SONAR_URL:
|
|
from_secret: SONAR_URL
|
|
commands:
|
|
- >
|
|
sonar-scanner
|
|
-Dsonar.login=$SONAR_TOKEN
|
|
-Dsonar.host.url=$SONAR_URL
|
|
-Dsonar.projectKey=dummy-app
|
|
-Dsonar.sources=.
|
|
|
|
- name: notify
|
|
image: curlimages/curl
|
|
environment:
|
|
WEBHOOK_URL:
|
|
from_secret: WEBHOOK_URL
|
|
commands:
|
|
- >
|
|
echo "Build completed: $CI_COMMIT_SHA" |
|
|
curl -X POST -H "Content-Type: text/plain" $WEBHOOK_URL
|
|
|
|
- name: push-to-github
|
|
image: alpine/git
|
|
environment:
|
|
GITHUB_TOKEN:
|
|
from_secret: GITHUB_TOKEN
|
|
when:
|
|
status: [ success ]
|
|
commands:
|
|
- git remote add github https://$GITHUB_TOKEN@github.com/Magiciian/dummy-app.git
|
|
- git push github HEAD:main
|