-
Notifications
You must be signed in to change notification settings - Fork 0
Add GitHub Actions for CI and Release #2
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main, master] | ||
| pull_request: | ||
| branches: [main, master] | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| build-and-test: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Racket | ||
| uses: Bogdanp/setup-racket@v1.11 | ||
| with: | ||
| architecture: x64 | ||
| distribution: full | ||
| version: stable | ||
|
|
||
| - name: Compile | ||
| run: | | ||
| raco make randstr/main.rkt | ||
| raco make randstr/cli/main.rkt | ||
|
Comment on lines
+27
to
+30
|
||
|
|
||
| - name: Run tests | ||
| run: | | ||
| racket randstr/tests/test.rkt | ||
| racket randstr/tests/test-extensions.rkt | ||
|
Comment on lines
+32
to
+35
|
||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,83 @@ | ||||||||||
| name: Release | ||||||||||
|
|
||||||||||
| on: | ||||||||||
| release: | ||||||||||
| types: [published] | ||||||||||
|
|
||||||||||
| permissions: | ||||||||||
| contents: write | ||||||||||
|
|
||||||||||
| jobs: | ||||||||||
| build-executables: | ||||||||||
| strategy: | ||||||||||
| matrix: | ||||||||||
| include: | ||||||||||
| - os: ubuntu-latest | ||||||||||
| platform: linux | ||||||||||
| arch: x64 | ||||||||||
| ext: "" | ||||||||||
| - os: macos-13 | ||||||||||
| platform: macos | ||||||||||
| arch: x64 | ||||||||||
| ext: "" | ||||||||||
| - os: macos-latest | ||||||||||
| platform: macos | ||||||||||
| arch: arm64 | ||||||||||
| ext: "" | ||||||||||
| - os: windows-latest | ||||||||||
| platform: windows | ||||||||||
| arch: x64 | ||||||||||
| ext: ".exe" | ||||||||||
|
|
||||||||||
| runs-on: ${{ matrix.os }} | ||||||||||
|
|
||||||||||
| steps: | ||||||||||
| - name: Checkout repository | ||||||||||
| uses: actions/checkout@v4 | ||||||||||
|
|
||||||||||
| - name: Setup Racket | ||||||||||
| uses: Bogdanp/setup-racket@v1.11 | ||||||||||
| with: | ||||||||||
| architecture: ${{ matrix.arch }} | ||||||||||
| distribution: full | ||||||||||
| version: stable | ||||||||||
|
|
||||||||||
| - name: Compile | ||||||||||
| run: | | ||||||||||
| raco make randstr/main.rkt | ||||||||||
| raco make randstr/cli/main.rkt | ||||||||||
|
Comment on lines
+45
to
+48
|
||||||||||
|
|
||||||||||
| - name: Build executable | ||||||||||
| run: raco exe -o randstr${{ matrix.ext }} randstr/cli/main.rkt | ||||||||||
|
|
||||||||||
| - name: Create distribution (Unix) | ||||||||||
| if: matrix.platform != 'windows' | ||||||||||
| run: raco distribute dist randstr | ||||||||||
|
|
||||||||||
| - name: Create distribution (Windows) | ||||||||||
| if: matrix.platform == 'windows' | ||||||||||
| run: raco distribute dist randstr.exe | ||||||||||
|
|
||||||||||
| - name: Archive distribution (Unix) | ||||||||||
| if: matrix.platform != 'windows' | ||||||||||
| run: | | ||||||||||
| cd dist | ||||||||||
| tar -czvf ../randstr-${{ matrix.platform }}-${{ matrix.arch }}.tar.gz . | ||||||||||
|
Comment on lines
+64
to
+65
|
||||||||||
| cd dist | |
| tar -czvf ../randstr-${{ matrix.platform }}-${{ matrix.arch }}.tar.gz . | |
| mv dist randstr-${{ matrix.platform }}-${{ matrix.arch }} | |
| tar -czvf randstr-${{ matrix.platform }}-${{ matrix.arch }}.tar.gz randstr-${{ matrix.platform }}-${{ matrix.arch }} |
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.
The CI workflow only tests on ubuntu-latest, but the release workflow builds for multiple platforms (Linux, macOS x64, macOS arm64, Windows). Consider adding a matrix strategy to test on multiple operating systems to catch platform-specific issues before release. This is especially important since the release workflow creates executables for Windows and macOS without prior testing on those platforms.