-
Notifications
You must be signed in to change notification settings - Fork 3
ci: ensure demos are built #58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughRemoved two separate D compiler workflow files and added a single consolidated GitHub Actions workflow ( Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (2)
.github/workflows/ldc.yml (1)
34-57: Consider refactoring to reduce duplication.These demo build steps follow the same repetitive pattern as in dmd.yml. Applying a similar matrix-based or loop-based approach would improve maintainability.
Refer to the refactoring suggestions in the dmd.yml review, which apply equally here. The verification script from dmd.yml will also confirm that all referenced demo directories exist.
.github/workflows/dmd.yml (1)
34-57: Consider refactoring repetitive demo builds for maintainability.The demo build steps are functional but create significant duplication. All referenced demo directories (clipboard, colors, hello, mouse, styles) exist and are correctly named.
Consider using a matrix strategy to reduce duplication:
- name: Build demos run: | for demo in clipboard colors hello mouse styles; do cd demos/$demo dub build cd ../.. doneOr with GitHub Actions matrix:
build-demos: needs: build strategy: matrix: os: [ubuntu-latest, windows-latest] dc: [dmd-latest] demo: [clipboard, colors, hello, mouse, styles] runs-on: ${{ matrix.os }} steps: - name: Checkout Source uses: actions/checkout@v6 - name: D Compiler Installation uses: dlang-community/setup-dlang@v2 with: compiler: ${{ matrix.dc }} - name: Build ${{ matrix.demo }} demo working-directory: demos/${{ matrix.demo }} run: dub build
3d9fb9c to
6c63f7c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 5
0732ec2 to
199b643
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
.github/workflows/build.yml (2)
18-22: Consider documenting the exclusion rationale.The matrix excludes
macos-latestwithdmd-latestandwindows-latestwithldc-latest. Adding a brief comment explaining why these combinations are excluded would help future maintainers understand the testing strategy.exclude: + # DMD not tested on macOS; LDC not tested on Windows - os: macos-latest dc: dmd-latest - os: windows-latest dc: ldc-latest
39-47: Improve error handling and directory navigation.The demo build loop has several reliability concerns:
- If a demo directory doesn't exist,
cdfails silently anddub buildruns in the wrong location- No verification that demo directories exist before attempting to build
- Relative path navigation assumes exact depth
Apply this diff to add fail-fast error handling:
- name: Build Demos shell: bash run: | + set -e for demo in clipboard colors hello mouse styles; do - cd demos/$demo - dub build || exit 1 - cd ../.. + pushd "demos/$demo" + dub build + popd doneThe improvements:
set -emakes the script exit immediately on any error (including failedcd)pushd/popdis more robust thancdwith relative paths- Quotes around the path handle edge cases with spaces
- The
|| exit 1is redundant withset -e
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
.github/workflows/build.yml(1 hunks).github/workflows/dmd.yml(0 hunks).github/workflows/ldc.yml(0 hunks)
💤 Files with no reviewable changes (2)
- .github/workflows/ldc.yml
- .github/workflows/dmd.yml
🔇 Additional comments (4)
.github/workflows/build.yml (4)
1-7: LGTM!The workflow name and trigger configuration are appropriate for a CI workflow that runs on pushes and pull requests to the main branch.
9-10: LGTM!Read-only content permissions follow the principle of least privilege and are appropriate for a build and test workflow.
27-28: No changes needed.actions/checkout@v6is the current major release and the correct version to use.Likely an incorrect or invalid review comment.
30-37: The D compiler setup action version is confirmed.dlang-community/setup-dlang@v2is the current major version (v2.0.0, released May 30, 2024) and is appropriate for use. The build and test configuration usingdub -q testfollows standard D language practices.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.