name: CI

on: [push]

jobs:
  build:
    name: Continuous Integration
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v2

      - name: Check translation files
        run: |
          scripts/translations/sort.sh
          scripts/translations/missing-keys.sh

      - name: Build neo4j image
        uses: docker/build-push-action@v1.1.0
        with:
          repository: ocelotsocialnetwork/neo4j
          tags: latest
          path: neo4j/
          push: false
      - name: Build backend base image
        uses: docker/build-push-action@v1.1.0
        with:
          repository: ocelotsocialnetwork/backend
          tags: build-and-test
          target: build-and-test
          path: backend/
          push: false
      - name: Build webapp base image
        uses: docker/build-push-action@v1.1.0
        with:
          repository: ocelotsocialnetwork/webapp
          tags: build-and-test
          target: build-and-test
          path: webapp/
          push: false

      - name: Lint backend
        run: docker run --rm ocelotsocialnetwork/backend:build-and-test yarn run lint
      - name: Lint webapp
        run: docker run --rm ocelotsocialnetwork/webapp:build-and-test yarn run lint

