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

ci: upload build artifacts & prep for homebrew/winget support #561

Merged
merged 28 commits into from May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
f902db2
chore: remove clarinet from pkg-version-bump ci
MicaiahReid Apr 8, 2024
d6d4919
build: upload build for multiple architectures
MicaiahReid Apr 8, 2024
024a6cf
remove test precondition to build images
MicaiahReid Apr 8, 2024
8a81861
try to fix running test with cov
MicaiahReid Apr 8, 2024
b8e51e0
fix build
MicaiahReid Apr 8, 2024
d31098b
remove --test-threads flag
MicaiahReid Apr 8, 2024
73937a0
upgrade rust toolchain
MicaiahReid Apr 8, 2024
db2014d
install rust toolchain for ci test
MicaiahReid Apr 8, 2024
8a2764a
rename chainhook-cli to chainhook for windows installer
MicaiahReid Apr 8, 2024
b6bc660
try explicitly adding rust toolchain
MicaiahReid Apr 8, 2024
dd505f5
debug ci: list rust target
MicaiahReid Apr 8, 2024
0f0195d
remove test panic
MicaiahReid Apr 9, 2024
511f1a7
update main.wxs
MicaiahReid Apr 9, 2024
16dd64b
move wix folder
MicaiahReid Apr 9, 2024
4b9683b
remove &
MicaiahReid Apr 9, 2024
efae496
cleanup tests; add delay
MicaiahReid Apr 9, 2024
788ff89
add images for wix
MicaiahReid Apr 9, 2024
a1c32d2
update wix asset path
MicaiahReid Apr 9, 2024
cce9356
use tarpaulin for ci tests
MicaiahReid Apr 9, 2024
76edf80
fix wxs
MicaiahReid Apr 9, 2024
0035dfa
fix wxs
MicaiahReid Apr 9, 2024
3d57d4e
fix test
MicaiahReid Apr 9, 2024
f6e32de
try adding target
MicaiahReid Apr 9, 2024
f973f33
cache cargo artifacts
MicaiahReid Apr 9, 2024
2fb25f4
set up docker buildx
MicaiahReid Apr 11, 2024
8190554
only run release workflow on releases
MicaiahReid Apr 11, 2024
76e9694
fix homebrew version bump
MicaiahReid Apr 16, 2024
5570c3f
remove cov cargo command
MicaiahReid May 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
331 changes: 303 additions & 28 deletions .github/workflows/ci.yaml

Large diffs are not rendered by default.

16 changes: 10 additions & 6 deletions .github/workflows/pkg-version-bump.yaml
@@ -1,5 +1,5 @@
##
## Bumps the Clarinet version listed on various package managers.
## Bumps the Chainhook version listed on various package managers.
##

name: Package Version Bump
Expand Down Expand Up @@ -27,14 +27,18 @@ jobs:
HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.GH_TOKEN }}
TAG: ${{ github.event.client_payload.tag || github.event.inputs.tag }}
run: |
# Get version info
VERSION=$(echo "${ENV#v}")

# Configure git configs
git config --global user.name "${GIT_USER_NAME}"
git config --global user.email "${GIT_USER_EMAIL}"

brew update
brew bump-formula-pr \
--no-browse \
--no-audit \
--tag "${TAG}" \
--version "${VERSION}" \
${{ github.event.repository.name }}

winget:
Expand All @@ -45,8 +49,8 @@ jobs:
env:
TAG: ${{ github.event.client_payload.tag || github.event.inputs.tag }}
run: |
# Get version infoq
$VERSION=${env:TAG}.substring(1)
# Get version info
VERSION=$(echo "${TAG#v}")

# Configure git configs
git config --global user.name "${env:GIT_USER_NAME}"
Expand All @@ -57,8 +61,8 @@ jobs:

# Update manifest and submit PR
./wingetcreate.exe update `
--urls https://github.com/${{ github.repository }}/releases/download/${env:TAG}/clarinet-windows-x64.msi `
--urls https://github.com/${{ github.repository }}/releases/download/${env:TAG}/chainhook-windows-x64.msi `
--version ${VERSION} `
--token ${{ secrets.GH_TOKEN }} `
--submit `
HiroSystems.Clarinet
HiroSystems.Chainhook
6 changes: 3 additions & 3 deletions components/chainhook-cli/src/service/tests/mod.rs
Expand Up @@ -997,7 +997,7 @@ async fn it_seeds_block_pool_on_startup() -> Result<(), String> {
Ok(())
}

fn cleanup_err(
pub fn cleanup_err(
error: String,
working_dir: &str,
redis_port: u16,
Expand All @@ -1007,8 +1007,8 @@ fn cleanup_err(
format!("test failed with error: {error}")
}

fn cleanup(working_dir: &str, redis_port: u16, redis_process: &mut Child) {
std::fs::remove_dir_all(&working_dir).unwrap();
pub fn cleanup(working_dir: &str, redis_port: u16, redis_process: &mut Child) {
let _ = std::fs::remove_dir_all(&working_dir);
flush_redis(redis_port);
redis_process.kill().unwrap();
}
58 changes: 23 additions & 35 deletions components/chainhook-cli/src/service/tests/observer_tests.rs
Expand Up @@ -10,6 +10,7 @@ use serde_json::Value;
use test_case::test_case;

use crate::service::tests::{
cleanup, cleanup_err,
helpers::{
build_predicates::build_stacks_payload,
mock_service::{
Expand All @@ -26,7 +27,7 @@ use super::helpers::{

#[tokio::test]
#[cfg_attr(not(feature = "redis_tests"), ignore)]
async fn ping_endpoint_returns_metrics() {
async fn ping_endpoint_returns_metrics() -> Result<(), String> {
let TestSetupResult {
mut redis_process,
working_dir,
Expand All @@ -43,34 +44,27 @@ async fn ping_endpoint_returns_metrics() {
let predicate = build_stacks_payload(Some("devnet"), None, None, None, Some(uuid));
let _ = call_register_predicate(&predicate, chainhook_service_port)
.await
.unwrap_or_else(|e| {
std::fs::remove_dir_all(&working_dir).unwrap();
flush_redis(redis_port);
redis_process.kill().unwrap();
panic!("test failed with error: {e}");
});

let metrics = call_ping(stacks_ingestion_port).await.unwrap_or_else(|e| {
std::fs::remove_dir_all(&working_dir).unwrap();
flush_redis(redis_port);
redis_process.kill().unwrap();
panic!("test failed with error: {e}");
});
.map_err(|e| cleanup_err(e, &working_dir, redis_port, &mut redis_process))?;

sleep(Duration::new(1, 0));
let metrics = call_ping(stacks_ingestion_port)
.await
.map_err(|e| cleanup_err(e, &working_dir, redis_port, &mut redis_process))?;
let result = metrics
.get("stacks")
.unwrap()
.get("registered_predicates")
.unwrap();
assert_eq!(result, 1);

std::fs::remove_dir_all(&working_dir).unwrap();
flush_redis(redis_port);
redis_process.kill().unwrap();
sleep(Duration::new(1, 0));
cleanup(&working_dir, redis_port, &mut redis_process);
Ok(())
}

#[tokio::test]
#[cfg_attr(not(feature = "redis_tests"), ignore)]
async fn prometheus_endpoint_returns_encoded_metrics() {
async fn prometheus_endpoint_returns_encoded_metrics() -> Result<(), String> {
let TestSetupResult {
mut redis_process,
working_dir,
Expand All @@ -85,27 +79,21 @@ async fn prometheus_endpoint_returns_encoded_metrics() {

let uuid = &get_random_uuid();
let predicate = build_stacks_payload(Some("devnet"), None, None, None, Some(uuid));
let _ = call_register_predicate(&predicate, chainhook_service_port)
call_register_predicate(&predicate, chainhook_service_port)
.await
.unwrap_or_else(|e| {
std::fs::remove_dir_all(&working_dir).unwrap();
flush_redis(redis_port);
redis_process.kill().unwrap();
panic!("test failed with error: {e}");
});

let metrics = call_prometheus(prometheus_port).await.unwrap_or_else(|e| {
std::fs::remove_dir_all(&working_dir).unwrap();
flush_redis(redis_port);
redis_process.kill().unwrap();
panic!("test failed with error: {e}");
});
.map_err(|e| cleanup_err(e, &working_dir, redis_port, &mut redis_process))?;

sleep(Duration::new(1, 0));
let metrics = call_prometheus(prometheus_port)
.await
.map_err(|e| cleanup_err(e, &working_dir, redis_port, &mut redis_process))?;

const EXPECTED: &'static str = "# HELP chainhook_stx_registered_predicates The number of Stacks predicates that have been registered by the Chainhook node.\n# TYPE chainhook_stx_registered_predicates gauge\nchainhook_stx_registered_predicates 1\n";
assert!(metrics.contains(EXPECTED));

std::fs::remove_dir_all(&working_dir).unwrap();
flush_redis(redis_port);
redis_process.kill().unwrap();
sleep(Duration::new(1, 0));
cleanup(&working_dir, redis_port, &mut redis_process);
Ok(())
}

async fn await_observer_started(port: u16) {
Expand Down
File renamed without changes.
26 changes: 13 additions & 13 deletions wix/main.wxs → components/chainhook-cli/wix/main.wxs
Expand Up @@ -33,7 +33,7 @@

<Product
Id='*'
Name='clarinet'
Name='chainhook'
UpgradeCode='E41901A3-0B71-4D86-9175-B12D7C7533BE'
Manufacturer='Hiro Systems'
Language='1033'
Expand All @@ -42,7 +42,7 @@

<Package Id='*'
Keywords='Installer'
Description='Clarinet is a clarity runtime packaged as a command line tool, designed to facilitate smart contract understanding, development, testing and deployment.'
Description='Chainhook is a reorg-aware indexing engine for the Stacks and Bitcoin blockchains.'
Manufacturer='Hiro Systems'
InstallerVersion='450'
Languages='1033'
Expand All @@ -56,11 +56,11 @@
DowngradeErrorMessage='A newer version of [ProductName] is already installed. Setup will now exit.'/>

<Media Id='1' Cabinet='media1.cab' EmbedCab='yes' DiskPrompt='CD-ROM #1'/>
<Property Id='DiskPrompt' Value='clarinet Installation'/>
<Property Id='DiskPrompt' Value='chainhook Installation'/>

<Directory Id='TARGETDIR' Name='SourceDir'>
<Directory Id='$(var.PlatformProgramFilesFolder)' Name='PFiles'>
<Directory Id='APPLICATIONFOLDER' Name='clarinet'>
<Directory Id='APPLICATIONFOLDER' Name='chainhook'>
<!--
Disabling the license sidecar file in the installer is a two step process:

Expand All @@ -72,7 +72,7 @@
<File Id='LicenseFile'
Name='License.rtf'
DiskId='1'
Source='wix/License.rtf'
Source='components/chainhook-cli/wix/License.rtf'
KeyPath='yes'/>
</Component>

Expand All @@ -90,9 +90,9 @@
<Component Id='binary0' Guid='*' Win64='$(var.Win64)'>
<File
Id='exe0'
Name='clarinet.exe'
Name='chainhook.exe'
DiskId='1'
Source='target/x86_64-pc-windows-msvc/$(var.Profile)/clarinet.exe'
Source='target/x86_64-pc-windows-msvc/$(var.Profile)/chainhook.exe'
KeyPath='yes'/>
</Component>
</Directory>
Expand Down Expand Up @@ -134,10 +134,10 @@
Add/Remove Programs control panel requires commenting out or
removing the following `Icon` and `Property` tags.
-->
<Icon Id='ProductICO' SourceFile='docs/images/clarinet.ico'/>
<Property Id='ARPPRODUCTICON' Value='ProductICO' />
<!-- <Icon Id='ProductICO' SourceFile='docs/images/chainhook.ico'/> -->
<!-- <Property Id='ARPPRODUCTICON' Value='ProductICO' /> -->

<Property Id='ARPHELPLINK' Value='https://github.com/hirosystems/clarinet'/>
<Property Id='ARPHELPLINK' Value='https://github.com/hirosystems/chainhook/tree/build/upload-builds'/>

<UI>
<UIRef Id='WixUI_FeatureTree'/>
Expand All @@ -157,7 +157,7 @@
Disabling the EULA dialog in the installer requires commenting out
or removing the following `WixVariable` tag
-->
<WixVariable Id='WixUILicenseRtf' Value='wix/License.rtf'/>
<WixVariable Id='WixUILicenseRtf' Value='components/chainhook-cli/wix/License.rtf'/>


<!--
Expand All @@ -168,15 +168,15 @@

The banner BMP dimensions are 493 x 58 pixels.
-->
<WixVariable Id='WixUIBannerBmp' Value='docs/images/clarinet-banner.bmp'/>
<WixVariable Id='WixUIBannerBmp' Value='docs/images/chainhook-banner.bmp'/>

<!--
Disabling the dialog image in the installer requires commenting out or
removing the following `WixVariable` tag.

The dialog BMP dimensions are 493 x 312 pixels.
-->
<WixVariable Id='WixUIDialogBmp' Value='docs/images/clarinet-dialog.bmp'/>
<WixVariable Id='WixUIDialogBmp' Value='docs/images/chainhook-dialog.bmp'/>
</Product>

</Wix>
Binary file added docs/images/chainhook-banner.bmp
Binary file not shown.
Binary file added docs/images/chainhook-dialog.bmp
Binary file not shown.
2 changes: 1 addition & 1 deletion rust-toolchain
@@ -1,2 +1,2 @@
[toolchain]
channel = "1.73.0"
channel = "1.76.0"