Skip to content

Commit

Permalink
wip: create separate goldboot-linux crate
Browse files Browse the repository at this point in the history
  • Loading branch information
cilki committed Jun 2, 2024
1 parent f3bea8d commit 21ad421
Show file tree
Hide file tree
Showing 22 changed files with 114 additions and 122 deletions.
8 changes: 0 additions & 8 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ jobs:
name: stable / fmt
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install stable
uses: dtolnay/rust-toolchain@stable
with:
Expand All @@ -49,8 +47,6 @@ jobs:
toolchain: [stable, beta]
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install ${{ matrix.toolchain }}
uses: dtolnay/rust-toolchain@master
with:
Expand All @@ -71,8 +67,6 @@ jobs:
steps:
- run: sudo apt-get install -y libpango1.0-dev libgraphene-1.0-dev
- uses: actions/checkout@v4
with:
submodules: true
- name: Install nightly
uses: dtolnay/rust-toolchain@nightly
- name: cargo doc
Expand All @@ -91,8 +85,6 @@ jobs:
name: ubuntu / ${{ matrix.msrv }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install ${{ matrix.msrv }}
uses: dtolnay/rust-toolchain@master
with:
Expand Down
72 changes: 40 additions & 32 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,32 +30,20 @@ jobs:
fail-fast: false
matrix:
target:
# TODO: re-enable these. Problems arise with cross-rs because the base
# image doesn't have libgtk-4-dev...
# - aarch64-unknown-linux-gnu
# - aarch64-unknown-linux-musl
# - i686-unknown-linux-gnu
- aarch64-unknown-linux-gnu
- aarch64-unknown-linux-musl
- i686-unknown-linux-gnu
- x86_64-unknown-linux-gnu
# - x86_64-unknown-linux-musl
- x86_64-unknown-linux-musl
steps:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libudev-dev libgtk-4-dev libglib2.0-dev
- uses: actions/checkout@v4
with:
fetch-tags: true

- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true

- uses: actions-rs/cargo@v1
with:
command: build
args: --release --target ${{ matrix.target }} --features gui
args: --release --target ${{ matrix.target }} --exclude goldboot-linux

- uses: actions/upload-artifact@v4
with:
Expand All @@ -79,26 +67,45 @@ jobs:
done
goldboot-linux:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
needs: linux
steps:
- uses: actions/download-artifact@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libudev-dev libgtk-4-dev libglib2.0-dev
- uses: actions-rs/toolchain@v1
with:
name: goldboot-x86_64-unknown-linux-musl
path: linux-amd64
toolchain: nightly
override: true

- uses: actions-rs/cargo@v1
with:
command: build
args: --release

- name: Build goldboot-linux image x86_64
run: |
export RUST_BACKTRACE=1
export RUST_LOG=debug
chmod +x linux-amd64/goldboot
linux-amd64/goldboot init --os Goldboot
linux-amd64/goldboot cast --output goldboot-linux-x86_64.gb .
target/release/goldboot init --os Goldboot --executable target/release/goldboot-linux
target/release/goldboot cast --output goldboot-linux-x86_64.gb .
- uses: actions/upload-artifact@v4
with:
name: goldboot-linux-x86_64.gb
path: goldboot-linux-x86_64.gb
- name: Upload artifacts to release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
run: |
for tag in $(git tag --points-at HEAD); do
if [ "${tag%-*}" = "goldboot-linux" ]; then
mv target/release/${tag%-*} "${tag%-*}_x86_64-unknown-linux-gnu"
gh release upload "${tag}" "${tag%-*}_x86_64-unknown-linux-gnu"
mv goldboot-linux-x86_64.gb "${tag%-*}_x86_64-unknown-linux-gnu.gb"
gh release upload "${tag}" "${tag%-*}_x86_64-unknown-linux-gnu.gb"
fi
done
macos:
runs-on: macos-latest
Expand All @@ -116,7 +123,7 @@ jobs:
- uses: actions-rs/cargo@v1
with:
command: build
args: --release
args: --release --exclude goldboot-linux

- uses: actions/upload-artifact@v4
with:
Expand Down Expand Up @@ -150,7 +157,7 @@ jobs:
- uses: actions-rs/cargo@v1
with:
command: build
args: --release
args: --release --exclude goldboot-linux

- uses: actions/upload-artifact@v4
with:
Expand Down Expand Up @@ -247,7 +254,6 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-tags: true

- name: Find version tags
Expand All @@ -271,12 +277,14 @@ jobs:
run: |
echo "${AUR_PRIVATE_KEY}" >/tmp/id_rsa
chmod 600 /tmp/id_rsa
cd dist/pacman/${{ matrix.package }}
git config --global user.name "github-actions"
git config --global user.email "[email protected]"
ssh-keyscan -H aur.archlinux.org >/tmp/known_hosts
GIT_SSH_COMMAND='ssh -i /tmp/id_rsa -o UserKnownHostsFile=/tmp/known_hosts' git submodule update --init dist/pacman/${{ matrix.package }}
cd dist/pacman/${{ matrix.package }}
git add .SRCINFO PKGBUILD
git commit -m "release: ${{ steps.get_tags.outputs.pkgver }}"
GIT_SSH_COMMAND='ssh -i /tmp/id_rsa -o UserKnownHostsFile=/tmp/known_hosts' git push -u origin master
53 changes: 0 additions & 53 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ jobs:
steps:
- run: sudo apt-get install -y libpango1.0-dev libgraphene-1.0-dev libudev-dev libgtk-4-dev libglib2.0-dev
- uses: actions/checkout@v4
with:
submodules: true
- name: Install ${{ matrix.toolchain }}
uses: dtolnay/rust-toolchain@master
with:
Expand Down Expand Up @@ -62,61 +60,10 @@ jobs:
# - run: vcpkg install openssl:x64-windows-static-md
# if: runner.os == 'Windows'
- uses: actions/checkout@v4
with:
submodules: true
- name: Install stable
uses: dtolnay/rust-toolchain@stable
- name: cargo generate-lockfile
if: hashFiles('Cargo.lock') == ''
run: cargo generate-lockfile
- name: cargo test
run: cargo test --locked --all-features --all-targets
coverage:
# use llvm-cov to build and collect coverage and outputs in a format that
# is compatible with codecov.io
#
# note that codecov as of v4 requires that CODECOV_TOKEN from
#
# https://app.codecov.io/gh/<user or org>/<project>/settings
#
# is set in two places on your repo:
#
# - https://github.com/jonhoo/guardian/settings/secrets/actions
# - https://github.com/jonhoo/guardian/settings/secrets/dependabot
#
# (the former is needed for codecov uploads to work with Dependabot PRs)
#
# PRs coming from forks of your repo will not have access to the token, but
# for those, codecov allows uploading coverage reports without a token.
# it's all a little weird and inconvenient. see
#
# https://github.com/codecov/feedback/issues/112
#
# for lots of more discussion
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'chore: release')"
name: ubuntu / stable / coverage
steps:
- run: sudo apt-get install -y libpango1.0-dev libgraphene-1.0-dev libudev-dev libgtk-4-dev libglib2.0-dev
- uses: actions/checkout@v4
with:
submodules: true
- name: Install stable
uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- name: cargo install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: cargo generate-lockfile
if: hashFiles('Cargo.lock') == ''
run: cargo generate-lockfile
- name: cargo llvm-cov
run: cargo llvm-cov --locked --all-features --lcov --output-path lcov.info
- name: Record Rust version
run: echo "RUST=$(rustc --version)" >> "$GITHUB_ENV"
- name: Upload to codecov.io
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
env_vars: OS,RUST
25 changes: 19 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ strip = true
members = [
"goldboot",
"goldboot-image",
"goldboot-linux",
"goldboot-macros",
"goldboot-registry",
]
25 changes: 25 additions & 0 deletions goldboot-linux/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[package]
authors = ["Tyler Cook"]
description = "A command-line application for building goldboot images"
edition = "2021"
homepage = "https://goldboot.org"
license = "AGPL-3.0-only"
name = "goldboot-linux"
repository = "https://github.com/fossable/goldboot"
rust-version = "1.74"
version = "0.0.1"

[dependencies]
block-utils = { version = "0.11.1" }
built = { version = "0.7", features = ["chrono", "semver"] }
clap = { version = "4.4.7", features = ["derive", "string"] }
gdk4 = { version = "0.8.1" }
gdk-pixbuf = { version = "0.19.2" }
glib-macros = { version = "0.19.2" }
glib = { version = "0.19.2" }
goldboot-image = { path="../goldboot-image", version = "0.0.2" }
goldboot = { path="../goldboot", version = "0.0.7" }
gtk4 = { version = "0.8.1", features = ["v4_12"] }
tracing = "0.1.40"
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
ubyte = "0.10.4"
4 changes: 4 additions & 0 deletions goldboot-linux/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
## goldboot-linux

This crate is loaded into a special Linux distribution used to apply `goldboot`
images.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::gui::load_png;
use crate::library::ImageLibrary;
use gdk4 as gdk;
use goldboot::library::ImageLibrary;
use goldboot_image::ImageHandle;
use gtk::glib;
use gtk4 as gtk;
Expand All @@ -10,19 +10,19 @@ use ubyte::ToByteUnit;

pub fn init(window: &'static gtk::ApplicationWindow) {
let container = gtk::Box::new(gtk::Orientation::Vertical, 5);
if crate::built_info::PROFILE == "debug" {
if goldboot::built_info::PROFILE == "debug" {
let version = gtk::Label::new(Some(&format!(
"goldboot v{}-{} ({})",
crate::built_info::PKG_VERSION,
if crate::built_info::GIT_DIRTY.unwrap() {
goldboot::built_info::PKG_VERSION,
if goldboot::built_info::GIT_DIRTY.unwrap() {
format!(
"{}_dirty",
crate::built_info::GIT_COMMIT_HASH_SHORT.unwrap()
goldboot::built_info::GIT_COMMIT_HASH_SHORT.unwrap()
)
} else {
format!("{}", crate::built_info::GIT_COMMIT_HASH_SHORT.unwrap())
format!("{}", goldboot::built_info::GIT_COMMIT_HASH_SHORT.unwrap())
},
built::util::strptime(crate::built_info::BUILT_TIME_UTC),
built::util::strptime(goldboot::built_info::BUILT_TIME_UTC),
)));
version.add_css_class("versionLabel");
container.append(&version);
Expand Down
17 changes: 17 additions & 0 deletions goldboot-linux/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
use clap::Parser;
use std::process::ExitCode;

pub mod gui;

#[derive(Parser, Debug)]
#[clap(author, version, about, long_about = None)]
struct CommandLine {
/// Run the GUI in fullscreen mode
#[clap(long, num_args = 0)]
fullscreen: bool,
}

fn main() -> ExitCode {
let command_line = CommandLine::parse();
crate::gui::load_gui(command_line.fullscreen)
}
Loading

0 comments on commit 21ad421

Please sign in to comment.