Skip to content

Commit

Permalink
fix: revert signing releases (#2043)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssddOnTop authored May 29, 2024
1 parent bb600fb commit c990685
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 9 deletions.
7 changes: 0 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -365,9 +365,6 @@ jobs:
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: ${{ matrix.target }}
- name: Import GPG key
run: |
echo "${{ secrets.GPG_PRIVATE_KEY }}" | gpg --batch --import

- name: Build
env:
Expand All @@ -378,10 +375,6 @@ jobs:
use-cross: ${{ matrix.cross }}
command: build
args: ${{matrix.features}} --release --target ${{ matrix.target }}
- name: Sign the binary
run: |
echo "${{ secrets.GPG_PASSPHRASE }}" | gpg --batch --passphrase-fd 0 --pinentry-mode loopback --sign --detach-sign --armor target/${{ matrix.target }}/release/tailcall${{ matrix.ext }}
gpg --batch --yes --passphrase "${{ secrets.GPG_PASSPHRASE }}" --pinentry-mode loopback --output target/${{ matrix.target }}/release/tailcall${{ matrix.ext }}.sig --detach-sign target/${{ matrix.target }}/release/tailcall${{ matrix.ext }}

- name: Install Node.js
if: (startsWith(github.event.head_commit.message, 'feat') || startsWith(github.event.head_commit.message, 'fix')) && (github.event_name == 'push' && github.ref == 'refs/heads/main')
Expand Down
45 changes: 43 additions & 2 deletions tailcall-prettier/src/prettier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,31 @@ use std::path::Path;
use std::process::{Command, Stdio};

use anyhow::{anyhow, Result};
use tokio::runtime::Runtime;

pub use super::Parser;
use crate::Parser;

/// Struct representing a Prettier formatter.
///
/// # Fields
///
/// * `runtime` - A Tokio runtime for executing asynchronous tasks.
/// * `config_path` - An optional path to the Prettier configuration file.
pub struct Prettier {
runtime: tokio::runtime::Runtime,
runtime: Runtime,
config_path: Option<String>,
}

impl Prettier {
/// Creates a new `Prettier` instance.
///
/// This function initializes a new multi-threaded Tokio runtime with a
/// maximum of 1024 blocking threads and attempts to locate a
/// `.prettierrc` configuration file in the current directory.
///
/// # Returns
///
/// A new `Prettier` instance.
pub fn new() -> Prettier {
let runtime = tokio::runtime::Builder::new_multi_thread()
.max_blocking_threads(1024)
Expand All @@ -25,6 +41,22 @@ impl Prettier {
Self { runtime, config_path }
}

/// Formats the provided source code string using Prettier.
///
/// This method spawns a blocking task on the Tokio runtime to execute the
/// Prettier command-line tool. It passes the source code to Prettier
/// via stdin and captures the formatted output from stdout.
///
/// # Arguments
///
/// * `source` - A string containing the source code to be formatted.
/// * `parser` - A reference to a `Parser` that specifies the language
/// parser to be used.
///
/// # Returns
///
/// A `Result` containing the formatted source code string or an error if
/// formatting fails.
pub async fn format<'a>(&'a self, source: String, parser: &'a Parser) -> Result<String> {
let parser = parser.clone();
let config = self.config_path.clone();
Expand Down Expand Up @@ -59,6 +91,15 @@ impl Prettier {
}
}

/// Returns a `Command` to execute Prettier based on the target operating
/// system.
///
/// On Windows, this function returns a command to execute `prettier.cmd`, while
/// on other operating systems, it returns a command to execute `prettier`.
///
/// # Returns
///
/// A `Command` instance for executing Prettier.
fn command() -> Command {
if cfg!(target_os = "windows") {
Command::new("prettier.cmd")
Expand Down

1 comment on commit c990685

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Running 30s test @ http://localhost:8000/graphql

4 threads and 100 connections

Thread Stats Avg Stdev Max +/- Stdev
Latency 6.75ms 3.36ms 106.25ms 76.49%
Req/Sec 3.76k 162.80 4.12k 88.42%

449224 requests in 30.01s, 2.25GB read

Requests/sec: 14967.21

Transfer/sec: 76.82MB

Please sign in to comment.