-
Notifications
You must be signed in to change notification settings - Fork 3
GitHub Actions: refactor better #10
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,106 @@ | ||
| name: Build | ||
|
|
||
| on: | ||
| workflow_call: | ||
|
|
||
| env: | ||
| CARGO_TERM_COLOR: always | ||
|
|
||
| jobs: | ||
| build-windows: | ||
| name: Build Windows (x86_64) | ||
| runs-on: windows-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Install Rust | ||
| uses: dtolnay/rust-toolchain@stable | ||
| with: | ||
| targets: x86_64-pc-windows-msvc | ||
|
|
||
| - name: Rust cache | ||
| uses: Swatinem/rust-cache@v2 | ||
|
|
||
| - name: Build (release) | ||
| run: cargo build --release --locked --target x86_64-pc-windows-msvc | ||
|
|
||
| - name: Stage artifact | ||
| shell: pwsh | ||
| run: | | ||
| New-Item -ItemType Directory -Force -Path dist | Out-Null | ||
| Copy-Item -Force target\x86_64-pc-windows-msvc\release\tise.exe dist\tise-windows-x86_64.exe | ||
|
|
||
| - name: Upload artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: windows | ||
| path: dist/tise-windows-x86_64.exe | ||
| if-no-files-found: error | ||
|
|
||
| build-linux-gnu: | ||
| name: Build Linux glibc (x86_64) | ||
| runs-on: ubuntu-22.04 | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Install Rust | ||
| uses: dtolnay/rust-toolchain@stable | ||
|
|
||
| - name: Rust cache | ||
| uses: Swatinem/rust-cache@v2 | ||
|
|
||
| - name: Install Linux build deps | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y \ | ||
| binutils \ | ||
| libx11-dev \ | ||
| libx11-xcb-dev \ | ||
| libxkbcommon-dev \ | ||
| libwayland-dev \ | ||
| libxcb-shape0-dev \ | ||
| libxcb-xfixes0-dev | ||
|
|
||
| - name: Build (release) | ||
| run: cargo build --release --locked | ||
|
|
||
| - name: Stage artifact | ||
| run: | | ||
| mkdir -p dist | ||
| cp target/release/tise dist/tise-linux-x86_64-gnu | ||
| chmod +x dist/tise-linux-x86_64-gnu | ||
|
|
||
| - name: Verify GLIBC compatibility | ||
| shell: bash | ||
| run: | | ||
| set -euo pipefail | ||
| bin="dist/tise-linux-x86_64-gnu" | ||
|
|
||
| echo "::group::ldd output" | ||
| ldd "$bin" || true | ||
| echo "::endgroup::" | ||
|
|
||
| # Determine the newest GLIBC symbol version the binary requires. | ||
| # Building on an older runner keeps this requirement low and maximizes distro compatibility. | ||
| max_glibc=$(objdump -T "$bin" | grep -oE 'GLIBC_[0-9]+\.[0-9]+' | sort -V | tail -n1 || true) | ||
| echo "Max GLIBC required: ${max_glibc:-<none>}" | ||
| if [[ -z "${max_glibc}" ]]; then | ||
| echo "No GLIBC symbol versions found (unexpected for a GNU build)." | ||
| exit 1 | ||
| fi | ||
|
|
||
| # ubuntu-22.04 ships glibc 2.35; requiring newer likely breaks older distros. | ||
| allowed="GLIBC_2.35" | ||
| newest=$(printf '%s\n' "$allowed" "$max_glibc" | sort -V | tail -n1) | ||
| if [[ "$newest" != "$allowed" ]]; then | ||
| echo "Binary requires $max_glibc, which is newer than allowed $allowed" | ||
| exit 1 | ||
| fi | ||
| echo "OK: $max_glibc <= $allowed" | ||
|
|
||
| - name: Upload artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: linux-gnu | ||
| path: dist/tise-linux-x86_64-gnu | ||
| if-no-files-found: error |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.