2020-04-09 11:00:30 +02:00
|
|
|
name: Build, push and deploy Docker image
|
|
|
|
|
|
|
|
on:
|
2020-04-13 15:08:36 +02:00
|
|
|
- push
|
2020-04-09 11:00:30 +02:00
|
|
|
|
|
|
|
# Enables BuildKit
|
|
|
|
env:
|
|
|
|
DOCKER_BUILDKIT: 1
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
|
|
|
|
build-front:
|
|
|
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
2020-04-13 18:15:27 +02:00
|
|
|
|
|
|
|
# Create a slugified value of the branch
|
|
|
|
- uses: rlespinasse/github-slug-action@master
|
|
|
|
|
2020-04-09 11:00:30 +02:00
|
|
|
- name: "Build and push front image"
|
|
|
|
uses: docker/build-push-action@v1
|
|
|
|
with:
|
2020-04-09 11:56:29 +02:00
|
|
|
dockerfile: front/Dockerfile
|
2020-09-18 17:18:50 +02:00
|
|
|
path: ./
|
2020-04-09 11:00:30 +02:00
|
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
repository: thecodingmachine/workadventure-front
|
2020-04-13 18:15:27 +02:00
|
|
|
tags: ${{ env.GITHUB_REF_SLUG }}
|
2020-04-09 11:00:30 +02:00
|
|
|
add_git_labels: true
|
|
|
|
|
|
|
|
build-back:
|
|
|
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
2020-04-13 18:15:27 +02:00
|
|
|
# Create a slugified value of the branch
|
|
|
|
- uses: rlespinasse/github-slug-action@master
|
|
|
|
|
2020-04-09 11:00:30 +02:00
|
|
|
- name: "Build and push back image"
|
|
|
|
uses: docker/build-push-action@v1
|
|
|
|
with:
|
2020-04-09 11:56:29 +02:00
|
|
|
dockerfile: back/Dockerfile
|
2020-09-18 17:18:50 +02:00
|
|
|
path: ./
|
2020-04-09 11:00:30 +02:00
|
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
repository: thecodingmachine/workadventure-back
|
2020-04-13 18:15:27 +02:00
|
|
|
tags: ${{ env.GITHUB_REF_SLUG }}
|
2020-06-01 16:12:48 +02:00
|
|
|
add_git_labels: true
|
|
|
|
|
|
|
|
build-website:
|
|
|
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
|
|
|
# Create a slugified value of the branch
|
|
|
|
- uses: rlespinasse/github-slug-action@master
|
|
|
|
|
|
|
|
- name: "Build and push back image"
|
|
|
|
uses: docker/build-push-action@v1
|
|
|
|
with:
|
2020-06-04 14:06:50 +02:00
|
|
|
dockerfile: website/Dockerfile
|
|
|
|
path: website/
|
2020-06-01 16:12:48 +02:00
|
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
repository: thecodingmachine/workadventure-website
|
|
|
|
tags: ${{ env.GITHUB_REF_SLUG }}
|
2020-07-23 18:43:51 +02:00
|
|
|
add_git_labels: true
|
|
|
|
|
|
|
|
build-maps:
|
|
|
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
|
|
|
|
|
|
|
# Create a slugified value of the branch
|
|
|
|
- uses: rlespinasse/github-slug-action@master
|
|
|
|
|
|
|
|
- name: "Build and push front image"
|
|
|
|
uses: docker/build-push-action@v1
|
|
|
|
with:
|
|
|
|
dockerfile: maps/Dockerfile
|
|
|
|
path: maps/
|
|
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
repository: thecodingmachine/workadventure-maps
|
|
|
|
tags: ${{ env.GITHUB_REF_SLUG }}
|
2020-04-09 11:00:30 +02:00
|
|
|
add_git_labels: true
|
|
|
|
|
|
|
|
deeploy:
|
|
|
|
needs:
|
|
|
|
- build-front
|
|
|
|
- build-back
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
2020-04-09 11:03:24 +02:00
|
|
|
steps:
|
2020-04-09 11:00:30 +02:00
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
2020-04-13 15:44:33 +02:00
|
|
|
# Create a slugified value of the branch
|
2020-04-13 18:34:13 +02:00
|
|
|
- uses: rlespinasse/github-slug-action@1.1.0
|
2020-04-13 15:44:33 +02:00
|
|
|
|
2020-04-09 12:14:06 +02:00
|
|
|
- name: Deploy
|
2020-04-09 11:00:30 +02:00
|
|
|
uses: thecodingmachine/deeployer@master
|
2020-04-09 14:21:43 +02:00
|
|
|
env:
|
|
|
|
KUBE_CONFIG_FILE: ${{ secrets.KUBE_CONFIG_FILE }}
|
2020-10-14 12:25:05 +02:00
|
|
|
ADMIN_API_TOKEN: ${{ secrets.ADMIN_API_TOKEN }}
|
2020-04-09 12:14:06 +02:00
|
|
|
with:
|
2020-04-13 15:45:35 +02:00
|
|
|
namespace: workadventure-${{ env.GITHUB_REF_SLUG }}
|
2020-04-13 18:30:22 +02:00
|
|
|
|
|
|
|
- name: Add a comment in PR
|
2020-04-13 18:33:27 +02:00
|
|
|
uses: unsplash/comment-on-pr@v1.2.0
|
2020-05-13 22:20:34 +02:00
|
|
|
if: ${{ env.GITHUB_REF_SLUG != 'master' }}
|
2020-04-13 18:30:22 +02:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
with:
|
2020-04-22 23:34:56 +02:00
|
|
|
msg: Environment deployed at https://${{ env.GITHUB_REF_SLUG }}.workadventure.test.thecodingmachine.com
|
2020-04-13 18:30:22 +02:00
|
|
|
check_for_duplicate_msg: true
|
2020-04-15 23:54:55 +02:00
|
|
|
|
|
|
|
- name: Run Cypress tests
|
|
|
|
uses: cypress-io/github-action@v1
|
2020-05-13 22:20:34 +02:00
|
|
|
if: ${{ env.GITHUB_REF_SLUG != 'master' }}
|
2020-04-16 00:06:24 +02:00
|
|
|
env:
|
2020-06-01 16:39:34 +02:00
|
|
|
CYPRESS_BASE_URL: https://play.${{ env.GITHUB_REF_SLUG }}.workadventure.test.thecodingmachine.com
|
2020-04-15 23:54:55 +02:00
|
|
|
with:
|
2020-06-01 16:39:34 +02:00
|
|
|
env: host=play.${{ env.GITHUB_REF_SLUG }}.workadventure.test.thecodingmachine.com,port=80
|
2020-04-16 00:13:40 +02:00
|
|
|
spec: cypress/integration/spec.js
|
2020-06-01 16:39:34 +02:00
|
|
|
wait-on: https://play.${{ env.GITHUB_REF_SLUG }}.workadventure.test.thecodingmachine.com
|
2020-04-15 23:54:55 +02:00
|
|
|
working-directory: e2e
|
|
|
|
|
2020-05-13 22:20:34 +02:00
|
|
|
- name: Run Cypress tests in prod
|
|
|
|
uses: cypress-io/github-action@v1
|
|
|
|
if: ${{ env.GITHUB_REF_SLUG == 'master' }}
|
|
|
|
env:
|
2020-06-01 16:39:34 +02:00
|
|
|
CYPRESS_BASE_URL: https://play.workadventu.re
|
2020-05-13 22:20:34 +02:00
|
|
|
with:
|
2020-06-01 16:39:34 +02:00
|
|
|
env: host=play.workadventu.re
|
2020-05-13 22:20:34 +02:00
|
|
|
spec: cypress/integration/spec.js
|
|
|
|
wait-on: https://workadventu.re
|
|
|
|
working-directory: e2e
|
|
|
|
|
2020-04-15 23:54:55 +02:00
|
|
|
- name: "Upload the screenshot on test failure"
|
|
|
|
uses: actions/upload-artifact@v1
|
|
|
|
if: failure()
|
|
|
|
with:
|
|
|
|
name: "screenshot"
|
|
|
|
path: "./e2e/cypress/screenshots/spec.js/WorkAdventureGame -- loads (failed).png"
|