Skip to content

Commit b3abc64

Browse files
authored
Merge pull request #6 from JoshuaSBrown/chore-DAPS-Deps-fixchecker-302
[DAPS-DEPS] Update cpp-py-formatter to 0.3.3
2 parents e34b7f3 + 376596d commit b3abc64

File tree

7 files changed

+73
-13
lines changed

7 files changed

+73
-13
lines changed

.github/workflows/compile.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Compile and Test
2+
on:
3+
pull_request:
4+
branches:
5+
- '**'
6+
push:
7+
branches:
8+
- master
9+
10+
jobs:
11+
compile-and-test:
12+
runs-on: ubuntu-20.04
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- uses: dtolnay/rust-toolchain@stable
19+
with:
20+
toolchain: 1.84.1
21+
22+
- uses: actions/cache@v4 # Add caching
23+
with:
24+
path: ~/.cargo/registry # Cache the Cargo registry
25+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
26+
restore-keys: |
27+
${{ runner.os }}-cargo-
28+
29+
- name: Install OpenSSL development headers
30+
run: sudo apt install -y libssl-dev
31+
32+
- run: cargo build --verbose
33+
- run: cargo test --verbose

.github/workflows/docker.yml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Docker Build and Test
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- '**'
10+
11+
jobs:
12+
build-and-test:
13+
runs-on: ubuntu-22.04
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
- name: Set up Docker Buildx
20+
uses: docker/setup-buildx-action@v3
21+
22+
- name: Build Docker image
23+
run: docker build --tag my-app:latest .

.github/workflows/push-image.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ jobs:
88
name: Cache Image
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v2
11+
- uses: actions/checkout@v4
1212
with:
1313
fetch-depth: 2
1414
- run: git checkout HEAD^
15-
- uses: whoan/docker-build-with-cache-action@v5
15+
- uses: whoan/docker-build-with-cache-action@v8
1616
with:
1717
image_name: joshuasbrown/cpp-py-formatter
1818
image_tag: latest

Cargo.lock

+3-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[package]
22
name = "cpp-py-format"
3-
version = "0.3.2"
3+
version = "0.3.3"
44
authors = ["Andrew Gaspar <[email protected]>","Joshua Brown <[email protected]>"]
5-
edition = "2024"
5+
edition = "2018"
66

77
[dependencies]
88
glob = "0.3.0"

Dockerfile

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
# Build the GitHub Action
2-
FROM rust:1.42 as builder
2+
FROM rust:1.84.1 AS builder
33
WORKDIR /usr/src/myapp
44
COPY Cargo.toml .
55
COPY Cargo.lock .
66
COPY src ./src
77
RUN cargo install --path .
88

99
# GitHub Action Image
10-
FROM ubuntu:18.04
10+
FROM ubuntu:22.04
1111
# Install our apt packages
12-
RUN apt-get update
13-
RUN apt-get upgrade -y
14-
RUN apt-get install -y git
15-
RUN apt-get install -y python3-pip
12+
RUN apt update
13+
RUN apt upgrade -y
14+
RUN apt install -y git
15+
RUN apt install -y python3-pip
1616
RUN python3 -m pip install --upgrade pip
1717
RUN python3 -m pip install black
1818

src/main.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,8 @@ FLAGS:
388388
.args(&["diff", "--exit-code"])
389389
.output();
390390

391-
let git_diff_str = String::from_utf8_lossy(&git_diff.stdout);
391+
let git_diff_output = git_diff.unwrap();
392+
let git_diff_str = String::from_utf8_lossy(&git_diff_output.stdout);
392393

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

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

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

0 commit comments

Comments
 (0)