Skip to content

Commit

Permalink
Fix and make native api client CI
Browse files Browse the repository at this point in the history
  • Loading branch information
FlareFlo committed Nov 10, 2023
1 parent 6aadfea commit 4f7f42d
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 5 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/test_build_native.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Test build default features

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

env:
CARGO_TERM_COLOR: always

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

# Loads cargo cache
- uses: actions/cache@v3
name: Pull Cargo cache
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Build
run: cargo build --no-default-features --features native-github-api --verbose
- name: Run tests
run: cargo test --no-default-features --features native-github-api --verbose
7 changes: 2 additions & 5 deletions src/update_message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,10 @@ mod native_github_api {
use color_eyre::eyre::ContextCompat;
use color_eyre::Report;
use semver::Version;
use crate::update_message::print_if_new;
use smol_timeout::TimeoutExt;
use tracing::warn;
use crate::GIT_TAG;
use crate::update_message::fmt_version;

pub fn update_message() -> Result<(), Report> {
use smol_timeout::TimeoutExt;
let rt = tokio::runtime::Builder::new_current_thread()
.enable_io()
.enable_time()
Expand All @@ -48,7 +45,7 @@ mod native_github_api {
.timeout(Duration::from_secs(1)).await;

if let Some(tags) = tags {
let latest_prefix = tags?.items.first().context("No tags available. This is a bug")?.name.clone();
let latest_prefixed = tags?.items.first().context("No tags available. This is a bug")?.name.clone();
let latest = latest_prefixed.replace("v", ""); // trim off version prefix
let latest = Version::from_str(&latest)?;
print_if_new(latest)?;
Expand Down

0 comments on commit 4f7f42d

Please sign in to comment.