name: unit-test-refresh
on:
  schedule:
    # auto-refresh every Sunday evening
    - cron: '0 22 * * 0'
  # can be run manually on https://github.com/cockpit-project/cockpit/actions
  workflow_dispatch:
jobs:
  # we do both builds and all tests in a single run, so that we only upload the containers on success
  refresh:
    runs-on: ubuntu-latest
    timeout-minutes: 180
    steps:
      - name: Clone repository
        uses: actions/checkout@v2
        with:
          # need this to also fetch tags
          fetch-depth: 0

      - name: Build fresh containers
        run: containers/unit-tests/build

      - name: Run amd64 gcc test
        run: containers/unit-tests/start

      - name: Run amd64 clang test
        run: containers/unit-tests/start CC=clang

      - name: Run i386 test
        run: containers/unit-tests/start :i386

      - name: Log into container registry
        run: podman login -u cockpituous -p ${{ secrets.COCKPITUOUS_GHCR_TOKEN }} ghcr.io

      - name: Push containers to registry
        run: |
          podman push ghcr.io/cockpit-project/unit-tests:latest
          podman push ghcr.io/cockpit-project/unit-tests:i386

name: unit-test-refresh
on:
  schedule:
    # auto-refresh every Sunday evening
    - cron: '0 22 * * 0'
  # can be run manually on https://github.com/cockpit-project/cockpit/actions
  workflow_dispatch:
jobs:
  # we do both builds and all tests in a single run, so that we only upload the containers on success
  # run as root, as podman is missing slirp4netns in Ubuntu 18.04, and does not have overlayfs by default
  refresh:
    runs-on: ubuntu-latest
    timeout-minutes: 180
    steps:
      - name: Clone repository
        uses: actions/checkout@v2
        with:
          # need this to also fetch tags
          fetch-depth: 0

      - name: Build fresh containers
        run: sudo containers/unit-tests/build

      - name: Run amd64 gcc test
        run: sudo containers/unit-tests/start

      - name: Run amd64 clang test
        run: sudo containers/unit-tests/start CC=clang

      - name: Run i386 test
        run: sudo containers/unit-tests/start :i386

      - name: Log into container registry
        run: sudo podman login -u cockpituous -p ${{ secrets.COCKPITUOUS_GHCR_TOKEN }} ghcr.io

      - name: Push containers to registry
        run: |
          sudo podman push ghcr.io/cockpit-project/unit-tests:latest
          sudo podman push ghcr.io/cockpit-project/unit-tests:i386

Fix unit tests with podman for container refreshes
workflows: Fix unit tests with podman for container refreshes

Similar as in commit 881b3343b90f, the unit-tests-refresh workflow now
fails in Ubuntu 18.04 due to missing slirp4netns. But for building
containers we also want overlayfs, which is also not available by
default. So run the builds and runs in system podman to avoid both
issues.

Closes #15013