Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

Commit

Permalink
Merge pull request #323 from AtomLinter/arcanemagus/circleci-2.0
Browse files Browse the repository at this point in the history
Upgrade to CircleCI 2.0
  • Loading branch information
Arcanemagus committed Aug 27, 2018
2 parents 194665a + 58b6470 commit 11fadb6
Show file tree
Hide file tree
Showing 2 changed files with 157 additions and 20 deletions.
157 changes: 157 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
version: 2

defaults: &defaults
working_directory: /tmp/project
docker:
- image: arcanemagus/atom-docker-ci:stable
environment:
COMPOSER_TOKEN: "cc4a091c096e7d3cfe053c3f669fb840be60ab98"
COMPOSER_DISABLE_XDEBUG_WARN: 1
PHPCS_VER: "*"
steps:
# Restore project state
- attach_workspace:
at: /tmp
# Restore Composer cache
- restore_cache:
keys:
# Get latest cache for the current specs
- v1-composer-{{ arch }}-{{ checksum ".circleci/config.yml" }}
# Fallback to the last available cache
- v1-composer-{{ arch }}
- run:
name: Install PHP
# PHP requires tzdata, which requires configuring and pauses for input
# unless you do the mess below...
command: |
sudo apt-get update && \
echo '#!/bin/bash' > /tmp/php.sh && \
echo 'export DEBIAN_FRONTEND=noninteractive' >> /tmp/php.sh && \
echo 'apt-get install --assume-yes --quiet --no-install-suggests --no-install-recommends php-cli' >> /tmp/php.sh && \
sudo bash /tmp/php.sh && \
rm /tmp/php.sh
- run:
name: PHP version
command: php --version
- run:
name: Install Composer dependencies
command: |
sudo apt-get install --assume-yes --quiet --no-install-suggests \
--no-install-recommends curl php-mbstring php-xml git unzip
- run:
name: Install Composer
command: |
curl -sS https://getcomposer.org/installer -o composer-setup.php && \
mkdir --parent /home/atom/bin && \
php composer-setup.php --install-dir=/home/atom/bin --filename=composer && \
echo 'export PATH="/home/atom/bin:$PATH"' >> $BASH_ENV && \
echo 'export PATH="/home/atom/.composer/vendor/bin:$PATH"' >> $BASH_ENV
- run:
name: Configure Composer token
command: composer config -g github-oauth.github.com "${COMPOSER_TOKEN}"
- run:
name: Composer version
command: composer --version
- run:
name: Install PHP_CodeSniffer
command: composer global require "squizlabs/php_codesniffer ${PHPCS_VER}"
- run:
name: PHP_CodeSniffer version
command: phpcs --version
- run:
name: Create VFB for Atom to run in
command: /usr/local/bin/xvfb_start
- run:
name: Atom version
command: ${ATOM_SCRIPT_PATH} --version
- run:
name: APM version
command: ${APM_SCRIPT_PATH} --version
- run:
name: Cleaning package
command: ${APM_SCRIPT_PATH} clean
- run:
name: Package APM package dependencies
command: |
if [ -n "${APM_TEST_PACKAGES}" ]; then
for pack in ${APM_TEST_PACKAGES}; do
${APM_SCRIPT_PATH} install "${pack}"
done
fi;
- run:
name: Package dependencies
command: ${APM_SCRIPT_PATH} install
- run:
name: Package specs
command: ${ATOM_SCRIPT_PATH} --test spec
# Cache node_modules
- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}
# Cache Composer
- save_cache:
paths:
- "~/.composer"
key: v1-composer-{{ arch }}-{{ checksum ".circleci/config.yml" }}

jobs:
checkout_code:
<<: *defaults
docker:
- image: circleci/node:latest
steps:
- checkout
# Restore node_modules from the last build
- restore_cache:
keys:
# Get latest cache for this package.json
- v1-dependencies-{{ checksum "package.json" }}
# Fallback to the last available cache
- v1-dependencies
# Save project state for next steps
- persist_to_workspace:
root: /tmp
paths:
- project
lint:
<<: *defaults
docker:
- image: circleci/node:latest
steps:
# Restore project state
- attach_workspace:
at: /tmp
- run:
name: Node.js Version
command: node --version
- run:
name: NPM Version
command: npm --version
- run:
name: Install any remaining dependencies
command: npm ci
- run:
name: Lint code
command: npm run lint
stable:
<<: *defaults
beta:
<<: *defaults
docker:
- image: arcanemagus/atom-docker-ci:beta

workflows:
version: 2
test_package:
jobs:
- checkout_code
- lint:
requires:
- checkout_code
- stable:
requires:
- lint
- beta:
requires:
- lint
20 changes: 0 additions & 20 deletions circle.yml

This file was deleted.

0 comments on commit 11fadb6

Please sign in to comment.