Skip to content
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

Run all tests #11

Merged
merged 2 commits into from
Jun 15, 2024
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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*.src.rpm
atuin-*/
*.tar.gz
*.tar.xz
23 changes: 14 additions & 9 deletions .packit.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
packages:
atuin:
specfile_path: rust-atuin.spec
files_to_sync:
- rust-atuin.spec
- .packit.yaml
specfile_path: atuin.spec
upstream_package_name: atuin
downstream_package_name: rust-atuin
downstream_package_name: atuin
actions:
fix-spec-file:
- sh -c 'tar -xf ${PACKIT_PROJECT_ARCHIVE}'
- sh -c 'rust2rpm --vendor ./atuin-${PACKIT_PROJECT_VERSION}'
# Note: These should not be automated because workspace packages vary case-by-case and rust2rpm does not support
# such automation. Adding simple sed expansion to make it more easily reproduced
# Patch the license file
- sh -c 'sed -i "/SourceLicense/{N;N;N;s/.*/cat license.txt/e}" ${PACKIT_DOWNSTREAM_PACKAGE_NAME}.spec'
# Change the default %cargo_install
- sh -c 'sed -i "s|%cargo_install|install -Dpm0755 target/rpm/atuin -t %{buildroot}%{_bindir}/|" ${PACKIT_DOWNSTREAM_PACKAGE_NAME}.spec'
create-archive:
- spectool -g -s0 rust-atuin.spec
- sh -c 'rust2rpm --vendor atuin ${PACKIT_PROJECT_VERSION}'
- sh -c 'echo atuin-${PACKIT_PROJECT_VERSION}.crate'
- spectool -g -s0 atuin.spec
- sh -c 'echo v${PACKIT_PROJECT_VERSION}.tar.gz'
get-current-version:
- rpmspec -q --qf "%{Version}" --srpm rust-atuin.spec
- rpmspec -q --qf "%{Version}" --srpm atuin.spec

srpm_build_deps:
- rust2rpm
Expand Down
104 changes: 104 additions & 0 deletions atuin.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# Generated by rust2rpm 26
%bcond_without check

Name: atuin
Version: 18.2.0
Release: %autorelease
Summary: magical shell history

%global _license %{shrink:
((Apache-2.0 OR MIT) AND BSD-3-Clause) AND
(0BSD OR MIT OR Apache-2.0) AND
(Apache-2.0) AND
(Apache-2.0 OR BSL-1.0) AND
(Apache-2.0 OR BSL-1.0 OR MIT) AND
(Apache-2.0 OR ISC OR MIT) AND
(Apache-2.0 OR MIT) AND
(Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT) AND
(BSD-2-Clause OR Apache-2.0 OR MIT) AND
(BSD-3-Clause) AND
(BSL-1.0) AND
(ISC) AND
(MIT) AND
(MIT AND BSD-3-Clause) AND
(MIT OR Apache-2.0) AND
(MIT OR Apache-2.0 OR BSD-1-Clause) AND
(MIT OR Apache-2.0 OR Zlib) AND
(MPL-2.0) AND
(Unlicense OR MIT)
}

License: %_license

URL: https://atuin.sh
Source: https://github.com/atuinsh/atuin/archive/refs/tags/v%{version}.tar.gz
Source: atuin-18.2.0-vendor.tar.xz

BuildRequires: cargo-rpm-macros >= 25
%if %{with check}
BuildRequires: postgresql-test-rpm-macros
%endif

%global _description %{expand:
Atuin replaces your existing shell history with a SQLite database, and records
additional context for your commands. Additionally, it provides optional and fully
encrypted synchronisation of your history between machines, via an Atuin server.
}

%description %{_description}

%prep
%autosetup -n atuin-%{version} -p1 -a1
%cargo_prep -v vendor

%build
%cargo_build
%{cargo_license_summary}
%{cargo_license} > LICENSE.dependencies
%{cargo_vendor_manifest}

%install
install -Dpm0755 target/rpm/atuin -t %{buildroot}%{_bindir}/
# Generate all of the shell-completions
for completion in bash fish zsh; do
%{buildroot}%{_bindir}/atuin gen-completions --shell $completion -o .
done
install -Dpm 644 atuin.bash %{buildroot}%{_datadir}/bash-completion/completions/atuin
install -Dpm 644 atuin.fish %{buildroot}%{_datadir}/fish/completions/atuin
install -Dpm 644 _atuin %{buildroot}%{_datadir}/zsh/site-functions/atuin

# Add atuin to default profile
mkdir -p %{buildroot}%{_sysconfdir}/profile.d
cat > %{buildroot}%{_sysconfdir}/profile.d/atuin.sh <<EOF
$(%{buildroot}%{_bindir}/atuin init bash)
EOF

%if %{with check}
%check
# start a postgres instance for the tests to use
export PGTESTS_LOCALE="C.UTF-8"
export PGTESTS_USERS="atuin:pass"
export PGTESTS_DATABASES="atuin:atuin"
export PGTESTS_PORT=5432
%postgresql_tests_run
%cargo_test
%endif

%files
%license LICENSE
%license atuin/LICENSE
%license LICENSE.dependencies
%license cargo-vendor.txt
%doc CHANGELOG.md
%doc CODE_OF_CONDUCT.md
%doc CONTRIBUTING.md
%doc CONTRIBUTORS
%doc README.md
%{_bindir}/atuin
%{_datadir}/bash-completion/completions/atuin
%{_datadir}/fish/completions/atuin
%{_datadir}/zsh/site-functions/atuin
%config %{_sysconfdir}/profile.d/atuin.sh

%changelog
%autochangelog
23 changes: 23 additions & 0 deletions license.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
%global _license %{shrink:
((Apache-2.0 OR MIT) AND BSD-3-Clause) AND
(0BSD OR MIT OR Apache-2.0) AND
(Apache-2.0) AND
(Apache-2.0 OR BSL-1.0) AND
(Apache-2.0 OR BSL-1.0 OR MIT) AND
(Apache-2.0 OR ISC OR MIT) AND
(Apache-2.0 OR MIT) AND
(Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT) AND
(BSD-2-Clause OR Apache-2.0 OR MIT) AND
(BSD-3-Clause) AND
(BSL-1.0) AND
(ISC) AND
(MIT) AND
(MIT AND BSD-3-Clause) AND
(MIT OR Apache-2.0) AND
(MIT OR Apache-2.0 OR BSD-1-Clause) AND
(MIT OR Apache-2.0 OR Zlib) AND
(MPL-2.0) AND
(Unlicense OR MIT)
}

License: %_license
78 changes: 0 additions & 78 deletions rust-atuin.spec

This file was deleted.

29 changes: 20 additions & 9 deletions rust2rpm.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
[package]
url = "https://atuin.sh"
source-url = "https://github.com/atuinsh/atuin/archive/refs/tags/v%{version}.tar.gz"
extra-files = [
"%{_datadir}/bash-completion/completions/atuin",
"%{_datadir}/fish/completions/atuin",
Expand All @@ -7,18 +9,27 @@ extra-files = [
]

summary = "magical shell history"
cargo-install-lib = true

description = "Atuin replaces your existing shell history with a SQLite database, and records additional context for your commands. Additionally, it provides optional and fully encrypted synchronisation of your history between machines, via an Atuin server."
description = """
Atuin replaces your existing shell history with a SQLite database, and records
additional context for your commands. Additionally, it provides optional and fully
encrypted synchronisation of your history between machines, via an Atuin server.
"""

[tests]
skip = [
"sync",
"change_password",
"multi_user_test",
"registration"
[requires]
test = [
"postgresql-test-rpm-macros",
]
comments = [
"These tests are skipped because they required a Postgres database to be running, which is not possible in the build environment."

[scripts.check]
pre = [
"# start a postgres instance for the tests to use",
"export PGTESTS_LOCALE=\"C.UTF-8\"",
"export PGTESTS_USERS=\"atuin:pass\"",
"export PGTESTS_DATABASES=\"atuin:atuin\"",
"export PGTESTS_PORT=5432",
"%postgresql_tests_run",
]


Expand Down