
name: CPP-nightly
# It runs non-deafult OSes, listed below with basic set of compilers and tests.

on:
  schedule:
    # run this job at 01:00 UTC everyday
    - cron:  '0 1 * * *'

env:
  REPO:           libpmemobj-cpp
  GITHUB_REPO:    pmem/libpmemobj-cpp
  CONTAINER_REG:  ghcr.io/pmem/libpmemobj-cpp
  HOST_WORKDIR:   ${{ github.workspace }}
  WORKDIR:        utils/docker
  TEST_TIMEOUT:   900
  IMG_VER:        latest
  TYPE:           debug
  PUSH_IMAGE:     1
  # use org's Private Access Token to log in to GitHub Container Registry
  CONTAINER_REG_USER:   ${{ secrets.GH_CR_USER }}
  CONTAINER_REG_PASS:   ${{ secrets.GH_CR_PAT }}

jobs:
  linux:
    name: Linux-nightly
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        CONFIG: ["OS=centos OS_VER=8",
                 "OS=archlinux-base OS_VER=latest",
                 "OS=debian OS_VER=testing",
                 "OS=debian OS_VER=unstable",
                 "OS=debian OS_VER=latest",
                 "OS=fedora OS_VER=33",
                 "OS=fedora OS_VER=34",
                 "OS=fedora OS_VER=rawhide TESTS_PMREORDER=0",
                 "OS=opensuse-leap OS_VER=latest",
                 "OS=opensuse-tumbleweed OS_VER=latest",
                 "OS=ubuntu OS_VER=18.04",
                 "OS=ubuntu OS_VER=21.04",
                 "OS=ubuntu OS_VER=devel"]
    steps:
      - name: Clone the git repo
        uses: actions/checkout@v2

      # It rebuilds images every time and pushes them to the container registry
      - name: Rebuild and push the image
        run: cd $WORKDIR && ${{ matrix.CONFIG }} ./pull-or-rebuild-image.sh rebuild

      - name: Run the build
        run: cd $WORKDIR && ${{ matrix.CONFIG }} ./build.sh
