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

fix: revert signing releases #2043

Merged
merged 1 commit into from
May 29, 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
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
Loading