Skip to content

[DAPS-DEPS] Update cpp-py-formatter to 0.3.3 #6

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

Merged
merged 1 commit into from
Feb 12, 2025
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
33 changes: 33 additions & 0 deletions .github/workflows/compile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Compile and Test
on:
pull_request:
branches:
- '**'
push:
branches:
- master

jobs:
compile-and-test:
runs-on: ubuntu-20.04

steps:
- name: Checkout code
uses: actions/checkout@v4

- uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.84.1

- uses: actions/cache@v4 # Add caching
with:
path: ~/.cargo/registry # Cache the Cargo registry
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-

- name: Install OpenSSL development headers
run: sudo apt install -y libssl-dev

- run: cargo build --verbose
- run: cargo test --verbose
23 changes: 23 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Docker Build and Test

on:
push:
branches:
- master
pull_request:
branches:
- '**'

jobs:
build-and-test:
runs-on: ubuntu-22.04

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build Docker image
run: docker build --tag my-app:latest .
4 changes: 2 additions & 2 deletions .github/workflows/push-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ jobs:
name: Cache Image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 2
- run: git checkout HEAD^
- uses: whoan/docker-build-with-cache-action@v5
- uses: whoan/docker-build-with-cache-action@v8
with:
image_name: joshuasbrown/cpp-py-formatter
image_tag: latest
Expand Down
4 changes: 3 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[package]
name = "cpp-py-format"
version = "0.3.2"
version = "0.3.3"
authors = ["Andrew Gaspar <[email protected]>","Joshua Brown <[email protected]>"]
edition = "2024"
edition = "2018"

[dependencies]
glob = "0.3.0"
Expand Down
12 changes: 6 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# Build the GitHub Action
FROM rust:1.42 as builder
FROM rust:1.84.1 AS builder
WORKDIR /usr/src/myapp
COPY Cargo.toml .
COPY Cargo.lock .
COPY src ./src
RUN cargo install --path .

# GitHub Action Image
FROM ubuntu:18.04
FROM ubuntu:22.04
# Install our apt packages
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get install -y git
RUN apt-get install -y python3-pip
RUN apt update
RUN apt upgrade -y
RUN apt install -y git
RUN apt install -y python3-pip
RUN python3 -m pip install --upgrade pip
RUN python3 -m pip install black

Expand Down
6 changes: 4 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,8 @@ FLAGS:
.args(&["diff", "--exit-code"])
.output();

let git_diff_str = String::from_utf8_lossy(&git_diff.stdout);
let git_diff_output = git_diff.unwrap();
let git_diff_str = String::from_utf8_lossy(&git_diff_output.stdout);

if git_diff_str.len() > 0 {
if !matches.is_present("amend") {
Expand All @@ -411,7 +412,7 @@ FLAGS:

fn check(&self, _matches: &ArgMatches) -> Result<(), Box<dyn Error>> {
let payload: GitHubPushEvent = load_payload()?;
let branch = ref_to_branch(&payload.r#ref).ok_or("Invalid reference")?;
let branch = ref_to_branch(&payload.r#ref);
self.clone(&payload.repository.full_name, branch, 1)?;
self.format_all();

Expand Down Expand Up @@ -449,6 +450,7 @@ fn ref_to_branch(r#ref: &str) -> &str{
} else if r#ref.starts_with(tag_prefix) {
&r#ref[tag_prefix.len()..]
} else {
// Will error out if the ref is neither a branch or tag on clone
r#ref
}
}
Expand Down