mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-06 10:11:44 +00:00
Various CI fixes (#3813)
## Issue Addressed Closes #3812 Closes #3750 Closes #3705
This commit is contained in:
@@ -13,6 +13,8 @@ BLS_TARBALL = $(patsubst %,%-$(BLS_TEST_TAG).tar.gz,$(BLS_TEST))
|
||||
BLS_OUTPUT_DIR := $(OUTPUT_DIR)/$(BLS_TEST_REPO_NAME)
|
||||
BLS_BASE_URL := https://github.com/ethereum/$(BLS_TEST_REPO_NAME)/releases/download/$(BLS_TEST_TAG)
|
||||
|
||||
WGET := $(if $(LIGHTHOUSE_GITHUB_TOKEN),wget --header="Authorization: $(LIGHTHOUSE_GITHUB_TOKEN)",wget)
|
||||
|
||||
all:
|
||||
make $(OUTPUT_DIR)
|
||||
make $(BLS_OUTPUT_DIR)
|
||||
@@ -25,11 +27,11 @@ $(OUTPUT_DIR): $(TARBALLS)
|
||||
|
||||
$(BLS_OUTPUT_DIR):
|
||||
mkdir $(BLS_OUTPUT_DIR)
|
||||
wget $(BLS_BASE_URL)/$(BLS_TEST).tar.gz -O $(BLS_TARBALL)
|
||||
$(WGET) $(BLS_BASE_URL)/$(BLS_TEST).tar.gz -O $(BLS_TARBALL)
|
||||
tar -xzf $(BLS_TARBALL) -C $(BLS_OUTPUT_DIR)
|
||||
|
||||
%-$(TESTS_TAG).tar.gz:
|
||||
wget $(BASE_URL)/$*.tar.gz -O $@
|
||||
$(WGET) $(BASE_URL)/$*.tar.gz -O $@
|
||||
|
||||
clean-test-files:
|
||||
rm -rf $(OUTPUT_DIR) $(BLS_OUTPUT_DIR)
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
//! This build script downloads the latest Web3Signer release and places it in the `OUT_DIR` so it
|
||||
//! can be used for integration testing.
|
||||
|
||||
use reqwest::Client;
|
||||
use reqwest::{
|
||||
header::{self, HeaderValue},
|
||||
Client,
|
||||
};
|
||||
use serde_json::Value;
|
||||
use std::env;
|
||||
use std::fs;
|
||||
@@ -15,10 +18,15 @@ const FIXED_VERSION_STRING: Option<&str> = None;
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
let out_dir = env::var("OUT_DIR").unwrap();
|
||||
download_binary(out_dir.into()).await;
|
||||
|
||||
// Read a Github API token from the environment. This is intended to prevent rate-limits on CI.
|
||||
// We use a name that is unlikely to accidentally collide with anything the user has configured.
|
||||
let github_token = env::var("LIGHTHOUSE_GITHUB_TOKEN");
|
||||
|
||||
download_binary(out_dir.into(), github_token.as_deref().unwrap_or("")).await;
|
||||
}
|
||||
|
||||
pub async fn download_binary(dest_dir: PathBuf) {
|
||||
pub async fn download_binary(dest_dir: PathBuf, github_token: &str) {
|
||||
let version_file = dest_dir.join("version");
|
||||
|
||||
let client = Client::builder()
|
||||
@@ -33,8 +41,11 @@ pub async fn download_binary(dest_dir: PathBuf) {
|
||||
env_version
|
||||
} else {
|
||||
// Get the latest release of the web3 signer repo.
|
||||
let mut token_header_value = HeaderValue::from_str(github_token).unwrap();
|
||||
token_header_value.set_sensitive(true);
|
||||
let latest_response: Value = client
|
||||
.get("https://api.github.com/repos/ConsenSys/web3signer/releases/latest")
|
||||
.header(header::AUTHORIZATION, token_header_value)
|
||||
.send()
|
||||
.await
|
||||
.unwrap()
|
||||
|
||||
Reference in New Issue
Block a user