Skip to content

Check snapshots of the last days #6117

Check snapshots of the last days

Check snapshots of the last days #6117

name: "Check snapshots of the last days"
on:
schedule:
# At every 60th minute.
# See https://docs.github.com/en/actions/reference/events-that-trigger-workflows#schedule
- cron: "*/60 * * * *"
# This is used when a /retest command asks for a re-check.
workflow_dispatch:
inputs:
yyyymmdd:
description: 'year month day'
required: true
type: string
lookback_days:
description: "A JSON list of integers for how many days to look back. \"[0]\" means just today."
default: "[0]"
type: string
strategy:
description: 'build strategy'
required: true
type: choice
default: all
options:
- all
- big-merge
- pgo
permissions:
# We need this in order to create or update snapshot issues
issues: write
jobs:
generate-matrix:
if: github.repository_owner == 'fedora-llvm-team'
runs-on: ubuntu-latest
outputs:
mymatrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/generate-matrix
id: set-matrix
with:
strategy: ${{ inputs.strategy }}
lookback_days: ${{ inputs.lookback_days }}
check-snapshot:
if: github.repository_owner == 'fedora-llvm-team'
needs: generate-matrix
strategy:
fail-fast: false
matrix: ${{fromJson(needs.generate-matrix.outputs.mymatrix)}}
runs-on: ubuntu-latest
steps:
- name: Setup Copr config file
if: github.event_name != 'workflow_dispatch' || (matrix.today_minus_n_days == 0 && inputs.strategy == matrix.name)
env:
# You need to have those secrets in your repo.
# See also: https://copr.fedorainfracloud.org/api/.
COPR_CONFIG_FILE: ${{ secrets.COPR_CONFIG }}
run: |
mkdir -p ~/.config
printf "$COPR_CONFIG_FILE" > ~/.config/copr
- name: Install Copr CLI
if: github.event_name != 'workflow_dispatch' || (matrix.today_minus_n_days == 0 && inputs.strategy == matrix.name)
run: |
sudo apt-get install -y lsb-release diffutils pcre2-utils jq
- uses: actions/checkout@v4
if: github.event_name != 'workflow_dispatch' || (matrix.today_minus_n_days == 0 && inputs.strategy == matrix.name)
- uses: ./.github/actions/prepare-python
if: github.event_name != 'workflow_dispatch' || (matrix.today_minus_n_days == 0 && inputs.strategy == matrix.name)
- name: "Check day (today minus ${{matrix.today_minus_n_days}} days)"
if: github.event_name != 'workflow_dispatch' || (matrix.today_minus_n_days == 0 && inputs.strategy == matrix.name)
shell: bash -e {0}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TESTING_FARM_API_TOKEN_PUBLIC_RANCH: ${{ secrets.TESTING_FARM_API_TOKEN_PUBLIC_RANCH }}
TESTING_FARM_API_TOKEN_REDHAT_RANCH: ${{ secrets.TESTING_FARM_API_TOKEN_REDHAT_RANCH }}
run: |
extra_args=""
if [[ ! -z "${{ matrix.chroot_pattern }}" ]]; then
extra_args="${extra_args} --chroot-pattern ${{matrix.chroot_pattern}}"
fi
if [[ "${{github.event_name}}" == "workflow_dispatch" ]]; then
yyyymmdd=${{inputs.yyyymmdd}}
else
yyyymmdd=`date --date='${{matrix.today_minus_n_days}} days ago' +%Y%m%d`
fi
python3 snapshot_manager/main.py \
--github-repo ${GITHUB_REPOSITORY} \
--github-token-env GITHUB_TOKEN \
check ${extra_args}\
--maintainer-handle ${{matrix.maintainer_handle}} \
--packages ${{matrix.packages}} \
--build-strategy ${{matrix.name}} \
--copr-ownername ${{matrix.copr_ownername}} \
--copr-project-tpl ${{matrix.copr_project_tpl}} \
--copr-monitor-tpl ${{matrix.copr_monitor_tpl}} \
--yyyymmdd $yyyymmdd