Created
August 12, 2020 15:59
-
-
Save owen2345/6ab79544000f49fffe6b9b764e00b33d to your computer and use it in GitHub Desktop.
micro services + micro frnotends CI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/[email protected] | |
- 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/[email protected]", | |
# 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