Skip to content

workflows: Dynamically detect fedora versions for test matrix #1954

workflows: Dynamically detect fedora versions for test matrix

workflows: Dynamically detect fedora versions for test matrix #1954

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: |
LATEST=$(curl -s -L https://fedoraproject.org/releases.json | \
jq -r '[.[] | select(.variant == "Container" and \
.subvariant == "Container_Base" and .arch == "x86_64")][0] | .version')
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:
runs-on: ubuntu-latest
env:
fedora-latest: ${{ needs.fedora-versions.outputs.latest }}
fedora-previous: ${{ needs.fedora-versions.outputs.previous }}
strategy:
fail-fast: false
matrix:
test_distro: ["fedora-${{ env.fedora-previous }}", "fedora-${{ env.fedora-latest }}", "centos-stream9"]

Check failure on line 49 in .github/workflows/ci.yml

View workflow run for this annotation

GitHub Actions / CI

Invalid workflow file

The workflow is not valid. .github/workflows/ci.yml (Line: 49, Col: 23): Unrecognized named-value: 'env'. Located at position 1 within expression: env.fedora-previous .github/workflows/ci.yml (Line: 49, Col: 60): Unrecognized named-value: 'env'. Located at position 1 within expression: env.fedora-latest
include:
- test_distro: "fedora-${{ env.fedora-previous }}"
base_image: "registry.fedoraproject.org/fedora:${{ env.fedora-previous }}"
- test_distro: "fedora-${{ env.fedora-latest }}"
base_image: "registry.fedoraproject.org/fedora:${{ env.fedora-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