aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuben Beltran del Rio <git@r.bdr.sh>2025-01-26 16:59:20 +0100
committerRuben Beltran del Rio <git@r.bdr.sh>2025-01-26 16:59:20 +0100
commitaece0e58f930f908dd06181c04ed40a1da4ee9c8 (patch)
treef7c71baf3ea12d2eba3106876b07e288cbad266c
parentb09ac886b7c6ca5f2248de1798a121b6d48bd858 (diff)
Add sourcehut build
-rw-r--r--.build.yml37
-rw-r--r--.gitlab-ci.yml14
-rw-r--r--Cargo.lock12
-rw-r--r--Cargo.toml2
-rw-r--r--Makefile27
5 files changed, 64 insertions, 28 deletions
diff --git a/.build.yml b/.build.yml
new file mode 100644
index 0000000..f528c4e
--- /dev/null
+++ b/.build.yml
@@ -0,0 +1,37 @@
+image: archlinux
+packages:
+ - make
+ - rsync
+ - coreutils
+ - lld
+ - rustup
+ - aarch64-linux-gnu-gcc
+ - tar
+ - gzip
+sources:
+ - git@git.sr.ht:~rbdr/lyricli
+secrets:
+ - 89d3b676-25d6-4942-8231-38b73aa62bf6
+ - 0b0d3e5e-fbdc-41d0-97ed-ee654fe797ff
+ - 51980156-3809-4f0e-993a-9c84fdf28b05
+tasks:
+ - set_rust: |
+ cd lyricli
+ make set_rust
+ - install_binstall: |
+ curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
+ - install_coverage_tool: |
+ cargo binstall cargo-tarpaulin --no-confirm
+ - install_builders: |
+ cargo binstall cargo-generate-rpm --no-confirm
+ cargo binstall cargo-deb --no-confirm
+ - configure_linker: |
+ cd lyricli
+ mkdir -p .cargo
+ echo '[target.aarch64-unknown-linux-gnu]' > .cargo/config.toml
+ echo 'linker = "aarch64-linux-gnu-gcc"' >> .cargo/config.toml
+ echo 'rustflags = ["-C", "link-arg=-fuse-ld=lld"]' >> .cargo/config.toml
+ - package: |
+ cd lyricli
+ cp ~/.lyricli.env .env
+ make ci
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
deleted file mode 100644
index 04ec6ba..0000000
--- a/.gitlab-ci.yml
+++ /dev/null
@@ -1,14 +0,0 @@
-image: lyriclitest/swift:5.0.1
-
-stages:
- - lint
-
-cache:
- key: ${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHA}
- paths:
- - .build/
-
-lint:
- stage: lint
- script:
- - make lint
diff --git a/Cargo.lock b/Cargo.lock
index 2800b09..7a47d68 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1,6 +1,6 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
-version = 3
+version = 4
[[package]]
name = "addr2line"
@@ -998,6 +998,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
[[package]]
+name = "openssl-src"
+version = "300.4.1+3.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "faa4eac4138c62414b5622d1b31c5c304f34b406b013c079c2bbc652fdd6678c"
+dependencies = [
+ "cc",
+]
+
+[[package]]
name = "openssl-sys"
version = "0.9.101"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1005,6 +1014,7 @@ checksum = "dda2b0f344e78efc2facf7d195d098df0dd72151b26ab98da807afc26c198dff"
dependencies = [
"cc",
"libc",
+ "openssl-src",
"pkg-config",
"vcpkg",
]
diff --git a/Cargo.toml b/Cargo.toml
index cb0850d..e2c8ce5 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -14,7 +14,7 @@ path = "src/main.rs"
[dependencies]
clap = { version = "4.5.2", features = ["derive"] }
percent-encoding = "2.3.1"
-reqwest = { version = "0.11", features = ["json"] }
+reqwest = { version = "0.11", features = ["json", "native-tls", "native-tls-vendored"] }
scraper = "0.19.0"
serde = { version = "1.0.197", features = ["derive"] }
serde_json = "1.0.114"
diff --git a/Makefile b/Makefile
index 07cc42f..b763d51 100644
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,6 @@ target = $(shell rustc -vV | grep host | awk '{print $$2}')
architectures := x86_64-unknown-linux-gnu aarch64-unknown-linux-gnu
app_name := lrc
long_app_name := lyricli
-host_architecture := $(target)
default: build
@@ -14,15 +13,20 @@ prepare:
rustup target add $(target)
build: prepare
-# I need an actually configurable way to make this work. Right now i'm only
-# cross compiling in the CI, and I know what I'm running, but
-ifeq ($(host_architecture), x86_64-unknown-linux-gnu)
-ifeq ($(target), aarch64-unknown-linux-gnu)
- LD_LIBRARY_PATH=/usr/local/aarch64-linux-gnu/lib:${LD_LIBRARY_PATH}
-endif
-endif
@export $$(cat .env | xargs) > /dev/null 2>&1 && cargo build --profile $(profile) --target $(target)
+test:
+ cargo test
+
+coverage:
+ cargo tarpaulin
+
+format:
+ cargo fmt && cargo clippy --fix
+
+lint:
+ cargo fmt -- --check && cargo clippy
+
release: rpm tar deb
@$(eval filename := $(app_name)-$(target)-$(channel))
@@ -70,12 +74,11 @@ else
$(MAKE) -e profile=release -e architectures='$(mac_architectures)' -e channel=$(tag) package
endif
-
-ci:
+ci: lint coverage
ifeq ($(GIT_REF),refs/heads/main)
- $(MAKE) -e profile=release -e channel=unstable $(target)
+ $(MAKE) -e profile=release -e channel=unstable package
else ifneq (,$(findstring refs/tags/,$(GIT_REF)))
- $(MAKE) -e profile=release -e channel=$(subst refs/tags/,,$(GIT_REF)) $(target)
+ $(MAKE) -e profile=release -e channel=$(subst refs/tags/,,$(GIT_REF)) package
endif
.PHONY: default build $(architectures) rpm package prepare set_rust ci release