Skip to content

Commit 38c051b

Browse files
committed
ci: simplify composition
1 parent 7098d04 commit 38c051b

File tree

5 files changed

+55
-63
lines changed

5 files changed

+55
-63
lines changed
File renamed without changes.
Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
name: "Dorothy Test"
2-
description: "Runs Dorothy's test suite via remote invocation."
1+
name: "Dorothy Remote Action"
2+
description: "Runs a Dorothy action, via remote execution."
33
inputs:
44
GITHUB_TOKEN:
55
description: "Used to increase rate limits. Should be read-only."
@@ -9,13 +9,16 @@ inputs:
99
default: "bevry/dorothy"
1010
COMMIT:
1111
required: true
12-
COMMAND:
12+
ACTION:
1313
required: true
14+
ARGUMENTS:
15+
default: ""
16+
required: false
1417
runs:
1518
using: "composite"
1619
steps:
1720
- name: "Dorothy Test"
1821
env:
1922
GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }}
2023
shell: bash -eo pipefail {0} # composite actions require shell, openmandriva fails if this is a login shell
21-
run: bash -c "$(curl -fsSL "https://dorothy.bevry.me/run?slug=${{ inputs.SLUG }}&commit=${{ inputs.COMMIT }}")" -- ${{ inputs.COMMAND }}
24+
run: bash -c "$(curl -fsSL "https://dorothy.bevry.me/${{ inputs.ACTION }}?slug=${{ inputs.SLUG }}&commit=${{ inputs.COMMIT }}")" ${{ inputs.ARGUMENTS }}

.github/actions/dorothy-test/action.yml

Lines changed: 0 additions & 19 deletions
This file was deleted.

.github/workflows/dorothy-workflow.yml

Lines changed: 33 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Don't use `shell: bash` unless needed, as for macos-fresh that caused an infinite queue for the test step, and for linux bash may not exist yet
33
#
44
# NOTE:
5-
# `uses: bevry/dorothy/.github/actions/dorothy-deps@master` is used instead of `uses: ./.github/actions/dorothy-deps` as the latter becomes the former, even if on a different branch, as such the eplicit variation is used to make it obvious one must manually specify the branch; using a dynamic variable for the branch does not work and results in a failure; awful design by github, but that is how it is
5+
# `uses: bevry/dorothy/.github/actions/dorothy-dependencies@master` is used instead of `uses: ./.github/actions/dorothy-deps` as the latter becomes the former, even if on a different branch, as such the eplicit variation is used to make it obvious one must manually specify the branch; using a dynamic variable for the branch does not work and results in a failure; awful design by github, but that is how it is
66
#
77
# NOTE:
88
# You can find details on the avalilable runners here:
@@ -121,11 +121,13 @@ jobs:
121121
runs-on: ubuntu-latest
122122
steps:
123123
- name: "Dorothy Install"
124-
env:
124+
uses: bevry/dorothy/.github/actions/dorothy-remote-action@master
125+
with:
125126
GITHUB_TOKEN: ${{ secrets.READONLY_GITHUB_TOKEN }}
126-
run: |
127-
# ensure dorothy is cloned, and run command
128-
bash -c "$(curl -fsSL 'https://dorothy.bevry.me/install?slug=${{ needs.setup.outputs.SLUG }}&commit=${{ needs.setup.outputs.COMMIT }}')" -- --shells=bash,zsh,fish,nu,xonsh,elvish,dash,ksh --utils=carapace
127+
SLUG: ${{ needs.setup.outputs.SLUG }}
128+
COMMIT: ${{ needs.setup.outputs.COMMIT }}
129+
ACTION: install
130+
ARGUMENTS: -- --shells=bash,zsh,fish,nu,xonsh,elvish,dash,ksh --utils=carapace
129131
- name: "Dorothy Login Shell: bash"
130132
shell: bash -leo pipefail {0}
131133
run: |
@@ -186,24 +188,25 @@ jobs:
186188
runs-on: ubuntu-latest
187189
steps:
188190
- name: "Dorothy Check"
189-
env:
191+
uses: bevry/dorothy/.github/actions/dorothy-remote-action@master
192+
with:
190193
GITHUB_TOKEN: ${{ secrets.READONLY_GITHUB_TOKEN }}
191-
shell: bash -leo pipefail {0}
192-
run: |
193-
# ensure dorothy is cloned, and run command
194-
bash -c "$(curl -fsSL 'https://dorothy.bevry.me/check?slug=${{ needs.setup.outputs.SLUG }}&commit=${{ needs.setup.outputs.COMMIT }}')"
194+
SLUG: ${{ needs.setup.outputs.SLUG }}
195+
COMMIT: ${{ needs.setup.outputs.COMMIT }}
196+
ACTION: check
195197
format:
196198
needs: setup
197199
# if: false
198200
if: github.event_name == 'push'
199201
runs-on: ubuntu-latest
200202
steps:
201203
- name: "Dorothy Format"
202-
env:
204+
uses: bevry/dorothy/.github/actions/dorothy-remote-action@master
205+
with:
203206
GITHUB_TOKEN: ${{ secrets.READONLY_GITHUB_TOKEN }}
204-
run: |
205-
# ensure dorothy is cloned, and run command
206-
bash -c "$(curl -fsSL 'https://dorothy.bevry.me/format?slug=${{ needs.setup.outputs.SLUG }}&commit=${{ needs.setup.outputs.COMMIT }}')"
207+
SLUG: ${{ needs.setup.outputs.SLUG }}
208+
COMMIT: ${{ needs.setup.outputs.COMMIT }}
209+
ACTION: format
207210
- name: "Commit Changes"
208211
env:
209212
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # writable
@@ -238,24 +241,24 @@ jobs:
238241
steps:
239242
- name: "Uninstall Homebrew"
240243
if: matrix.mode == 'fresh'
241-
run: |
242-
# run homebrew uninstaller
243-
bash -c "$(curl -fsSL 'https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh')"
244+
run: bash -c "$(curl -fsSL 'https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh')"
244245
- name: "Dorothy Upgrade Bash Version"
245246
if: matrix.bash == 'bash'
246-
uses: bevry/dorothy/.github/actions/dorothy-run@master
247+
uses: bevry/dorothy/.github/actions/dorothy-remote-action@master
247248
with:
248249
GITHUB_TOKEN: ${{ secrets.READONLY_GITHUB_TOKEN }}
249250
SLUG: ${{ needs.setup.outputs.SLUG }}
250251
COMMIT: ${{ needs.setup.outputs.COMMIT }}
251-
COMMAND: "setup-util-bash"
252+
ACTION: run
253+
ARGUMENTS: -- setup-util-bash
252254
- name: "Dorothy Test Bash Version: ${{ matrix.bash }}"
253-
uses: bevry/dorothy/.github/actions/dorothy-run@master
255+
uses: bevry/dorothy/.github/actions/dorothy-remote-action@master
254256
with:
255257
GITHUB_TOKEN: ${{ secrets.READONLY_GITHUB_TOKEN }}
256258
SLUG: ${{ needs.setup.outputs.SLUG }}
257259
COMMIT: ${{ needs.setup.outputs.COMMIT }}
258-
COMMAND: "dorothy test --bash=${{ matrix.bash }}"
260+
ACTION: test
261+
ARGUMENTS: -- --bash=${{ matrix.bash }}
259262
windows-wsl-test:
260263
needs: setup
261264
# if: false
@@ -317,12 +320,13 @@ jobs:
317320
# continue-on-error: ${{ matrix.bash == '4.1' || matrix.bash == '4.2.53' || matrix.bash == '4.3.30' }}
318321
steps:
319322
- name: "Dorothy Test Bash Version: ${{ matrix.bash }}"
320-
uses: bevry/dorothy/.github/actions/dorothy-run@master
323+
uses: bevry/dorothy/.github/actions/dorothy-remote-action@master
321324
with:
322325
GITHUB_TOKEN: ${{ secrets.READONLY_GITHUB_TOKEN }}
323326
SLUG: ${{ needs.setup.outputs.SLUG }}
324327
COMMIT: ${{ needs.setup.outputs.COMMIT }}
325-
COMMAND: "dorothy test --bash=${{ matrix.bash }}"
328+
ACTION: test
329+
ARGUMENTS: -- --bash=${{ matrix.bash }}
326330
containers-x86-test:
327331
needs: setup
328332
# if: false
@@ -351,13 +355,14 @@ jobs:
351355
image: ${{ matrix.container }}
352356
steps:
353357
- name: "Dorothy Dependencies"
354-
uses: bevry/dorothy/.github/actions/dorothy-deps@master
358+
uses: bevry/dorothy/.github/actions/dorothy-dependencies@master
355359
- name: "Dorothy Test"
356-
uses: bevry/dorothy/.github/actions/dorothy-test@master
360+
uses: bevry/dorothy/.github/actions/dorothy-remote-action@master
357361
with:
358362
GITHUB_TOKEN: ${{ secrets.READONLY_GITHUB_TOKEN }}
359363
SLUG: ${{ needs.setup.outputs.SLUG }}
360364
COMMIT: ${{ needs.setup.outputs.COMMIT }}
365+
ACTION: test
361366
containers-arm-test:
362367
needs: setup
363368
# if: false
@@ -386,10 +391,11 @@ jobs:
386391
image: ${{ matrix.container }}
387392
steps:
388393
- name: "Dorothy Dependencies"
389-
uses: bevry/dorothy/.github/actions/dorothy-deps@master
394+
uses: bevry/dorothy/.github/actions/dorothy-dependencies@master
390395
- name: "Dorothy Test"
391-
uses: bevry/dorothy/.github/actions/dorothy-test@master
396+
uses: bevry/dorothy/.github/actions/dorothy-remote-action@master
392397
with:
393398
GITHUB_TOKEN: ${{ secrets.READONLY_GITHUB_TOKEN }}
394399
SLUG: ${{ needs.setup.outputs.SLUG }}
395400
COMMIT: ${{ needs.setup.outputs.COMMIT }}
401+
ACTION: test

commands/dorothy

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,6 +1281,8 @@ function dorothy_() (
12811281
else
12821282
intent='Check'
12831283
fi
1284+
1285+
# log
12841286
__print_style --h1="Dorothy $intent"
12851287

12861288
# pre-requisites
@@ -1433,7 +1435,19 @@ function dorothy_() (
14331435

14341436
# this is shared between [debug-bash] and [dorothy]
14351437
function act_test {
1436-
# process arguments
1438+
# log
1439+
__print_style --h1='Dorothy Tests'
1440+
1441+
# pre-requisites
1442+
ensure_dorothy_configured
1443+
ensure_minimal_dependencies
1444+
# ensure_development_dependencies <-- dev deps are for dev, not for tests
1445+
source "$DOROTHY/sources/ripgrep.bash"
1446+
1447+
# fixtures
1448+
git-helper sync --path="$DOROTHY/fixtures" --label='Dorothy Fixtures' --update=optional --url="$dorothy_fixtures_uri" || return $?
1449+
1450+
# now process arguments, as arguments depends on `debug-bash`, which depends on Dorothy existing
14371451
local item only=() skips=('dorothy' 'bash.bash') debug='' trace='' user_bash_binaries=()
14381452
while [[ $# -ne 0 ]]; do
14391453
item="$1"
@@ -1460,18 +1474,6 @@ function dorothy_() (
14601474
esac
14611475
done
14621476

1463-
# log
1464-
__print_style --h1='Dorothy Tests'
1465-
1466-
# pre-requisites
1467-
ensure_dorothy_configured
1468-
ensure_minimal_dependencies
1469-
# ensure_development_dependencies <-- dev deps are for dev, not for tests
1470-
source "$DOROTHY/sources/ripgrep.bash"
1471-
1472-
# fixtures
1473-
git-helper sync --path="$DOROTHY/fixtures" --label='Dorothy Fixtures' --update=optional --url="$dorothy_fixtures_uri" || return $?
1474-
14751477
# load bash binaries
14761478
local environment_bash_binary other_bash_binaries=() user_bash_binaries_string user_bash_binary
14771479
environment_bash_binary="$(type -P bash)"

0 commit comments

Comments
 (0)