Upgrade to Pro — share decks privately, control downloads, hide ads and more …

CircleCI の歩き方 / CircleCI #phpstudy

CircleCI の歩き方 / CircleCI #phpstudy

第123回PHP勉強会@東京の資料です

TAKAHASHI Kunihiko

February 28, 2018
Tweet

More Decks by TAKAHASHI Kunihiko

Other Decks in Technology

Transcript

  1. DJSDMFDJDPOpHZNM version: 2 jobs: build: docker: - image: circleci/php:7.1-apache-browsers working_directory:

    /var/www/html steps: - checkout - restore_cache: keys: - composer-{{ arch }}—{{ checksum "composer.lock" }} - composer-{{ arch }}— - run: composer install - save_cache: key: composer-{{ arch }}—{{ checksum "composer.lock" }} paths: - ~/.composer/cache - run: ./vendor/bin/phpunit --log-junit ~/phpunit/junit.xml - store_test_results: path: ~/phpunit - store_artifacts: path: ~/phpunit
  2. DJSDMFDJDPOpHZNM version: 2 jobs: build: docker: - image: circleci/php:7.1-apache-browsers working_directory:

    /var/www/html steps: - checkout - restore_cache: keys: - composer-{{ arch }}—{{ checksum "composer.lock" }} - composer-{{ arch }}— - run: composer install - save_cache: key: composer-{{ arch }}—{{ checksum "composer.lock" }} paths: - ~/.composer/cache - run: ./vendor/bin/phpunit --log-junit ~/phpunit/junit.xml - store_test_results: path: ~/phpunit - store_artifacts: path: ~/phpunit
  3. KPCT ✓δϣϒΛઃఆ͢Δ ✓δϣϒ໊ σϑΥϧτ͸CVJME  ✓ޙ΄Ͳग़ͯ͘ΔXPSLqPXͰ࢖༻͢Δ ✓FYFDVUPSΛઃఆ ✓EPDLFS ✓NBDIJOF ಉ༷ͷ7.؀ڥ

     ✓NBDPT ✓XPSLJOH@EJSFDUPSZ ✓࣮ߦσΟϨΫτϦΛࢦఆ͢Δ ✓TUFQTͰࡉ͔͍࣮ߦ಺༰Λઃఆ͢Δ
  4. DJSDMFDJDPOpHZNM version: 2 jobs: build: docker: - image: circleci/php:7.1-apache-browsers working_directory:

    /var/www/html steps: - checkout - restore_cache: keys: - composer-{{ arch }}—{{ checksum "composer.lock" }} - composer-{{ arch }}— - run: composer install - save_cache: key: composer-{{ arch }}—{{ checksum "composer.lock" }} paths: - ~/.composer/cache - run: ./vendor/bin/phpunit --log-junit ~/phpunit/junit.xml - store_test_results: path: ~/phpunit - store_artifacts: path: ~/phpunit
  5. DJSDMFDJDPOpHZNM version: 2 jobs: build: docker: - image: circleci/php:7.1-apache-browsers working_directory:

    /var/www/html steps: - checkout - restore_cache: keys: - composer-{{ arch }}—{{ checksum "composer.lock" }} - composer-{{ arch }}— - run: composer install - save_cache: key: composer-{{ arch }}—{{ checksum "composer.lock" }} paths: - ~/.composer/cache - run: ./vendor/bin/phpunit --log-junit ~/phpunit/junit.xml - store_test_results: path: ~/phpunit - store_artifacts: path: ~/phpunit
  6. SVO ✓ίϚϯυΛ࣮ߦ͢Δ΋ͷͩ ͕ɺ࣮ߦը໘Ͱදࣔ͢Δจࣈ ྻΛઃఆͰ͖Δ - run: ./vendor/bin/phpunit --log-junit ~/phpunit/junit.xml -

    run: name: run tests command: ./vendor/bin/phpunit --log-junit ~/phpunit/junit.xml - run: name: run tests command: | ./vendor/bin/phpunit --log-junit ~/phpunit/junit.xml
  7. ෳ਺ͷ%PDLFSΠϝʔδΛ࢖͏ ✓EPDLFSFYFDVUPSͷઃఆͰෳ਺ͷJNBHFΛࢦఆ͢Δ ✓ͭ໨ʹࢦఆͨ͠JNBHF͕ϓϥΠϚϦΠϝʔδʹͳΓɺ TUFQTҎ߱ͷίϚϯυ͸ͦͷΠϝʔδʹର࣮ͯ͠ߦ͞ΕΔ ✓ͦͷଞͷίϯςφͷϓϩηεʹ͸ɺ ϙʔτ൪ ߸ ͰΞΫηεͰ͖Δ version: 2

    jobs: build: docker: - image: php:7.1-apache - image: circleci/mysql:5.7 environment: MYSQL_ROOT_PASSWORD: root MYSQL_DATABASE: test_app MYSQL_USER: test MYSQL_PASSWORD: test - image: redis:3.2
  8. 1SJWBUF3FHJTUSZͷ%PDLFSΠϝʔδΛ࢖͏ ✓ೝূ͕ඞཁͳ৔߹͸͍͔ͭ͘ࢦఆํ๏͕͋Δ ✓"84&$3ͷࢦఆํ๏͕ಛघ ✓&$3͕௨ৗͷEPDLFSMPHJOΛ͢ΔܗͰ͸ͳ͍ͨΊ version: 2 jobs: build: docker: -

    image: private/sample:1.0 auth: username: DOCKER_HUB_USERNAME password: DOCKER_HUB_PASSWORD - image: account-id.dkr.ecr.us-east-1.amazonaws.com/org/repo:0.1 aws_auth: aws_access_key_id: ECS_AWS_ACCESS_KEY aws_secret_access_key: ECS_AWS_SECRET_ACCESS_KEY
  9. DJSDMFDJDPOpHZNM workflows: version: 2 phpcs_test_deploy_workflow: jobs: - phpcs - test:

    requires: - phpcs - deploy filters: branches: only: - master requires: - test cron_workflow: triggers: - schedule: cron: “0 18 * * *” filters: branches: only: - develop jobs: - daily_job