Display checklist #100
Workflow file for this run
This file contains 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: 🐋☸️ Build (PR) | |
on: | |
pull_request: | |
branches: [dev, master] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
APP_ID: label-* # specific to backend or client | |
APP_GROUP: judilibre-prive | |
APP_HOST: label.judilibre-prive.local | |
APP_PORT: 443 | |
APP_SCHEME: https | |
APP_SELF_SIGNED: "true" | |
APP_KEYWORD: specific # to backend or client | |
DOCKER_USERNAME: opendatajustice | |
KUBECONFIG: /home/runner/.kube/config-local-k3s.yaml | |
KUBE_NAMESPACE: judilibre-prive-local-dev | |
KUBE_TYPE: k3s | |
KUBE_ZONE: local | |
NLP_API_HOST: https://nlp-pseudonymisation.judilibre-prive.local | |
NLP_API_PORT: 443 | |
ROOT_PATH: label* # specific to backend or client | |
START_TIMEOUT: 240 | |
strategy: | |
matrix: | |
node-version: [14.x, 16.x] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Extract branch name | |
shell: bash | |
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF} | sed 's|^refs/heads/||;' | sed 's/[^a-zA-Z0-9]/-/g')" | |
id: extract_branch | |
- name: Init ops dependencies | |
run: ./scripts/init_deps.sh && ./scripts/check_install.sh | |
env: | |
GIT_BRANCH: ${{ steps.extract_branch.outputs.branch }} | |
- name: 🔙 Get version -- backend | |
run: echo "##[set-output name=version;]$(./scripts/version.sh)" | |
id: backend_version | |
env: | |
APP_ID: label-backend | |
- name: 🔙🐋 Check if build is needed -- backend | |
run: | | |
echo "##[set-output name=status;]$(./scripts/docker-check.sh || echo build_needed)" | |
id: backend_check | |
env: | |
GIT_BRANCH: ${{ steps.extract_branch.outputs.branch }} | |
VERSION: ${{ steps.backend_version.outputs.version }} | |
APP_ID: label-backend | |
- name: 👤 Get version -- client | |
run: echo "##[set-output name=version;]$(./scripts/version.sh)" | |
id: client_version | |
env: | |
APP_ID: label-client | |
- name: 👤🐋 Check if build is needed -- client | |
run: | | |
echo "##[set-output name=status;]$(./scripts/docker-check.sh || echo build_needed)" | |
id: client_check | |
env: | |
GIT_BRANCH: ${{ steps.extract_branch.outputs.branch }} | |
VERSION: ${{ steps.client_version.outputs.version }} | |
APP_ID: label-client | |
- name: Use Node.js ${{ matrix.node-version }} | |
if: (steps.client_check.outputs.status == 'build_needed') || (steps.backend_check.outputs.status == 'build_needed') | |
uses: actions/setup-node@v1 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- run: yarn install -- | |
if: (steps.client_check.outputs.status == 'build_needed') || (steps.backend_check.outputs.status == 'build_needed') | |
- run: yarn compile | |
if: (steps.client_check.outputs.status == 'build_needed') || (steps.backend_check.outputs.status == 'build_needed') | |
- run: yarn test | |
if: (steps.client_check.outputs.status == 'build_needed') || (steps.backend_check.outputs.status == 'build_needed') | |
- run: yarn lint | |
if: (steps.client_check.outputs.status == 'build_needed') || (steps.backend_check.outputs.status == 'build_needed') | |
- name: 🔙🐋 Build docker image -- backend | |
if: (matrix.node-version == '16.x') && (steps.backend_check.outputs.status == 'build_needed') | |
run: ./scripts/docker-build.sh | |
env: | |
APP_ID: label-backend | |
DOCKER_TARGET: label-backend | |
VERSION: ${{ steps.backend_version.outputs.version }} | |
- name: 🔙☸️ Deploy k8s services locally -- backend | |
if: (matrix.node-version == '16.x') && (steps.backend_check.outputs.status == 'build_needed') | |
run: ./scripts/deploy_k8s_services.sh | |
env: | |
APP_ID: label-backend | |
API_PORT: 55430 | |
APP_KEYWORD: "true" | |
GIT_BRANCH: ${{ steps.extract_branch.outputs.branch }} | |
ROOT_PATH: label/api | |
VERSION: ${{ steps.backend_version.outputs.version }} | |
- name: 🔙✅ Execute minimal tests -- backend | |
if: (matrix.node-version == '16.x') && (steps.backend_check.outputs.status == 'build_needed') | |
run: | | |
echo "127.0.0.1 ${APP_HOST}" | sudo tee -a /etc/hosts | |
kubectl get pods --namespace=${KUBE_NAMESPACE} | |
kubectl logs service/${APP_ID}-svc --namespace=${KUBE_NAMESPACE} | |
./scripts/test_minimal.sh | |
env: | |
APP_ID: label-backend | |
APP_KEYWORD: "true" | |
GIT_BRANCH: ${{ steps.extract_branch.outputs.branch }} | |
GIT_TOKEN: ${{ secrets.GIT_TOKEN }} | |
ROOT_PATH: label/api | |
- name: 👤 Build static app -- client | |
if: (matrix.node-version == '16.x') && (steps.client_check.outputs.status == 'build_needed') | |
run: | | |
export VERSION=$(./scripts/version.sh) | |
export DOCKER_IMAGE=${DOCKER_USERNAME}/${APP_ID}:${VERSION} | |
if ! (docker manifest inspect ${DOCKER_IMAGE}); then | |
yarn buildClient || echo "ugly worakound"; | |
fi | |
env: | |
APP_ID: label-client | |
- name: 👤🐋 Build docker image -- client | |
if: (matrix.node-version == '16.x') && (steps.client_check.outputs.status == 'build_needed') | |
run: ./scripts/docker-build.sh | |
env: | |
APP_ID: label-client | |
DOCKER_TARGET: label-client | |
VERSION: ${{ steps.client_version.outputs.version }} | |
- name: 👤☸️ Deploy k8s services locally -- client | |
if: (matrix.node-version == '16.x') && (steps.client_check.outputs.status == 'build_needed') | |
run: ./scripts/deploy_k8s_services.sh | |
env: | |
APP_ID: label-client | |
API_PORT: 55432 | |
APP_KEYWORD: html | |
GIT_BRANCH: ${{ steps.extract_branch.outputs.branch }} | |
ROOT_PATH: label | |
VERSION: ${{ steps.client_version.outputs.version }} | |
- name: 👤✅ Execute minimal tests -- client | |
if: (matrix.node-version == '16.x') && (steps.client_check.outputs.status == 'build_needed') | |
run: | | |
echo "127.0.0.1 ${APP_HOST}" | sudo tee -a /etc/hosts | |
kubectl get pods --namespace=${KUBE_NAMESPACE} | |
kubectl logs service/${APP_ID}-svc --namespace=${KUBE_NAMESPACE} | |
./scripts/test_minimal.sh | |
env: | |
APP_ID: label-client | |
APP_KEYWORD: html | |
GIT_BRANCH: ${{ steps.extract_branch.outputs.branch }} | |
GIT_TOKEN: ${{ secrets.GIT_TOKEN }} | |
ROOT_PATH: label |