mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
Fix builds from CI showing up as modified (#4384)
This change also adds a new environment variable used while building: `CHATTERINO_REQUIRE_CLEAN_GIT` which, if set, will error out during your build's GIT stage. This is used in CI to ensure we don't accidentally introduce a change that would result in builds showing up as "modified" again. Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
parent
4c8ad85074
commit
9bfd12ba3c
4
.github/workflows/build.yml
vendored
4
.github/workflows/build.yml
vendored
|
@ -14,6 +14,7 @@ concurrency:
|
||||||
|
|
||||||
env:
|
env:
|
||||||
C2_ENABLE_LTO: ${{ github.ref == 'refs/heads/master' }}
|
C2_ENABLE_LTO: ${{ github.ref == 'refs/heads/master' }}
|
||||||
|
CHATTERINO_REQUIRE_CLEAN_GIT: On
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
@ -81,9 +82,8 @@ jobs:
|
||||||
uses: jurplel/install-qt-action@v3.0.0
|
uses: jurplel/install-qt-action@v3.0.0
|
||||||
with:
|
with:
|
||||||
cache: true
|
cache: true
|
||||||
cache-key-prefix: ${{ runner.os }}-QtCache-${{ matrix.qt-version }}
|
cache-key-prefix: ${{ runner.os }}-QtCache-${{ matrix.qt-version }}-v2
|
||||||
version: ${{ matrix.qt-version }}
|
version: ${{ matrix.qt-version }}
|
||||||
dir: "${{ github.workspace }}/qt/"
|
|
||||||
|
|
||||||
# WINDOWS
|
# WINDOWS
|
||||||
- name: Cache conan packages part 1
|
- name: Cache conan packages part 1
|
||||||
|
|
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -118,3 +118,6 @@ qt6.natvis
|
||||||
|
|
||||||
# Autogenerated resource file
|
# Autogenerated resource file
|
||||||
resources/resources_autogenerated.qrc
|
resources/resources_autogenerated.qrc
|
||||||
|
|
||||||
|
# Leftovers from running `aqt install`
|
||||||
|
aqtinstall.log
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
- Bugfix: Fixed the split "Search" menu action not opening the correct search window. (#4305)
|
- Bugfix: Fixed the split "Search" menu action not opening the correct search window. (#4305)
|
||||||
- Bugfix: Fixed an issue on Windows when opening links in incognito mode that contained forward slashes in hash (#4307)
|
- Bugfix: Fixed an issue on Windows when opening links in incognito mode that contained forward slashes in hash (#4307)
|
||||||
- Bugfix: Fixed an issue where beta versions wouldn't update to stable versions correctly. (#4329)
|
- Bugfix: Fixed an issue where beta versions wouldn't update to stable versions correctly. (#4329)
|
||||||
|
- Bugfix: Fixed builds from GitHub showing up as modified. (#4384)
|
||||||
- Bugfix: Avoided crash that could occur when receiving channel point reward information. (#4360)
|
- Bugfix: Avoided crash that could occur when receiving channel point reward information. (#4360)
|
||||||
- Dev: Changed sound backend from Qt to miniaudio. (#4334)
|
- Dev: Changed sound backend from Qt to miniaudio. (#4334)
|
||||||
- Dev: Removed protocol from QApplication's Organization Domain (so changed from `https://www.chatterino.com` to `chatterino.com`). (#4256)
|
- Dev: Removed protocol from QApplication's Organization Domain (so changed from `https://www.chatterino.com` to `chatterino.com`). (#4256)
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
# If the git binary is found and the git work tree is intact, GIT_RELEASE is worked out using the `git describe` command
|
# If the git binary is found and the git work tree is intact, GIT_RELEASE is worked out using the `git describe` command
|
||||||
# The value of GIT_RELEASE can be overriden by defining the GIT_RELEASE environment variable
|
# The value of GIT_RELEASE can be overriden by defining the GIT_RELEASE environment variable
|
||||||
# GIT_MODIFIED
|
# GIT_MODIFIED
|
||||||
# If the git binary is found and the git work tree is intact, GIT_MODIFIED is worked out by checking if output of `git status --porcelain -z` command is empty
|
# If the git binary is found and the git work tree is intact, GIT_MODIFIED is worked out by checking if output of `git status --porcelain -z` command is empty
|
||||||
# The value of GIT_MODIFIED cannot be overriden
|
# The value of GIT_MODIFIED cannot be overriden
|
||||||
|
|
||||||
find_package(Git)
|
find_package(Git)
|
||||||
|
@ -19,67 +19,75 @@ set(GIT_COMMIT "GIT-REPOSITORY-NOT-FOUND")
|
||||||
set(GIT_RELEASE "${PROJECT_VERSION}")
|
set(GIT_RELEASE "${PROJECT_VERSION}")
|
||||||
set(GIT_MODIFIED 0)
|
set(GIT_MODIFIED 0)
|
||||||
|
|
||||||
if (DEFINED ENV{CHATTERINO_SKIP_GIT_GEN})
|
if(DEFINED ENV{CHATTERINO_SKIP_GIT_GEN})
|
||||||
return()
|
return()
|
||||||
endif ()
|
endif()
|
||||||
|
|
||||||
if (GIT_EXECUTABLE)
|
if(GIT_EXECUTABLE)
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND ${GIT_EXECUTABLE} rev-parse --is-inside-work-tree
|
COMMAND ${GIT_EXECUTABLE} rev-parse --is-inside-work-tree
|
||||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||||
RESULT_VARIABLE GIT_REPOSITORY_NOT_FOUND
|
RESULT_VARIABLE GIT_REPOSITORY_NOT_FOUND
|
||||||
OUTPUT_QUIET
|
OUTPUT_QUIET
|
||||||
ERROR_QUIET
|
ERROR_QUIET
|
||||||
)
|
)
|
||||||
if (GIT_REPOSITORY_NOT_FOUND)
|
|
||||||
|
if(GIT_REPOSITORY_NOT_FOUND)
|
||||||
set(GIT_REPOSITORY_FOUND 0)
|
set(GIT_REPOSITORY_FOUND 0)
|
||||||
else ()
|
else()
|
||||||
set(GIT_REPOSITORY_FOUND 1)
|
set(GIT_REPOSITORY_FOUND 1)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (GIT_REPOSITORY_FOUND)
|
if(GIT_REPOSITORY_FOUND)
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
|
COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
|
||||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||||
OUTPUT_VARIABLE GIT_HASH
|
OUTPUT_VARIABLE GIT_HASH
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
)
|
)
|
||||||
|
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
|
COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
|
||||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||||
OUTPUT_VARIABLE GIT_COMMIT
|
OUTPUT_VARIABLE GIT_COMMIT
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
)
|
)
|
||||||
|
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND ${GIT_EXECUTABLE} describe
|
COMMAND ${GIT_EXECUTABLE} describe
|
||||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||||
OUTPUT_VARIABLE GIT_RELEASE
|
OUTPUT_VARIABLE GIT_RELEASE
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
)
|
)
|
||||||
|
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND ${GIT_EXECUTABLE} status --porcelain -z
|
COMMAND ${GIT_EXECUTABLE} status --porcelain -z
|
||||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||||
OUTPUT_VARIABLE GIT_MODIFIED_OUTPUT
|
OUTPUT_VARIABLE GIT_MODIFIED_OUTPUT
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
)
|
)
|
||||||
endif (GIT_REPOSITORY_FOUND)
|
endif(GIT_REPOSITORY_FOUND)
|
||||||
endif (GIT_EXECUTABLE)
|
endif(GIT_EXECUTABLE)
|
||||||
|
|
||||||
|
if(GIT_MODIFIED_OUTPUT)
|
||||||
|
if(DEFINED ENV{CHATTERINO_REQUIRE_CLEAN_GIT})
|
||||||
|
message(STATUS "git status --porcelain -z\n${GIT_MODIFIED_OUTPUT}")
|
||||||
|
message(FATAL_ERROR "Git repository was expected to be clean, but modifications were found!")
|
||||||
|
endif()
|
||||||
|
|
||||||
if (GIT_MODIFIED_OUTPUT)
|
|
||||||
set(GIT_MODIFIED 1)
|
set(GIT_MODIFIED 1)
|
||||||
endif ()
|
endif()
|
||||||
|
|
||||||
if (DEFINED ENV{GIT_HASH})
|
if(DEFINED ENV{GIT_HASH})
|
||||||
set(GIT_HASH "$ENV{GIT_HASH}")
|
set(GIT_HASH "$ENV{GIT_HASH}")
|
||||||
endif ()
|
endif()
|
||||||
if (DEFINED ENV{GIT_COMMIT})
|
|
||||||
|
if(DEFINED ENV{GIT_COMMIT})
|
||||||
set(GIT_COMMIT "$ENV{GIT_COMMIT}")
|
set(GIT_COMMIT "$ENV{GIT_COMMIT}")
|
||||||
endif ()
|
endif()
|
||||||
if (DEFINED ENV{GIT_RELEASE})
|
|
||||||
|
if(DEFINED ENV{GIT_RELEASE})
|
||||||
set(GIT_RELEASE "$ENV{GIT_RELEASE}")
|
set(GIT_RELEASE "$ENV{GIT_RELEASE}")
|
||||||
endif ()
|
endif()
|
||||||
|
|
||||||
message(STATUS "Injected git values: ${GIT_COMMIT} (${GIT_RELEASE}) modified: ${GIT_MODIFIED}")
|
message(STATUS "Injected git values: ${GIT_COMMIT} (${GIT_RELEASE}) modified: ${GIT_MODIFIED}")
|
||||||
|
|
Loading…
Reference in a new issue