-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c2ffbf1
Showing
4 changed files
with
133 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,31 @@ | ||
--- | ||
name: "Lint" | ||
|
||
on: [push, pull_request] | ||
Check warning on line 4 in .github/workflows/lint.yml GitHub Actions / YAML
|
||
|
||
jobs: | ||
lint-yaml: | ||
name: "YAML" | ||
runs-on: ubuntu-22.04 | ||
env: | ||
YAML_FILES: | | ||
.github/workflows/lint.yml | ||
action.yml | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install Dependencies | ||
run: sudo apt-get update && sudo apt-get install -y yamllint shellcheck | ||
- name: Validate YAML Files | ||
run: yamllint $YAML_FILES | ||
|
||
shellcheck: | ||
name: "Shell Scripts" | ||
runs-on: ubuntu-22.04 | ||
env: | ||
SHELL_FILES: entrypoint.sh | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install Dependencies | ||
run: sudo apt-get update && sudo apt-get install -y shellcheck | ||
- name: Validate Shell Scripts | ||
run: shellcheck $SHELL_FILES |
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,33 @@ | ||
# action-target-list | ||
|
||
This Action allows to obtain a list of targets available for a | ||
given Gluon release. | ||
|
||
The target-list is returned as a JSON, so it can be used with | ||
a matrix-strategy for building multiple concurrent targets | ||
in a CI. | ||
|
||
|
||
## Inputs | ||
|
||
### gluon-path | ||
Path to a checked-out Gluon repository. | ||
|
||
### allowlist | ||
Space-separated list of targets which are allowed in the output list. | ||
|
||
Any target not present in this list won't occur in the output list. | ||
|
||
### denylist | ||
Space-separated list of targets which are not allowed in the output list. | ||
|
||
Any target present in this list won't occur in the output list. | ||
|
||
### broken | ||
Whether or not to include targets marked as `BROKEN` in the output list. | ||
|
||
|
||
## Outputs | ||
|
||
### targets | ||
JSON list containing all valid targets |
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,35 @@ | ||
--- | ||
name: 'Get list of available targets for Gluon release' | ||
description: 'Returns targets available in a specified Gluon release' | ||
inputs: | ||
gluon-path: | ||
description: 'Path to Gluon repository' | ||
required: true | ||
allowlist: | ||
description: 'Space-separated list of targets to be returned if available' | ||
required: false | ||
denylist: | ||
description: | | ||
'Space-separated list of targets to be excluded from the result' | ||
required: false | ||
broken: | ||
description: 'Determines if BROKEN targets should be returned (Default: 0)' | ||
default: 0 | ||
outputs: | ||
targets: | ||
description: 'JSON list containing all valid targets' | ||
value: ${{ steps.save-step.outputs.targets }} | ||
runs: | ||
using: 'composite' | ||
steps: | ||
- run: > | ||
bash ${{ github.action_path }}/entrypoint.sh | ||
${{ inputs.gluon-path }} > /tmp/targets.json | ||
shell: bash | ||
env: | ||
ALLOWLIST: ${{ inputs.allowlist }} | ||
DENYLIST: ${{ inputs.denylist }} | ||
BROKEN: ${{ inputs.broken }} | ||
- run: echo "targets=$(cat /tmp/targets.json)" >> "$GITHUB_OUTPUT" | ||
shell: bash | ||
id: save-step |
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,34 @@ | ||
#!/bin/bash | ||
|
||
set -euxo pipefail | ||
|
||
GLUON_PATH="$1" | ||
|
||
ALLOWLIST="${ALLOWLIST:-}" | ||
DENYLIST="${DENYLIST:-}" | ||
BROKEN="${BROKEN:0}" | ||
|
||
# Get List of available Targets | ||
AVAILABLE_TARGETS_NEWLINE="$(make --no-print-directory -C "$GLUON_PATH" list-targets "BROKEN=${BROKEN}" "GLUON_SITEDIR=docs/site-example")" | ||
|
||
# Format Allow- and Denylist | ||
TARGET_ALLOWLIST_NEWLINE="$(echo "$ALLOWLIST" | tr ' ' '\n')" | ||
TARGET_DENYLIST_NEWLINE="$(echo "$DENYLIST" | tr ' ' '\n')" | ||
|
||
# Return all available targets if no allowlist is set | ||
OUTPUT_TARGETS="${AVAILABLE_TARGETS_NEWLINE}" | ||
|
||
if [ -n "$ALLOWLIST" ]; then | ||
# Only return words present in both lists | ||
OUTPUT_TARGETS="$(echo -e "$AVAILABLE_TARGETS_NEWLINE\n$TARGET_ALLOWLIST_NEWLINE" | sort | uniq -d)" | ||
fi | ||
|
||
if [ -n "$DENYLIST" ]; then | ||
# Remove words present in denylist | ||
OUTPUT_TARGETS="$(echo -e "$OUTPUT_TARGETS\n$TARGET_DENYLIST_NEWLINE" | sort | uniq -u)" | ||
fi | ||
|
||
# Convert to JSON | ||
OUTPUT_JSON="$(echo "$OUTPUT_TARGETS" | jq --raw-input . | jq --slurp . | jq -c .)" | ||
|
||
echo "$OUTPUT_JSON" |