Skip to content

Commit

Permalink
refactor: merge check and test for one backend
Browse files Browse the repository at this point in the history
  • Loading branch information
peter-jerry-ye committed May 11, 2024
1 parent ed158da commit 286c13e
Showing 1 changed file with 5 additions and 47 deletions.
52 changes: 5 additions & 47 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: macos-14
path: mac_m1
- name: windows-latest
backend: [wasm, wasm-gc, js]
runs-on: ${{ matrix.os.name }}
continue-on-error: ${{ matrix.os.name == 'macos-14' }}
steps:
Expand All @@ -40,37 +40,15 @@ jobs:
moon version --all
moonrun --version
- name: moon check
- name: moon check and test
if: ${{ matrix.os.name != 'windows-latest' }}
run: |
moon update
failed_directories=()
for dir in examples/*; do
if [ -d "$dir" ]; then
echo "Processing $dir"
if ! (cd "$dir" && moon install && moon check --target wasm && moon check --target wasm-gc && moon check --target js); then
echo "Failed in $dir"
failed_directories+=("$dir")
fi
fi
done
if [ ${#failed_directories[@]} -ne 0 ]; then
echo "Commands failed in the following directories:"
for dir in "${failed_directories[@]}"; do
echo "$dir"
done
exit 1
fi
- name: moon test
if: ${{ matrix.os.name != 'windows-latest' }}
run: |
moon update
failed_directories=()
for dir in examples/*; do
if [ -d "$dir" ]; then
echo "Processing $dir"
if ! (cd "$dir" && moon install moon test --target wasm && moon test --target wasm-gc && moon test --target js); then
if ! (cd "$dir" && moon install && moon check --target ${{ matrix.backend }} && moon test --target ${{ matrix.backend }}); then
echo "Failed in $dir"
failed_directories+=("$dir")
fi
Expand All @@ -90,35 +68,15 @@ jobs:
find ./target -name '*.wasm' | xargs ls -lh
find ./target -name '*.js' | xargs ls -lh
- name: moon check on windows
if: ${{ matrix.os.name == 'windows-latest' }}
run: |
moon update
$failed_directories = @()
Get-ChildItem -Path ".\examples" -Directory | ForEach-Object {
Write-Output "Processing $($_.FullName)"
Set-Location $_.FullName
if (!(moon install) -or !(moon check --target wasm) -or !(moon check --target wasm-gc) -or !(moon check --target js)) {
Write-Output "Failed in $($_.FullName)"
$failed_directories += $_.FullName
}
Set-Location -Path $env:GITHUB_WORKSPACE
}
if ($failed_directories.Count -ne 0) {
Write-Output "Commands failed in the following directories:"
$failed_directories | ForEach-Object { Write-Output $_ }
exit 1
}
- name: moon test on windows
- name: moon check and test on windows
if: ${{ matrix.os.name == 'windows-latest' }}
run: |
moon update
$failed_directories = @()
Get-ChildItem -Path ".\examples" -Directory | ForEach-Object {
Write-Output "Processing $($_.FullName)"
Set-Location $_.FullName
if (!(moon install) -or !(moon test --target wasm) -or !(moon test --target wasm-gc) -or !(moon test --target js)) {
if (!(moon install) -or !(moon check --target ${{ matrix.backend }}) -or !(moon test --target ${{ matrix.backend }})) {
Write-Output "Failed in $($_.FullName)"
$failed_directories += $_.FullName
}
Expand Down

0 comments on commit 286c13e

Please sign in to comment.