Skip to content

Commit 8d18535

Browse files
authoredDec 1, 2023
GHA: Update Docker and Ubuntu workflows (#659)
- Remove duplicated entry from editorconfig (again, don't know why it got back after PR that fixed this) - Added entry for cmake files on editorconfig - Removed not used GitVersion - Update ubuntu build workflow (Removed ccache that will not work with UNITY and PCH) - Disabled UNITY and PCH for debug images and enabled more warning flags (Show build warning on PR changes) - Update docker workflow to use newer version (Using newer versions of the actions helped cleaning the workflow, now it is smaller and easier to understand) - Do not upload artifacts when building PR as it failing and we need to re-run the build Signed-off-by: Renato Foot <renato@foot.br>
1 parent 28eaf13 commit 8d18535

File tree

6 files changed

+45
-149
lines changed

6 files changed

+45
-149
lines changed
 

‎.editorconfig

+2-71
Original file line numberDiff line numberDiff line change
@@ -2,77 +2,6 @@ root = true
22

33
[*.{c++,cc,cpp,cppm,cxx,h,h++,hh,hpp,hxx,inl,ipp,ixx,tlh,tli}]
44

5-
# Configurações de Formatação do Visual C++
6-
7-
cpp_indent_braces = false
8-
cpp_indent_multi_line_relative_to = statement_begin
9-
cpp_indent_within_parentheses = align_to_parenthesis
10-
cpp_indent_preserve_within_parentheses = true
11-
cpp_indent_case_contents = true
12-
cpp_indent_case_labels = true
13-
cpp_indent_case_contents_when_block = false
14-
cpp_indent_lambda_braces_when_parameter = false
15-
cpp_indent_goto_labels = one_left
16-
cpp_indent_preprocessor = leftmost_column
17-
cpp_indent_access_specifiers = false
18-
cpp_indent_namespace_contents = true
19-
cpp_indent_preserve_comments = false
20-
cpp_new_line_before_open_brace_namespace = ignore
21-
cpp_new_line_before_open_brace_type = new_line
22-
cpp_new_line_before_open_brace_function = ignore
23-
cpp_new_line_before_open_brace_block = same_line
24-
cpp_new_line_before_open_brace_lambda = same_line
25-
cpp_new_line_scope_braces_on_separate_lines = false
26-
cpp_new_line_close_brace_same_line_empty_type = false
27-
cpp_new_line_close_brace_same_line_empty_function = false
28-
cpp_new_line_before_catch = false
29-
cpp_new_line_before_else = false
30-
cpp_new_line_before_while_in_do_while = false
31-
cpp_space_before_function_open_parenthesis = remove
32-
cpp_space_within_parameter_list_parentheses = false
33-
cpp_space_between_empty_parameter_list_parentheses = false
34-
cpp_space_after_keywords_in_control_flow_statements = true
35-
cpp_space_within_control_flow_statement_parentheses = false
36-
cpp_space_before_lambda_open_parenthesis = false
37-
cpp_space_within_cast_parentheses = false
38-
cpp_space_after_cast_close_parenthesis = false
39-
cpp_space_within_expression_parentheses = false
40-
cpp_space_before_block_open_brace = true
41-
cpp_space_between_empty_braces = false
42-
cpp_space_before_initializer_list_open_brace = false
43-
cpp_space_within_initializer_list_braces = true
44-
cpp_space_preserve_in_initializer_list = true
45-
cpp_space_before_open_square_bracket = false
46-
cpp_space_within_square_brackets = false
47-
cpp_space_before_empty_square_brackets = false
48-
cpp_space_between_empty_square_brackets = false
49-
cpp_space_group_square_brackets = true
50-
cpp_space_within_lambda_brackets = false
51-
cpp_space_between_empty_lambda_brackets = false
52-
cpp_space_before_comma = false
53-
cpp_space_after_comma = true
54-
cpp_space_remove_around_member_operators = true
55-
cpp_space_before_inheritance_colon = true
56-
cpp_space_before_constructor_colon = true
57-
cpp_space_remove_before_semicolon = true
58-
cpp_space_after_semicolon = true
59-
cpp_space_remove_around_unary_operator = true
60-
cpp_space_around_binary_operator = insert
61-
cpp_space_around_assignment_operator = insert
62-
cpp_space_pointer_reference_alignment = left
63-
cpp_space_around_ternary_operator = insert
64-
cpp_wrap_preserve_blocks = all_one_line_scopes
65-
66-
root = true
67-
68-
[*.{c++,cc,cpp,cppm,cxx,h,h++,hh,hpp,hxx,inl,ipp,ixx,tlh,tli}]
69-
70-
# Configurações de Estilo de Código de Visual C++
71-
72-
cpp_generate_documentation_comments = xml
73-
74-
# Configurações de Formatação do Visual C++
75-
765
cpp_indent_braces = false
776
cpp_indent_multi_line_relative_to = statement_begin
787
cpp_indent_within_parentheses = align_to_parenthesis
@@ -135,3 +64,5 @@ cpp_wrap_preserve_blocks = all_one_line_scopes
13564
[CMakeLists.txt]
13665
indent_size = 2
13766
indent_style = tab
67+
trim_trailing_whitespace = true
68+
insert_final_newline = true

‎.github/workflows/build-docker.yml

+23-52
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@ on:
55
workflow_dispatch:
66
pull_request:
77
push:
8-
branches:
9-
- main
8+
branches: [ $default-branch ]
9+
10+
env:
11+
REGISTRY: ghcr.io
12+
IMAGE_NAME: ${{ github.repository }}
1013

1114
jobs:
1215
docker:
@@ -17,63 +20,31 @@ jobs:
1720
with:
1821
fetch-depth: 0
1922

20-
- name: Install GitVersion
21-
uses: gittools/actions/gitversion/setup@v0.9.15
22-
with:
23-
versionSpec: '5.x'
24-
25-
- name: Determine Version
26-
id: gitversion
27-
uses: gittools/actions/gitversion/execute@v0.9.15
28-
2923
- name: Set up Docker Buildx
30-
uses: docker/setup-buildx-action@v2.1.0
31-
with:
32-
install: true
33-
34-
- name: Cache Docker layers
35-
uses: actions/cache@main
36-
with:
37-
path: /tmp/.buildx-cache
38-
key: ${{ runner.os }}-buildx-${{ github.sha }}
39-
restore-keys: |
40-
${{ runner.os }}-buildx-
24+
uses: docker/setup-buildx-action@v3
4125

4226
- name: Login to GitHub Container Registry
43-
uses: docker/login-action@v2.1.0
27+
uses: docker/login-action@v3
4428
with:
45-
registry: ghcr.io
46-
username: ${{ github.repository_owner }}
29+
registry: ${{ env.REGISTRY }}
30+
username: ${{ github.actor }}
4731
password: ${{ secrets.GITHUB_TOKEN }}
4832

49-
- name: Build
50-
if: ${{ github.event_name == 'pull_request' }}
51-
uses: docker/build-push-action@v3.2.0
33+
# Extract metadata (tags, labels) for Docker
34+
# https://github.com/docker/metadata-action
35+
- name: Extract Docker metadata
36+
id: meta
37+
uses: docker/metadata-action@v5
5238
with:
53-
file: Dockerfile
54-
tags: ghcr.io/${{ github.repository }}:${{ steps.gitversion.outputs.semVer }}
55-
cache-from: type=gha, scope=${{ github.workflow }}
56-
cache-to: type=gha, scope=${{ github.workflow }}
39+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
5740

58-
- name: Build and push
59-
id: docker_build
60-
if: ${{ github.event_name == 'push' }}
61-
uses: docker/build-push-action@v3.2.0
41+
- name: Build and push Docker image
42+
uses: docker/build-push-action@v5
6243
with:
44+
context: .
6345
file: Dockerfile
64-
push: true
65-
tags: ghcr.io/${{ github.repository }}:${{ steps.gitversion.outputs.semVer }}
66-
cache-from: type=gha, scope=${{ github.workflow }}
67-
cache-to: type=gha, scope=${{ github.workflow }}
68-
69-
- name: Image digest
70-
if: ${{ github.event_name == 'push' }}
71-
run: echo ${{ steps.docker_build.outputs.digest }}
72-
73-
# # Temp fix
74-
# # https://github.com/docker/build-push-action/issues/252
75-
# # https://github.com/moby/buildkit/issues/1896
76-
# - name: Move cache
77-
# run: |
78-
# rm -rf /tmp/.buildx-cache
79-
# mv /tmp/.buildx-cache-new /tmp/.buildx-cache
46+
push: ${{ github.event_name != 'pull_request' }}
47+
tags: ${{ steps.meta.outputs.tags }}
48+
labels: ${{ steps.meta.outputs.labels }}
49+
cache-from: type=gha
50+
cache-to: type=gha,mode=max

‎.github/workflows/build-ubuntu.yml

+3-12
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ on:
99
- main
1010

1111
env:
12-
CMAKE_BUILD_PARALLEL_LEVEL: 2
13-
MAKEFLAGS: '-j 2'
12+
VCPKG_ENABLE_METRICS: 1
1413

1514
jobs:
1615
job:
@@ -33,7 +32,7 @@ jobs:
3332
uses: actions/checkout@main
3433

3534
- name: Install Linux Dependencies
36-
run: >
35+
run: >
3736
sudo apt-get update && sudo apt-get install ccache libglew-dev libx11-dev linux-headers-$(uname -r)
3837
3938
- name: Switch to gcc-11
@@ -42,14 +41,6 @@ jobs:
4241
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 100 --slave /usr/bin/g++ g++ /usr/bin/g++-11 --slave /usr/bin/gcov gcov /usr/bin/gcov-12
4342
sudo update-alternatives --set gcc /usr/bin/gcc-11
4443
45-
- name: CCache
46-
uses: hendrikmuhs/ccache-action@main
47-
with:
48-
max-size: "1G"
49-
key: ccache-${{ matrix.os }}-${{ matrix.buildtype }}
50-
restore-keys: |
51-
ccache-${{ matrix.os }}
52-
5344
- name: Restore artifacts and install vcpkg
5445
id: vcpkg-step
5546
run: |
@@ -60,7 +51,6 @@ jobs:
6051
- name: Get vcpkg commit id from vcpkg.json
6152
uses: lukka/run-vcpkg@main
6253
with:
63-
vcpkgGitURL: "https://github.com/microsoft/vcpkg.git"
6454
vcpkgGitCommitId: ${{ steps.vcpkg-step.outputs.vcpkgGitCommitId }}
6555

6656
- name: Get latest CMake and ninja
@@ -73,6 +63,7 @@ jobs:
7363
buildPreset: ${{ matrix.buildtype }}
7464

7565
- name: Create and Upload Artifact
66+
if: ${{ github.event_name != 'pull_request' }}
7667
uses: actions/upload-artifact@main
7768
with:
7869
name: otclient-${{ matrix.buildtype }}-${{ github.sha }}

‎CMakePresets.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,9 @@
9797
"cacheVariables": {
9898
"CMAKE_BUILD_TYPE": "Debug",
9999
"DEBUG_LOG": "ON",
100-
"ASAN_ENABLED": "ON"
100+
"ASAN_ENABLED": "OFF",
101+
"TOGGLE_PRE_COMPILED_HEADER": "OFF",
102+
"SPEED_UP_BUILD_UNITY": "OFF"
101103
}
102104
}
103105
],

‎GitVersion.yml

-7
This file was deleted.

‎src/CMakeLists.txt

+14-6
Original file line numberDiff line numberDiff line change
@@ -289,11 +289,11 @@ set(SOURCE_FILES
289289
framework/net/protocol.cpp
290290
framework/net/protocolhttp.cpp
291291
framework/net/server.cpp
292-
framework/otml//otmldocument.cpp
293-
framework/otml//otmlemitter.cpp
294-
framework/otml//otmlexception.cpp
295-
framework/otml//otmlnode.cpp
296-
framework/otml//otmlparser.cpp
292+
framework/otml/otmldocument.cpp
293+
framework/otml/otmlemitter.cpp
294+
framework/otml/otmlexception.cpp
295+
framework/otml/otmlnode.cpp
296+
framework/otml/otmlparser.cpp
297297
framework/platform/androidgameactivity.cpp
298298
framework/platform/androidmanager.cpp
299299
framework/platform/androidmanager.h
@@ -508,7 +508,7 @@ elseif(ANDROID)
508508
log
509509
pugixml::pugixml
510510
)
511-
else()
511+
else() # Linux
512512
target_include_directories(${PROJECT_NAME}
513513
PRIVATE
514514
${CMAKE_SOURCE_DIR}/src
@@ -549,6 +549,14 @@ else()
549549
LibLZMA::LibLZMA
550550
pugixml::pugixml
551551
)
552+
553+
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
554+
target_compile_options(${PROJECT_NAME}
555+
PRIVATE
556+
-Wall -Wextra -Wpedantic
557+
)
558+
endif()
559+
552560
endif()
553561

554562
# *****************************************************************************

0 commit comments

Comments
 (0)
Please sign in to comment.