Skip to content

Commit

Permalink
Update CI scripts (osa1#422)
Browse files Browse the repository at this point in the history
- Update Ubuntu from 20.04 to 22.04.

- Test statically linked builds in PRs to make sure we don't break the build
  when updating dependencies.
  • Loading branch information
osa1 authored Nov 12, 2023
1 parent e125c77 commit 5e36aa2
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 21 deletions.
56 changes: 53 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on: [push, pull_request]
jobs:
Check_formatting:
name: 'Check formatting'
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2

Expand All @@ -21,7 +21,7 @@ jobs:

Linux_default:
name: '[Linux, default] Build and test'
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2

Expand All @@ -42,7 +42,7 @@ jobs:

Linux_native_tls_notif:
name: '[Linux, native TLS + notifications] Build and test'
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2

Expand Down Expand Up @@ -109,3 +109,53 @@ jobs:
run: |
cargo test --no-default-features \
--features "tls-native desktop-notifications"
# Updating dependencies can break the static build.
Linux_static_build_default:
name: Make statically linked executable (default)
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2

- name: Install native dependencies
run: |
sudo apt-get update
sudo apt-get install libdbus-1-dev pkg-config libssl-dev \
musl musl-dev musl-tools
- name: Get stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: x86_64-unknown-linux-musl
override: true

- name: '[Linux] Make statically linked executable'
run: |
RUST_BACKTRACE=1 \
cargo build --release --verbose --target=x86_64-unknown-linux-musl
Linux_static_build_desktop_notifications:
name: '[Linux] Make statically linked executable (desktop notifications)'
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2

- name: Install native dependencies
run: |
sudo apt-get update
sudo apt-get install libdbus-1-dev pkg-config libssl-dev \
musl musl-dev musl-tools
- name: Get stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: x86_64-unknown-linux-musl
override: true

- name: Make statically linked executable
run: |
RUST_BACKTRACE=1 \
cargo build --release --verbose --target=x86_64-unknown-linux-musl \
--features=desktop-notifications
34 changes: 16 additions & 18 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
jobs:
make_release:
name: Make release
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2

Expand Down Expand Up @@ -40,43 +40,41 @@ jobs:
- name: Make release tarball (default)
run: |
(cd crates/tiny && cargo build --release --verbose)
tar -C target/release -czvf tiny-ubuntu-20.04.tar.gz tiny
tar -C target/release -czvf tiny-ubuntu-22.04.tar.gz tiny
- name: Make release tarball (default, statically linked)
run: |
(cd crates/tiny && RUST_BACKTRACE=1 \
cargo build --release --verbose --target=x86_64-unknown-linux-musl)
tar -C target/x86_64-unknown-linux-musl/release \
-czvf tiny-ubuntu-20.04-static.tar.gz tiny
-czvf tiny-ubuntu-22.04-static.tar.gz tiny
- name: Make release tarball (libssl)
run: |
(cd crates/tiny && cargo build --release --verbose \
--no-default-features --features="tls-native")
tar -C target/release -czvf tiny-ubuntu-20.04-libssl.tar.gz tiny
tar -C target/release -czvf tiny-ubuntu-22.04-libssl.tar.gz tiny
- name: Make release tarball (libdbus)
run: |
(cd crates/tiny && cargo build --release --verbose \
--no-default-features --features="tls-rustls desktop-notifications")
tar -C target/release -czvf tiny-ubuntu-20.04-dbus.tar.gz tiny
tar -C target/release -czvf tiny-ubuntu-22.04-dbus.tar.gz tiny
- name: Make release tarball (libssl + libdbus)
run: |
(cd crates/tiny && cargo build --release --verbose \
--no-default-features --features="tls-native desktop-notifications")
tar -C target/release -czvf tiny-ubuntu-20.04-libssl-dbus.tar.gz tiny
# TODO: Can I not do this in one step?
tar -C target/release -czvf tiny-ubuntu-22.04-libssl-dbus.tar.gz tiny
- name: Upload executable (1/5)
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: tiny-ubuntu-20.04.tar.gz
asset_name: tiny-ubuntu-20.04.tar.gz
asset_path: tiny-ubuntu-22.04.tar.gz
asset_name: tiny-ubuntu-22.04.tar.gz
asset_content_type: application/gzip

- name: Upload executable (2/5)
Expand All @@ -85,8 +83,8 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: tiny-ubuntu-20.04-static.tar.gz
asset_name: tiny-ubuntu-20.04-static.tar.gz
asset_path: tiny-ubuntu-22.04-static.tar.gz
asset_name: tiny-ubuntu-22.04-static.tar.gz
asset_content_type: application/gzip

- name: Upload executable (3/5)
Expand All @@ -95,8 +93,8 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: tiny-ubuntu-20.04-libssl.tar.gz
asset_name: tiny-ubuntu-20.04-libssl.tar.gz
asset_path: tiny-ubuntu-22.04-libssl.tar.gz
asset_name: tiny-ubuntu-22.04-libssl.tar.gz
asset_content_type: application/gzip

- name: Upload executable (4/5)
Expand All @@ -105,8 +103,8 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: tiny-ubuntu-20.04-dbus.tar.gz
asset_name: tiny-ubuntu-20.04-dbus.tar.gz
asset_path: tiny-ubuntu-22.04-dbus.tar.gz
asset_name: tiny-ubuntu-22.04-dbus.tar.gz
asset_content_type: application/gzip

- name: Upload executable (5/5)
Expand All @@ -115,6 +113,6 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: tiny-ubuntu-20.04-libssl-dbus.tar.gz
asset_name: tiny-ubuntu-20.04-libssl-dbus.tar.gz
asset_path: tiny-ubuntu-22.04-libssl-dbus.tar.gz
asset_name: tiny-ubuntu-22.04-libssl-dbus.tar.gz
asset_content_type: application/gzip

0 comments on commit 5e36aa2

Please sign in to comment.