Skip to content

Bump clang-format version to 10-12 #1

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

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
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
10 changes: 4 additions & 6 deletions .github/workflows/push-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 2
- run: git checkout HEAD^
- uses: whoan/docker-build-with-cache-action@v5
with:
image_name: joshuasbrown/cpp-py-formatter
registry: ghcr.io
image_name: cpp-py-formatter
image_tag: latest
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_TOKEN }}
username: pgrete
password: ${{ secrets.GHCR_TOKEN }}
push_git_tag: true
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "cpp-py-format"
version = "0.2.3"
authors = ["Andrew Gaspar <andrew.gaspar@outlook.com>","Joshua Brown <joshbro42867@yahoo.com>"]
version = "0.3.0"
authors = ["Andrew Gaspar <andrew.gaspar@outlook.com>","Joshua Brown <joshbro42867@yahoo.com>", "Philipp Grete <pgrete@hs.uni-hamburg.de"]
edition = "2018"

[dependencies]
Expand Down
14 changes: 8 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
# Build the GitHub Action
FROM rust:1.42 as builder
FROM rust:1.52 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:20.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-get install -y git \
python3-pip \
clang-format-10 clang-format-11 clang-format-12 \
&& rm -rf /var/lib/apt/lists/*
RUN python3 -m pip install --upgrade pip
RUN python3 -m pip install black

# Install clang-formats
ADD ./clang-format /clang-format
COPY gitconfig /etc

COPY --from=builder /usr/local/cargo/bin/cpp-py-format /cpp-py-format
ENTRYPOINT [ "/cpp-py-format" ]
6 changes: 3 additions & 3 deletions check/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ inputs:
required: true
clangFormatVersion:
description:
Major Clang Version number. Supports clang 5 to 10. Default 10
Major Clang Version number. Supports clang 10 to 12. Default 12
required: false
default: '10'
default: '12'
include_c:
description:
Comma-separated list of file globs (e.g '**/*.cpp,**/*.hpp') that
Expand All @@ -34,7 +34,7 @@ inputs:
default: '""'
runs:
using: 'docker'
image: docker://joshuasbrown/cpp-py-formatter:latest
image: docker://ghcr.io/pgrete/cpp-py-formatter:latest
args:
- --github-token
- ${{ inputs.token }}
Expand Down
Binary file removed clang-format/clang-format-10
Binary file not shown.
Binary file removed clang-format/clang-format-5
Binary file not shown.
Binary file removed clang-format/clang-format-6
Binary file not shown.
Binary file removed clang-format/clang-format-7
Binary file not shown.
Binary file removed clang-format/clang-format-8
Binary file not shown.
Binary file removed clang-format/clang-format-9
Binary file not shown.
6 changes: 3 additions & 3 deletions command/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ inputs:
required: true
clangFormatVersion:
description:
Major Clang Version number. Supports clang 5 to 10. Default 10
Major Clang Version number. Supports clang 10 to 12. Default 12
required: false
default: '10'
default: '12'
include_c:
description:
Comma-separated list of file globs (e.g '**/*.cpp,**/*.hpp') that
Expand Down Expand Up @@ -40,7 +40,7 @@ inputs:
default: 'cpp-py-formatter'
runs:
using: 'docker'
image: docker://joshuasbrown/cpp-py-formatter:latest
image: docker://ghcr.io/pgrete/cpp-py-formatter:latest
args:
- --github-token
- ${{ inputs.token }}
Expand Down
2 changes: 2 additions & 0 deletions gitconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[safe]
directory = *
6 changes: 3 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ struct App {
impl App {
fn run() -> Result<(), Box<dyn Error>> {
let matches = clap::App::new("cpp-py-format")
.author("Andrew Gaspar <andrew.gaspar@outlook.com>, Joshua Brown <joshbro42867@yahoo.com")
.author("Andrew Gaspar <andrew.gaspar@outlook.com>, Joshua Brown <joshbro42867@yahoo.com, Philipp Grete <pgrete@hs.uni-hamburg.de>")
.about("Runner code for executing clang-format, and black")
.arg(
Arg::with_name("github-token")
Expand All @@ -53,7 +53,7 @@ impl App {
Arg::with_name("clang-format-version")
.long("clang-format-version")
.takes_value(true)
.default_value("10")
.default_value("13")
.conflicts_with("clang-format-override"),
)
.arg(
Expand Down Expand Up @@ -106,7 +106,7 @@ impl App {
if let Some(clang_format_override) = matches.value_of("clang-format-override") {
clang_format_override.into()
} else if env::var("GITHUB_ACTION").is_ok() {
format!("/clang-format/clang-format-{}", clang_format_version).into()
format!("/usr/bin/clang-format-{}", clang_format_version).into()
} else {
String::from_utf8(
Command::new("which")
Expand Down