Skip to content

Instantly share code, notes, and snippets.

@vandorjw
Forked from keepitsimple/bitbucket-pipelines.yml
Last active August 15, 2022 21:00
Show Gist options
  • Save vandorjw/533f669cf7686de419e63d8377d408ab to your computer and use it in GitHub Desktop.
Save vandorjw/533f669cf7686de419e63d8377d408ab to your computer and use it in GitHub Desktop.
Bitbucket pipeline to sync / copy code commits to GitHub. How to sync Bitbucket repo to GitHub
image: python:3.8
definitions:
services:
docker:
memory: 1024
steps:
- step: &Push-to-GitHub
name: Push code changes to GitHub
image: alpine/git:latest
services:
- docker
caches:
- docker
script:
- git remote add github "[email protected]:[yourname]/[your repo].git"
- git checkout $BITBUCKET_BRANCH
- git pull
- git push github $BITBUCKET_BRANCH
pipelines:
branches:
main:
- step: *Push-to-GitHub
development:
- step: *Push-to-GitHub
- step:
name: Run Unit Tests
caches:
- pip
script:
- pip install -r requirements.txt --prefer-binary
- cd project_dir
- coverage erase
- coverage run --source=. manage.py test --settings=project.settings.test --failfast
- coverage xml
artifacts: # defining the artifacts to be passed to each future step.
- project_dir/coverage
- project_dir/coverage.xml
- step:
name: SonarCloud
caches:
- sonar
script:
- pipe: sonarsource/sonarcloud-scan:VERSION
variables:
SONAR_TOKEN: ${SONAR_TOKEN}
SONAR_SCANNER_OPTS: "-Xmx512m"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment