Skip to content

Instantly share code, notes, and snippets.

@owen2345
Created August 12, 2020 15:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save owen2345/6ab79544000f49fffe6b9b764e00b33d to your computer and use it in GitHub Desktop.
Save owen2345/6ab79544000f49fffe6b9b764e00b33d to your computer and use it in GitHub Desktop.
micro services + micro frnotends CI
name: Content System
on:
push:
branches:
- master
- develop
- staging
pull_request:
jobs:
build:
name: Tests and Code Style
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# Pull the latest image to build, and avoid caching pull-only images.
# (docker pull is faster than caching in most cases.)
- name: download container cache
run: docker-compose pull
# In this step, this action saves a list of existing images,
# the cache is created without them in the post run.
# It also restores the cache if it exists.
- uses: satackey/action-docker-layer-caching@v0.0.5
- name: Build the stack
run: docker-compose up -d
- name: Fetch github info
run: |
git fetch --no-tags --depth=1 origin ${{ github.base_ref }}
git fetch --no-tags --depth=1 origin ${{ github.head_ref }}
- name: Frontend Tests
run: |
FRONTEND_SPECS=$(git diff --name-only origin/${{ github.base_ref }} origin/${{ github.head_ref }} -- frontend/)
if [ -n "$FRONTEND_SPECS" ]; then
docker-compose run content_service ./docker/frontend_ci.sh
fi
- name: Backend Tests
run: |
BACKEND_CHANGES=$(git diff --name-only origin/${{ github.base_ref }} origin/${{ github.head_ref }} -- ":(exclude)frontend/")
if [ -n "$BACKEND_CHANGES" ]; then
docker-compose run content_service ./docker/backend_ci.sh
fi
# Finally, "Post Run satackey/action-docker-layer-caching@v0.0.5",
# which is the process of saving the cache, will be executed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment