Skip to content

CI

CI #2069

Workflow file for this run

---
name: CI
on:
push:
branches: [master]
pull_request:
branches: [master]
schedule:
- cron: 1 1 * * *
jobs:
fedora-versions:
runs-on: ubuntu-latest
steps:
- id: fedora-versions
run: |
curl -s -L https://fedoraproject.org/releases.json -o fedora-releases.json
LATEST=$(jq -r '[.[]|select(.variant == "Container" and .subvariant == "Container_Base" and .arch == "x86_64")][0]|.version' fedora-releases.json)
PREVIOUS=$((LATEST - 1))
echo "latest=$LATEST" >> $GITHUB_OUTPUT
echo "previous=$PREVIOUS" >> $GITHUB_OUTPUT
outputs:
latest: ${{ steps.fedora-versions.outputs.latest }}
previous: ${{ steps.fedora-versions.outputs.previous }}
check-commits:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/setup-python@v4
- name: Install tox
run: python -m pip install tox
- name: Run gitlint
run: tox -e gitlint
test:
needs: fedora-versions
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
test_distro: ["fedora-previous", "fedora-latest", "centos-stream9"]
include:
- test_distro: "fedora-previous"
base_image: "registry.fedoraproject.org/fedora:${{ needs.fedora-versions.outputs.previous }}"
- test_distro: "fedora-latest"
base_image: "registry.fedoraproject.org/fedora:${{ needs.fedora-versions.outputs.latest }}"
- test_distro: "centos-stream9"
base_image: "quay.io/centos/centos:stream9"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build test container
run: docker build -t sambacc:ci-${{ matrix.test_distro }} --build-arg=SAMBACC_BASE_IMAGE=${{ matrix.base_image }} tests/container/ -f tests/container/Containerfile
- name: Run test container
run: docker run -v $PWD:/var/tmp/build/sambacc sambacc:ci-${{ matrix.test_distro }}
push:
needs: [test]
runs-on: ubuntu-latest
if: (github.event_name == 'push' || github.event_name == 'schedule') && github.repository == 'samba-in-kubernetes/sambacc'
steps:
- uses: actions/checkout@v4
- name: log in to quay.io
run: docker login -u "${{ secrets.QUAY_USER }}" -p "${{ secrets.QUAY_PASS }}" quay.io
- name: build container image
run: docker build -t quay.io/samba.org/sambacc:latest tests/container -f tests/container/Containerfile
- name: publish container image
run: docker push quay.io/samba.org/sambacc:latest