-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add bender-up-to-date action This action runs `bender script -n flist` and checks if all specified files exist in the repository. Useful as a sanity test in repositories that otherwise don't use bender. Signed-off-by: Nils Wistoff <[email protected]> * bender-up-to-date: Use install-bender action Signed-off-by: Nils Wistoff <[email protected]> * bender-up-to-date.sh: Propagate errors Signed-off-by: Nils Wistoff <[email protected]> * bender-up-to-date: Rename bender-install Signed-off-by: Nils Wistoff <[email protected]> --------- Signed-off-by: Nils Wistoff <[email protected]>
- Loading branch information
Showing
3 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Bender up-to-date | ||
|
||
This action runs `bender script -n flist` and checks if all specified files exist in the repository. Useful as a sanity test in repositories that otherwise don't use bender. | ||
|
||
## Action usage | ||
|
||
Simply add the action to your desired upstream workflow. Optionally specify a bender version using `bender-version` (default: latest). We suggest creating a standalone workflow with appropriate trigger rules for this, for example: | ||
|
||
```yaml | ||
name: bender-up-to-date | ||
|
||
on: [ push, pull_request, workflow_dispatch ] | ||
|
||
jobs: | ||
bender-up-to-date: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check Bender up-to-date | ||
uses: pulp-platform/pulp-actions/bender-up-to-date@v2 | ||
with: | ||
bender-version: 0.27.1 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Copyright 2023 ETH Zurich and University of Bologna. | ||
# Licensed under the Apache License, Version 2.0, see LICENSE for details. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# Author: Nils Wistoff <[email protected]> | ||
|
||
name: 'Bender up-to-date' | ||
description: 'Check if all files specified in Bender.yml exist.' | ||
|
||
inputs: | ||
# Optional argument | ||
bender-version: | ||
description: 'Bender version to install (default: latest)' | ||
required: false | ||
default: '' | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
- name: Install bender | ||
uses: pulp-platform/pulp-actions/bender-install@v2 | ||
with: | ||
version: ${{ inputs.bender-version }} | ||
- name: Check bender up-to-date | ||
shell: bash | ||
run: | | ||
${{ github.action_path }}/bender-up-to-date.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/usr/bin/bash | ||
# | ||
# Copyright 2023 ETH Zurich and University of Bologna. | ||
# Licensed under the Apache License, Version 2.0, see LICENSE for details. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
# Nils Wistoff <[email protected]> | ||
|
||
set -e | ||
|
||
RESULT=0 | ||
for FILE in $(bender script -n flist | sed "/^\+\S*$/d") | ||
do | ||
[ ! -f "$FILE" ] && { echo "bender-up-to-date: $FILE not found."; RESULT=1; } | ||
done | ||
exit $RESULT |