Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,55 @@ jobs:
floki*.zip
floki*.tar.gz


rpm:
name: Build and test RPM using cargo generate-rpm
runs-on: ubuntu-24.04
needs: build
steps:
- uses: actions/checkout@v5
- name: Install rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- name: Install cargo-generate-rpm
run: cargo install cargo-generate-rpm
# Download the ubuntu artifact instead of rebuilding.
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: stableartifacts-ubuntu-24.04
- name: Build RPM
run: |
tar -xzvf floki*.tar.gz
mkdir -p target/release
cp floki target/release/floki
cargo generate-rpm
- name: Debug
run: |
set -ex

ls -ltR .
ls -l /usr/bin

- name: Install RPM
run: find . -name "floki*.rpm" | xargs sudo rpm -ivh
- name: Test installation
run: floki -V
- name: Archive artifacts
uses: actions/upload-artifact@v4
with:
name: rpm
path: |
target/generate-rpm/floki*.rpm

publish:
name: Publish release artifact
runs-on: ubuntu-latest
if: github.ref_type == 'tag'
needs:
- build
- rpm
# Required to publish a release
permissions:
contents: write
Expand All @@ -97,6 +140,10 @@ jobs:
uses: actions/download-artifact@v5
with:
name: stableartifacts-macos-latest
- name: Download RPM
uses: actions/download-artifact@v5
with:
name: rpm
- name: Generate release.txt
run: "./changelog.sh"
- name: Release
Expand All @@ -106,6 +153,7 @@ jobs:
files: |
floki*.zip
floki*.tar.gz
floki*.rpm
# # Announce the release
# - run: "./announce.sh"
# env:
Expand All @@ -117,6 +165,7 @@ jobs:
if: github.ref_type != 'tag'
needs:
- build
- rpm
steps:
- uses: actions/checkout@v5
- name: Install rust
Expand All @@ -136,6 +185,10 @@ jobs:
uses: actions/download-artifact@v5
with:
name: stableartifacts-macos-latest
- name: Download rpm
uses: actions/download-artifact@v5
with:
name: rpm
# Test generating release.txt
- name: Generate release.txt
run: "./changelog.sh"
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Status: Available for use

### Added
- Set minimum Rust version to 1.80
- Add configuration for [`cargo generate-rpm`](https://crates.io/crates/cargo-generate-rpm), allowing an RPM for floki to be built using Cargo against the project

### Fixed

Expand Down
8 changes: 8 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ shell-words = "1.1.0"
[dev-dependencies]
tempfile = "3.19.1"

[package.metadata.generate-rpm]
assets = [
{ source = "target/release/floki", dest = "/usr/bin/floki", mode = "0755" },
{ source = "LICENSE", dest = "/usr/share/doc/floki/LICENSE", doc = true, mode = "0644" },
]
require-sh = false
auto-req = "no" # Required to stop cargo generate-rpm introducing a dep on the RTLD

[profile.release]
strip = true # Automatically strip symbols from the binary.
opt-level = "z" # Optimize for size.
Expand Down
4 changes: 4 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ then
# Check that it's statically compiled!
ldd floki

# Strip .gnu.hash since floki is statically compiled.
# Required so that cargo-generate-rpm does not introduce a dependency on the RTLD.
strip --remove-section=.gnu.hash floki

tar -cvzf floki-${LABEL}.tar.gz floki
else
echo "Building release binary"
Expand Down