airboardgame/.circleci/config.yml
Jeremie Pardou-Piquemal 6fa3dd056d Use redirects
2021-02-13 14:14:17 +01:00

82 lines
2.7 KiB
YAML

version: 2.1
orbs:
node: circleci/node@1.1.6
cypress: cypress-io/cypress@1.25.0
jobs:
lint-and-build:
executor:
name: node/default
environment:
NETLIFY_SITE_ID: airboardgame.netlify.app
REACT_APP_SOCKET_URL: https://public.jeremiez.net/
REACT_APP_SOCKET_PATH: /wamp2/socket.io
REACT_APP_GAMELIST_URL: https://airgames.netlify.app/gameList.json
# REACT_APP_API_ENDPOINT: https://public.jeremiez.net/ricochet
REACT_APP_API_ENDPOINT: /api
CYPRESS_INSTALL_BINARY: 0
steps:
- checkout
- node/with-cache:
steps:
- run: node --version
- run: npm install
- run: npm run lint
- run: cd backend && npm install && npm run build
- run: npm run build
- run: |
cat \<<EOF > ./build/_redirects
/api/* https://public.jeremiez.net/ricochet/:splat 200
/* /index.html 200
EOF
- run:
name: Netlify Deploy
command: npx netlify deploy --dir=./build --site $NETLIFY_SITE_ID --auth $NETLIFY_ACCESS_TOKEN
build-deploy:
executor:
name: node/default
environment:
NETLIFY_SITE_ID: airboardgame.netlify.app
REACT_APP_SOCKET_URL: https://public.jeremiez.net/
REACT_APP_SOCKET_PATH: /wamp2/socket.io
REACT_APP_GAMELIST_URL: https://airgames.netlify.app/gameList.json
# REACT_APP_API_ENDPOINT: https://public.jeremiez.net/ricochet
REACT_APP_API_ENDPOINT: /api
steps:
- checkout
- node/with-cache:
steps:
- run: npm install
- run: npm run lint
- run: cd backend && npm install && npm run build
- run: npm run build
- run: |
cat \<<EOF > ./build/_redirects
/api/* https://public.jeremiez.net/ricochet/:splat 200
/* /index.html 200
EOF
- run:
name: Netlify Deploy
command: npx netlify deploy --site $NETLIFY_SITE_ID --auth $NETLIFY_ACCESS_TOKEN --dir=build --prod
workflows:
e2etest:
jobs:
- cypress/run:
start: REACT_APP_NO_WELCOME=1 REACT_APP_SOCKET_URL=https://public.jeremiez.net/ REACT_APP_SOCKET_PATH=/wamp2/socket.io REACT_APP_API_ENDPOINT=https://public.jeremiez.net/ricochet CI=true npm start
wait-on: "http-get://localhost:3000"
no-workspace: true
store_artifacts: true
build-and-test:
jobs:
- lint-and-build:
filters:
branches:
ignore:
- master
- build-deploy:
filters:
branches:
only:
- master