# Get GITHUB_TOKEN via secrets.GITHUB_TOKEN automatically
# Get owner/repository_name via github.repository

on: [push]

env:
  IMAGE_NAME: aten

jobs:
  build_docker:
    name: build_docker
    runs-on: ubuntu-18.04
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Build image
        run: docker build -t aten .
      - name: Push image
        run: |
          docker login docker.pkg.github.com --username $GITHUB_ACTOR --password-stdin <<< ${{ secrets.GITHUB_TOKEN }}
          docker tag aten docker.pkg.github.com/${{ github.repository }}/$IMAGE_NAME:latest
          docker push docker.pkg.github.com/${{ github.repository }}/$IMAGE_NAME:latest
  ci:
    name: ci
    runs-on: ubuntu-18.04
    needs: build_docker
    steps:
      - name: Checkout
        uses: actions/checkout@v2
        with:
          submodules: true
      - name: Login registry
        run: docker login docker.pkg.github.com --username $GITHUB_ACTOR --password-stdin <<< ${{ secrets.GITHUB_TOKEN }}
      - name: Pull image
        run: docker pull docker.pkg.github.com/${{ github.repository }}/$IMAGE_NAME:latest
      - name: Run image
        run: docker run -it -d --name $IMAGE_NAME -v $GITHUB_WORKSPACE:/workspace -w /workspace docker.pkg.github.com/${{ github.repository }}/$IMAGE_NAME:latest
      - name: Configure
        run: |
          docker exec $IMAGE_NAME bash -c 'mkdir build'
          docker exec $IMAGE_NAME bash -c 'cd build && cp ../scripts/RunCMake.sh ./ && ./RunCMake.sh Release 75'
      - name: Build
        run: docker exec $IMAGE_NAME bash -c 'cd build && ninja'

Add yaml for CI with Github Action
Add yaml for CI with Github Action
