Skip to content

Commit

Permalink
chore: CI/CD setup
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelcamargo committed Apr 24, 2022
1 parent 4fa4ecc commit bec3f08
Show file tree
Hide file tree
Showing 6 changed files with 34,432 additions and 8,431 deletions.
111 changes: 111 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
version: 2.1

orbs:
coveralls: coveralls/coveralls@1.0.6

defaults: &defaults
docker:
- image: cimg/node:16.13.1-browsers
working_directory: ~/qiaroq-vue

jobs:
install:
<<: *defaults

steps:
- checkout
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package-lock.json" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- run:
name: Install
command: npm install
- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package-lock.json" }}
- persist_to_workspace:
root: "."
paths:
- "package.json"
- "package-lock.json"
- "project.json"
- "jest.*.js"
- "webpack.*.js"
- ".babelrc"
- ".eslintrc"
- ".firebaserc"
- "firebase.json"
- "node_modules"
- ".git/*"
- ".circleci/*"
- "src/*"

format:
<<: *defaults

steps:
- attach_workspace:
at: ~/qiaroq-vue
- run:
name: Format
command: npm run format

build:
<<: *defaults

steps:
- attach_workspace:
at: ~/qiaroq-vue
- run:
name: Build
command: NODE_ENV=production npm run build
- persist_to_workspace:
root: "."
paths:
- "dist/*"

test:
<<: *defaults

steps:
- attach_workspace:
at: ~/qiaroq-vue
- run:
name: Test
command: npm run test -- --maxWorkers=2 --coverage --coverageReporters=lcov
- coveralls/upload:
verbose: true

deploy:
<<: *defaults

steps:
- attach_workspace:
at: ~/qiaroq-vue
- run:
name: Deploy
command: ./.circleci/deploy.sh

workflows:
version: 2

branch-workflow:
jobs:
- install
- format:
requires:
- install
- build:
requires:
- install
- test:
requires:
- install
- deploy:
requires:
- format
- build
- test
9 changes: 9 additions & 0 deletions .circleci/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh

branch=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p')

if [ "$branch" = "master" ]; then
npm run deploy -- --token=$FIREBASE_TOKEN
else
echo "skipped"
fi
5 changes: 5 additions & 0 deletions .firebaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"projects": {
"default": "qiaroq-vue"
}
}
7 changes: 7 additions & 0 deletions firebase.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"hosting": {
"public": "dist",
"cleanUrls": true,
"trailingSlash": false
}
}

0 comments on commit bec3f08

Please sign in to comment.