2020-12-16 23:32:32 +08:00
|
|
|
name: continuous integration
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
paths-ignore:
|
|
|
|
- 'LICENSE'
|
|
|
|
- 'README**'
|
|
|
|
- 'HOW_TO_RELEASE**'
|
|
|
|
- 'LOGGING**'
|
|
|
|
|
|
|
|
env:
|
|
|
|
GCLOUD_VERSION: '306.0.0'
|
|
|
|
ARTIFACTS_PROJECT_ID: cartodb-on-gcp-main-artifacts
|
|
|
|
|
|
|
|
jobs:
|
2020-12-17 14:15:57 +08:00
|
|
|
build-test-docker:
|
2020-12-16 23:32:32 +08:00
|
|
|
runs-on: ubuntu-18.04
|
|
|
|
timeout-minutes: 10
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
2020-12-16 23:47:19 +08:00
|
|
|
with:
|
|
|
|
submodules: true
|
2020-12-17 14:07:09 +08:00
|
|
|
token: ${{ secrets.CARTOFANTE_PERSONAL_TOKEN }}
|
2020-12-16 23:32:32 +08:00
|
|
|
|
|
|
|
- name: Build image
|
|
|
|
# we tag with "latest" but we don't push it on purpose. We use it as a base for the testing image
|
|
|
|
run: |
|
|
|
|
echo ${GITHUB_SHA::7}
|
|
|
|
echo ${GITHUB_REF##*/}
|
2020-12-16 23:47:19 +08:00
|
|
|
docker build -f private/Dockerfile -t gcr.io/$ARTIFACTS_PROJECT_ID/windshaft:latest -t gcr.io/$ARTIFACTS_PROJECT_ID/windshaft:${GITHUB_REF##*/} -t gcr.io/$ARTIFACTS_PROJECT_ID/windshaft:${GITHUB_SHA::7} -t gcr.io/$ARTIFACTS_PROJECT_ID/windshaft:${GITHUB_REF##*/}--${GITHUB_SHA::7} .
|
2020-12-16 23:32:32 +08:00
|
|
|
|
|
|
|
- name: Build testing image
|
|
|
|
# here it uses the lastest from prev step to add the needed parts on top
|
|
|
|
run: |
|
2020-12-16 23:47:19 +08:00
|
|
|
docker build -t gcr.io/$ARTIFACTS_PROJECT_ID/windshaft-test:latest -f private/Dockerfile.test .
|
2020-12-16 23:32:32 +08:00
|
|
|
|
|
|
|
- name: Setup gcloud authentication
|
|
|
|
uses: google-github-actions/setup-gcloud@master
|
|
|
|
with:
|
|
|
|
version: ${{env.GCLOUD_VERSION}}
|
|
|
|
service_account_key: ${{ secrets.ARTIFACTS_GCLOUD_ACCOUNT_BASE64 }}
|
|
|
|
|
|
|
|
- name: Configure docker and pull images
|
|
|
|
# we pull images manually, as if done in next step using docker-compose it fails because missing openssl
|
|
|
|
run: |
|
|
|
|
gcloud auth configure-docker
|
|
|
|
docker pull gcr.io/cartodb-on-gcp-main-artifacts/postgres:latest
|
|
|
|
docker pull gcr.io/cartodb-on-gcp-main-artifacts/redis:latest
|
|
|
|
|
|
|
|
- name: Run tests inside container
|
2020-12-16 23:47:19 +08:00
|
|
|
run: docker-compose -f private/ci/docker-compose.yml run windshaft-tests
|
2020-12-16 23:32:32 +08:00
|
|
|
|
|
|
|
- name: Upload image
|
|
|
|
run: |
|
|
|
|
docker push gcr.io/$ARTIFACTS_PROJECT_ID/windshaft:${GITHUB_REF##*/}
|
|
|
|
docker push gcr.io/$ARTIFACTS_PROJECT_ID/windshaft:${GITHUB_SHA::7}
|
|
|
|
docker push gcr.io/$ARTIFACTS_PROJECT_ID/windshaft:${GITHUB_REF##*/}--${GITHUB_SHA::7}
|
|
|
|
|