Skip to content

Commit

Permalink
feat: ci/cd config
Browse files Browse the repository at this point in the history
  • Loading branch information
avlyalin committed May 29, 2020
1 parent bb09b85 commit 88fcfeb
Show file tree
Hide file tree
Showing 6 changed files with 124 additions and 8 deletions.
3 changes: 0 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,3 @@ FIREBASE_PROJECT_ID=
FIREBASE_STORAGE_BUCKET=
FIREBASE_MESSAGING_SENDER_ID=
FIREBASE_APP_ID=
DB_SESSIONS_REF=sessions
DB_USERS_REF=sessions_users
DB_CARDS_REF=sessions_cards
76 changes: 76 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: CD
on:
create:
tags:
- v*
jobs:
build-and-test:
runs-on: windows-latest
steps:
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: '12.x'

- name: Checkout
uses: actions/checkout@v2
with:
persist-credentials: false

- run: npm ci

- run: npm run build
env:
FIREBASE_API_KEY: ${{ secrets.FIREBASE_API_KEY }}
FIREBASE_AUTH_DOMAIN: ${{ secrets.FIREBASE_AUTH_DOMAIN }}
FIREBASE_DATABASE_URL: ${{ secrets.FIREBASE_DATABASE_URL }}
FIREBASE_PROJECT_ID: ${{ secrets.FIREBASE_PROJECT_ID }}
FIREBASE_STORAGE_BUCKET: ${{ secrets.FIREBASE_STORAGE_BUCKET }}
FIREBASE_MESSAGING_SENDER_ID: ${{ secrets.FIREBASE_MESSAGING_SENDER_ID }}
FIREBASE_APP_ID: ${{ secrets.FIREBASE_APP_ID }}

# - name: Run tests
# run: npm run test
#
# - name: Run visual regression tests
# run: npm run test:integration
#
# - name: Upload screenshots diffs
# uses: actions/upload-artifact@v2
# if: always()
# with:
# name: screenshots
# path: src/**/__diff_output__

- name: Upload build
uses: actions/upload-artifact@v2
with:
name: build
path: public

deploy:
needs: [build-and-test]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
persist-credentials: false

- run: ls -la && ls -la ./public

- name: Download Artifacts
uses: actions/download-artifact@v2
with:
name: build
path: public

- run: ls -la && ls -la ./public

- name: Deploy
uses: JamesIves/github-pages-deploy-action@releases/v3
with:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
BRANCH: gh-pages
FOLDER: public
CLEAN: true
43 changes: 43 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: CI
on:
push:
branches-ignore:
- gh-pages
jobs:
build-and-test:
runs-on: windows-latest
steps:
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: '12.x'

- name: Checkout
uses: actions/checkout@v2
with:
persist-credentials: false

- run: npm ci

- run: npm run build
env:
FIREBASE_API_KEY: ${{ secrets.FIREBASE_API_KEY }}
FIREBASE_AUTH_DOMAIN: ${{ secrets.FIREBASE_AUTH_DOMAIN }}
FIREBASE_DATABASE_URL: ${{ secrets.FIREBASE_DATABASE_URL }}
FIREBASE_PROJECT_ID: ${{ secrets.FIREBASE_PROJECT_ID }}
FIREBASE_STORAGE_BUCKET: ${{ secrets.FIREBASE_STORAGE_BUCKET }}
FIREBASE_MESSAGING_SENDER_ID: ${{ secrets.FIREBASE_MESSAGING_SENDER_ID }}
FIREBASE_APP_ID: ${{ secrets.FIREBASE_APP_ID }}

- name: Run tests
run: npm run test

- name: Run visual regression tests
run: npm run test:integration

- name: Upload screenshots diffs
uses: actions/upload-artifact@v2
if: always()
with:
name: screenshots
path: src/**/__diff_output__
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"jest:integration": "jest --config ./jest/jest.config.integration.js",
"test:integration": "start-server-and-test storybook:test http-get://localhost:9009 jest:integration",
"test:all": "run-p test test:integration",
"storybook:test": "start-storybook --ci -p 9009",
"storybook:test": "start-storybook --ci -p 9009 --quiet",
"storybook": "start-storybook -p 9010",
"prettier:staged": "prettier --write",
"eslint:staged": "eslint --fix",
Expand Down
6 changes: 3 additions & 3 deletions src/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ firebase.initializeApp({
});
const database = firebase.database();

const DB_SESSIONS_REF = process.env.DB_SESSIONS_REF;
const DB_USERS_REF = process.env.DB_USERS_REF;
const DB_CARDS_REF = process.env.DB_CARDS_REF;
const DB_SESSIONS_REF = 'sessions';
const DB_USERS_REF = 'sessions_users';
const DB_CARDS_REF = 'sessions_cards';

/**
* Инициализация игровой сессии
Expand Down
2 changes: 1 addition & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const isDev = process.env.NODE_ENV !== 'production';
const isAnalysis = process.env.NODE_ENV === 'analysis';

const plugins = [
new Dotenv(),
new Dotenv({ systemvars: true }),
new HtmlWebpackPlugin({ template: './assets/index.html' }),
new MiniCssExtractPlugin({
filename: '[name].[hash].css',
Expand Down

0 comments on commit 88fcfeb

Please sign in to comment.