[LTP] [PATCH v6 3/4] ci: add ci-patchwork-trigger workflow

Cyril Hrubis chrubis@suse.cz
Tue Apr 15 17:12:56 CEST 2025


Hi!
> Add ci-patchwork-trigger workflow that is meant to run every 30 minutes,
> checking for new untested LTP patches in the Mailing List and running
> the ci-docker-build workflow on them.
> 
> Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
> ---
>  .github/workflows/ci-patchwork-trigger.yml | 65 ++++++++++++++++++++++++++++++
>  1 file changed, 65 insertions(+)
> 
> diff --git a/.github/workflows/ci-patchwork-trigger.yml b/.github/workflows/ci-patchwork-trigger.yml
> new file mode 100644
> index 0000000000000000000000000000000000000000..0938aed5ad0df8af8e2e575283b56475ff219ff3
> --- /dev/null
> +++ b/.github/workflows/ci-patchwork-trigger.yml
> @@ -0,0 +1,65 @@
> +# Copyright (c) 2025 Andrea Cervesato <andrea.cervesato@suse.com>
> +
> +name: "Patchwork checker"
> +on:
> +  push:

Does it make sense to run the script both on schedulle and push?

> +  schedule:
> +    - cron: '*/15 * * * 1-5'
> +    - cron: '*/45 * * * 6,0'

So we run this less on weekends, I suppose that may make some sense.

> +env:
> +  PATCHWORK_CI_FILE: patchwork-ci-output.txt
> 
> +jobs:
> +  checker:
> +    if: ${{ github.repository == 'linux-test-project/ltp' }}
> +    runs-on: ubuntu-latest
> +    steps:
> +      - name: Git checkout
> +        uses: actions/checkout@v1
> +
> +      - name: Verify new patches
> +        id: verify
> +        run: |
> +          ./ci/tools/patchwork.sh verify > "$PATCHWORK_CI_FILE"
> +          cat "$PATCHWORK_CI_FILE"
> +
> +      - name: Run tests
> +        if: success()
> +        uses: actions/github-script@v7
> +        with:
> +          script: |
> +            const fs = require('fs');
> +
> +            const output = fs.readFileSync(process.env.PATCHWORK_CI_FILE, 'utf8');
> +            if (output.length === 0) {
> +              console.log("'patchwork-ci.sh verify' output is empty");
> +              return;
> +            }
> +
> +            const lines = output.split('\n');
> +            if (lines.length === 0) {
> +              console.log("No new patch-series found");
> +              return;
> +            }
> +
> +            for (const data of lines) {
> +              const [series_id, series_mbox] = data.split('|');
> +              if (series_id.length === 0 || series_mbox.length === 0) {
> +                console.log(`Malformed data: ${data}`);
> +                continue;
> +              }
> +
> +              const response = await github.rest.actions.createWorkflowDispatch({
> +                owner: context.repo.owner,
> +                repo: context.repo.repo,
> +                ref: context.ref,
> +                workflow_id: 'ci-docker-build.yml',
> +                inputs: {
> +                  SERIES_ID: series_id,
> +                  SERIES_MBOX: series_mbox,
> +                }
> +              });
> +
> +              console.log(response);
> +            }

The code looks sane to me, though I'm not expert on github CI.

You can add my:

Acked-by: Cyril Hrubis <chrubis@suse.cz>

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list