Skip to content

Commit

Permalink
Merge branch 'main' of github.com:GloryOfNight/clang-format-all
Browse files Browse the repository at this point in the history
  • Loading branch information
GloryOfNight committed Nov 16, 2023
2 parents 7299d49 + 4781a04 commit 82068bd
Show file tree
Hide file tree
Showing 6 changed files with 99 additions and 16 deletions.
26 changes: 21 additions & 5 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
name: Builds
name: Linux

on:
workflow_call:
inputs:
upload_url:
required: false
type: string
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
unix:
build:
runs-on: ubuntu-latest

steps:
Expand All @@ -20,10 +25,21 @@ jobs:
sudo apt-get install -y clang
sudo apt-get install -y ninja-build
- name: Install libs
run: sudo apt-get install -y libtbb-dev

- name: Configure and build
run: |
cmake --preset linux64-release
cmake --build build
- name: Upload binary to release (optional)
if: ${{ inputs.upload_url }}
id: upload-release-binary
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ inputs.upload_url }}
asset_path: build/clang-format-all
asset_name: clang-format-all-linux64
asset_content_type: application/executable


50 changes: 50 additions & 0 deletions .github/workflows/make_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Make release

on:
workflow_dispatch:
inputs:
tag:
description: 'A version tag'
default: '0.0'
required: true
type: string

jobs:
create_release:
name: Create Release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- uses: actions/checkout@v2

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ inputs.tag }}
release_name: Release ${{ inputs.tag }}
body: |
Autogenerated release
draft: false
prerelease: false


release_linux_artifact:
name: Build and upload Linux binary
needs: create_release
if: ${{ needs.create_release.outputs.upload_url }}
uses: ./.github/workflows/linux.yml
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}

release_win64_artifact:
name: Build and upload Windows binary
needs: create_release
if: ${{ needs.create_release.outputs.upload_url }}
uses: ./.github/workflows/windows.yml
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}

23 changes: 20 additions & 3 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
name: Builds
name: Windows

on:
workflow_call:
inputs:
upload_url:
required: false
type: string
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
windows:
build:
runs-on: windows-latest

steps:
Expand All @@ -22,4 +27,16 @@ jobs:
- name: Configure and build
run: |
cmake --preset win64-release
cmake --build build
cmake --build build
- name: Upload binary to release (optional)
if: ${{ inputs.upload_url }}
id: upload-release-binary
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ inputs.upload_url }}
asset_path: build/clang-format-all.exe
asset_name: clang-format-all-win64.exe
asset_content_type: application/executable
5 changes: 0 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,3 @@ install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}

enable_testing()
add_test(NAME HelloHelp COMMAND $<TARGET_FILE:${PROJECT_NAME}> --help WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR})

if(UNIX AND NOT CMAKE_CROSSCOMPILING)
find_library(TBB_LIB NAMES tbb)
target_link_libraries(${PROJECT_NAME} "tbb")
endif()
2 changes: 1 addition & 1 deletion CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,4 @@
"cacheVariables": { "CMAKE_BUILD_TYPE": "RelWithDebInfo" }
}
]
}
}
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ There are no special dependencies, project can be easily compiled for Windows an
Pre-build download available thru [releases](https://github.com/GloryOfNight/clang-format-all/releases) page.

# Build
On Linux: `sh ./scripts/build_unix.sh` NOTE: you might need to install libtbb for successfull build!
On Linux: `cmake --preset linux64-release && cmake --build build` NOTE: you might need to install libtbb for successfull build!

On Windows (git bash): `./scripts/build_win.bat`
On Windows: `cmake --preset win64-release && cmake --build build`

# Options
- `--help` print help with available arguments list
Expand All @@ -29,3 +29,8 @@ example command (git bash, windows):
If you found this useful, give it a star. Stars, yay ⭐

If you encounter issue, use Issues section above and write everything about it.


### Main branch
[![Windows](https://github.com/GloryOfNight/clang-format-all/actions/workflows/windows.yml/badge.svg)](https://github.com/GloryOfNight/clang-format-all/actions/workflows/windows.yml)
[![Linux](https://github.com/GloryOfNight/clang-format-all/actions/workflows/linux.yml/badge.svg)](https://github.com/GloryOfNight/clang-format-all/actions/workflows/linux.yml)

0 comments on commit 82068bd

Please sign in to comment.