-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: set up CI with Azure Pipelines (#2767)
- Loading branch information
Showing
20 changed files
with
2,059 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
jobs: | ||
- job: build | ||
pool: | ||
vmImage: 'ubuntu-latest' | ||
steps: | ||
- template: prepare-environment-step.yml | ||
- template: composer-install-step.yml | ||
|
||
- bash: | | ||
yarn global add greenkeeper-lockfile@1 | ||
displayName: 'Install greenkeeper' | ||
# SYSTEM_PULLREQUEST_PULLREQUESTID=$(test "$BUILD_SOURCEBRANCHNAME" != "master" -a "greenkeeper[bot]" = "`git log --format="%an" -n 1`" || echo '') GK_LOCK_YARN_OPTS="--ignore-engines" $(yarn global bin)/greenkeeper-lockfile-update | ||
- bash: | | ||
TRAVIS=true TRAVIS_REPO_SLUG=$BUILD_REPOSITORY_NAME TRAVIS_BRANCH=$SYSTEM_PULLREQUEST_SOURCEBRANCH TRAVIS_PULL_REQUEST=false TRAVIS_JOB_NUMBER=1 GK_LOCK_YARN_OPTS="--ignore-engines" $(yarn global bin)/greenkeeper-lockfile-update | ||
displayName: 'Update yarn lockfile' | ||
- bash: yarn inst | ||
displayName: 'yarn install' | ||
# SYSTEM_PULLREQUEST_PULLREQUESTID=$(test "$BUILD_SOURCEBRANCHNAME" != "master" -a "greenkeeperio-bot" = "`git log --format="%an" -n 1`" || echo '') $(yarn global bin)/greenkeeper-lockfile-upload | ||
- bash: | | ||
TRAVIS=true TRAVIS_REPO_SLUG=$BUILD_REPOSITORY_NAME TRAVIS_BRANCH=$SYSTEM_PULLREQUEST_SOURCEBRANCH TRAVIS_PULL_REQUEST=false TRAVIS_JOB_NUMBER=1 $(yarn global bin)/greenkeeper-lockfile-upload | ||
cat gk-lockfile-git-push.err || true | ||
rm -f gk-lockfile-git-push.err || true | ||
displayName: 'Upload yarn lockfile' | ||
# Update js and css assets eventually | ||
- bash: yarn lint | ||
displayName: 'Check js and vue lint' | ||
- bash: scripts/ci/update-assets.sh | ||
displayName: 'Update assets' | ||
env: | ||
ASSETS_EMAIL: $(ASSETS_EMAIL) | ||
ASSETS_USERNAME: $(ASSETS_EMAIL) | ||
ASSETS_GITHUB_TOKEN: $(ASSETS_GITHUB_TOKEN) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
parameters: | ||
no_dev: 'false' | ||
steps: | ||
- bash: | | ||
sudo composer self-update | ||
composer global require hirak/prestissimo | ||
test "${{ parameters.no_dev }}" == "true" && EXTRA_PARAM = "--no-dev" | ||
composer install --no-interaction --no-suggest --no-progress --ignore-platform-reqs $EXTRA_PARAM | ||
displayName: 'composer install' |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
steps: | ||
- bash: | | ||
docker-compose --version | ||
make docker_build | ||
displayName: Make docker image |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
steps: | ||
- bash: | | ||
echo $BINTRAY_APIKEY | docker login -u $BINTRAY_USER --password-stdin $BINTRAY_DOCKER_URL | ||
make docker_push_bintray | ||
displayName: Publish docker image | ||
env: | ||
BINTRAY_USER: $(BINTRAY_USER) | ||
BINTRAY_APIKEY: $(BINTRAY_APIKEY) | ||
BINTRAY_DOCKER_URL: monicahq-docker-docker.bintray.io |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# database.test.sql file is generated with: | ||
# mysqldump -u homestead -psecret -n --skip-add-drop-table --skip-add-locks --skip-comments monica_test > scripts/database.test.sql | ||
steps: | ||
- bash: | | ||
mysql --protocol=tcp -u root -proot -e "CREATE DATABASE IF NOT EXISTS monica CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;" | ||
mysql -u root -proot monica < scripts/database.test.sql | ||
php artisan migrate --no-interaction -vvv | ||
displayName: 'Prepare db' |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
steps: | ||
- bash: | | ||
sudo update-alternatives --set php /usr/bin/php$(phpVersion) | ||
sudo update-alternatives --set phar /usr/bin/phar$(phpVersion) | ||
sudo update-alternatives --set phpdbg /usr/bin/phpdbg$(phpVersion) | ||
sudo update-alternatives --set php-cgi /usr/bin/php-cgi$(phpVersion) | ||
sudo update-alternatives --set phar.phar /usr/bin/phar.phar$(phpVersion) | ||
php -version | ||
displayName: 'Use PHP version $(phpVersion)' | ||
- bash: | | ||
mkdir -p results/coverage | ||
sed 's/DB_TEST_PASSWORD=/DB_TEST_PASSWORD=root/' scripts/tests/.env.mysql > .env | ||
touch .sentry-release | ||
displayName: Prepare environment |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
steps: | ||
- bash: sudo rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini | ||
displayName: 'Remove xdebug' |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
steps: | ||
- bash: | | ||
export SONAR_COVERAGE=$(ls -m ./results/coverage*.xml | sed 's/ //g' | sed ':a;N;$!ba;s/\n//g') | ||
scripts/tests/runsonar.sh | ||
displayName: 'Run sonar scanner' | ||
env: | ||
SONAR_RESULT: '$(System.DefaultWorkingDirectory)/results/results.xml' | ||
GITHUB_TOKEN: $(GITHUB_TOKEN) | ||
SONAR_TOKEN: $(SONAR_TOKEN) | ||
SONAR_VERSION: $(SONAR_VERSION) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
steps: | ||
- bash: | | ||
php artisan db:seed --no-interaction -vvv | ||
php artisan passport:keys --no-interaction -vvv | ||
displayName: 'Seed database' |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
- job: tests_browser | ||
dependsOn: build | ||
pool: | ||
vmImage: 'ubuntu-latest' | ||
steps: | ||
- template: checkout-step.yml | ||
- template: prepare-environment-step.yml | ||
- template: composer-install-step.yml | ||
- template: prepare-db-step.yml | ||
- template: seed-test-db-step.yml | ||
# - bash: vendor/bin/chromedriver & | ||
# displayName: 'Run selenium chromedriver' | ||
- bash: scripts/tests/start-selenium.sh | ||
displayName: 'Run selenium chromedriver' | ||
- bash: php -S localhost:8000 -t public scripts/tests/server-cc.php & | ||
displayName: 'Run http server' | ||
- bash: until $(nc -z localhost 8000); do sleep 1; done | ||
displayName: 'Wait for http server' | ||
- bash: php artisan dusk --log-junit results/junit/dusk/results3.xml | ||
displayName: 'Run browser tests' | ||
- bash: | | ||
vendor/bin/phpcov merge --clover=results/coverage3.xml results/coverage/ | ||
rm -rf results/coverage | ||
displayName: 'Fix coverage' | ||
- task: PublishPipelineArtifact@0 | ||
inputs: | ||
artifactName: 'results' | ||
targetPath: 'results/junit' |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
steps: | ||
- bash: | | ||
IFS='|' read -r -a TESTS <<< "$TESTSUITES" | ||
TESTSUITE=${TESTS[$SYSTEM_JOBPOSITIONINPHASE-1]} | ||
echo "TestSuite $TESTSUITE" | ||
echo "##vso[task.setvariable variable=TESTSUITE]$TESTSUITE" | ||
displayName: 'Select testsuite' | ||
env: | ||
TESTSUITES: "Api|Feature|Unit-Models|Unit-Services" | ||
|
||
- bash: | | ||
php artisan route:cache | ||
ulimit -S unlimited | ||
phpdbg -dmemory_limit=4G -qrr vendor/bin/phpunit -c phpunit.xml --log-junit ./results/junit/unit/results${SYSTEM_JOBPOSITIONINPHASE}.xml --coverage-clover ./results/coverage${SYSTEM_JOBPOSITIONINPHASE}.xml --testsuite $TESTSUITE | ||
displayName: 'Run unit tests' | ||
|
||
- task: PublishTestResults@2 | ||
displayName: 'Publish Test Results' | ||
inputs: | ||
testResultsFormat: JUnit | ||
testResultsFiles: 'results*.xml' | ||
searchFolder: '$(System.DefaultWorkingDirectory)/results/junit/unit' | ||
mergeTestResults: true | ||
condition: succeededOrFailed() | ||
|
||
#- task: ReportGenerator@4 | ||
# inputs: | ||
# reports: 'results/coverage*.xml' | ||
# targetdir: 'coveragereport' | ||
# reporttypes: 'Cobertura' | ||
# condition: succeededOrFailed() | ||
|
||
#- task: PublishCodeCoverageResults@1 | ||
# displayName: 'Publish code coverage' | ||
# inputs: | ||
# summaryFileLocation: 'coveragereport/*.xml' | ||
# condition: succeededOrFailed() | ||
|
||
- task: PublishPipelineArtifact@0 | ||
inputs: | ||
artifactName: 'results$(System.JobPositionInPhase)' | ||
targetPath: 'results' |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,3 +21,4 @@ monicadump.sql | |
.scannerwork/ | ||
.sentry-release | ||
.phpunit.result.cache | ||
.composer |
This file contains 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
Oops, something went wrong.