Skip to content

Commit f44b1b1

Browse files
committed
Run mix e2e.set_github_matrix task in CI to discover E2E tests
1 parent cd8f7e5 commit f44b1b1

File tree

2 files changed

+6
-45
lines changed

2 files changed

+6
-45
lines changed

.github/actions/run-e2e/action.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@ runs:
2222
uses: ./
2323
with:
2424
script: |
25-
${{ matrix.data.script }}
25+
${{ matrix.script }}
2626
- name: Assert output
27+
if: ${{ !!matrix.expected }}
2728
run: |
28-
expected="${{ matrix.data.expected }}"
29+
expected="${{ matrix.expected }}"
2930
output="${{steps.run.outputs.result}}"
3031
[[ "$output" != "$expected" ]] && echo "::error::❌ Expected '$expected', got '$output'" && exit 1
3132
echo "✅ Test passed, outputs.result: ${{toJSON(steps.run.outputs.result)}}"

.github/workflows/ci-cd.yml

Lines changed: 3 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -71,51 +71,11 @@ jobs:
7171
outputs:
7272
matrix: ${{ steps.set-matrix.outputs.matrix }}
7373
steps:
74-
- name: Checkout code
75-
uses: actions/checkout@v3
74+
- uses: actions/checkout@v3
75+
- uses: pkgxdev/dev@v0
7676
- id: set-matrix
7777
name: Discover E2E tests
78-
run: |
79-
log_content() {
80-
local content="$1"
81-
local label="${2:-}"
82-
83-
if [[ -n "$label" ]]; then
84-
# Replace the beginning of each line with two spaces
85-
local indented_content="${content//$'\n'/$'\n' }"
86-
printf "%s:\n %s\n" "$label" "$indented_content"
87-
else
88-
echo "$content"
89-
fi
90-
}
91-
92-
log_output() {
93-
echo ::group::Set outputs
94-
log_content "$(cat "$GITHUB_OUTPUT")" "GITHUB_OUTPUT"
95-
log_content "$(cat "$GITHUB_ENV")" "GITHUB_ENV"
96-
echo ::endgroup::
97-
}
98-
99-
set_output() {
100-
local value="$1"
101-
local output_key="$2"
102-
local env_key="${3:-}"
103-
104-
if [ -z "$value" ] || [ -z "$output_key" ]; then
105-
echo "Missing essential arguments to set_output_and_env"
106-
return 1
107-
fi
108-
109-
# If env_key is empty, convert output_key to upper snake case
110-
if [ -z "$env_key" ]; then
111-
env_key=$(echo "$output_key" | awk '{print toupper($0)}' | sed 's/-/_/g')
112-
fi
113-
114-
echo "$output_key=$value" >> "$GITHUB_OUTPUT"
115-
echo "$env_key=$value" >> "$GITHUB_ENV"
116-
}
117-
set_output "{\"include\":$(jq -c '[.[]]' test/e2e_tests.json)}" "matrix"
118-
log_output
78+
run: mix e2e.set_github_matrix matrix
11979

12080
e2e-tests:
12181
needs: [ build, e2e-tests-discovery ]

0 commit comments

Comments
 (0)