Skip to content

Commit

Permalink
Update Github scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
awawa-dev committed Jul 3, 2024
1 parent 3904b19 commit a25b006
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 29 deletions.
37 changes: 24 additions & 13 deletions .ci/ci_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ else
CI_NAME="$(uname -s | tr '[:upper:]' '[:lower:]')"
fi

if [[ "$BUILD_ARCHIVES" == '0' ]]; then
IS_ARCHIVE_SKIPPED=" -DDO_NOT_BUILD_ARCHIVES=ON"
if [ ${BUILD_ARCHIVES} = true ]; then
echo "Build the package archive"
IS_ARCHIVE_SKIPPED=" -DDO_NOT_BUILD_ARCHIVES=OFF"
else
IS_ARCHIVE_SKIPPED=" -DDO_NOT_BUILD_ARCHIVES=OFF"
echo "Do not build the package archive"
IS_ARCHIVE_SKIPPED=" -DDO_NOT_BUILD_ARCHIVES=ON"
fi

# set environment variables if not exists (debug)
Expand All @@ -30,7 +32,7 @@ fi
echo "Platform: ${PLATFORM}, build type: ${BUILD_TYPE}, CI_NAME: $CI_NAME, docker image: ${DOCKER_IMAGE}, docker type: ${DOCKER_TAG}, is archive enabled: ${IS_ARCHIVE_SKIPPED}, use ccache: ${USE_CCACHE}, reset ccache: ${RESET_CACHE}"

# clear ccache if neccesery
if [[ "$RESET_CACHE" == '1' ]]; then
if [ ${RESET_CACHE} = true ]; then
echo "Clearing ccache"
rm -rf .ccache || true
rm -rf build/.ccache || true
Expand All @@ -40,12 +42,17 @@ fi
if [[ "$CI_NAME" == 'osx' || "$CI_NAME" == 'darwin' ]]; then
echo "Start: osx or darwin"

if [[ "$USE_CCACHE" == '1' ]]; then
echo "Using ccache"
BUILD_OPTION=""
if [ ${USE_CCACHE} = true ]; then
echo "Using ccache"
if [[ $(uname -m) == 'arm64' ]]; then
BUILD_OPTION=""
else
BUILD_OPTION="-DUSE_PRECOMPILED_HEADERS=OFF"
export CCACHE_COMPILERCHECK=content
fi
else
echo "Not using ccache"
BUILD_OPTION="-DDISABLE_CCACHE_USAGE=ON"
BUILD_OPTION="-DUSE_CCACHE_CACHING=OFF"
fi

echo "Build option: ${BUILD_OPTION}"
Expand All @@ -65,12 +72,12 @@ elif [[ $CI_NAME == *"mingw64_nt"* || "$CI_NAME" == 'windows_nt' ]]; then
echo "Start: windows"
echo "Number of cores: $NUMBER_OF_PROCESSORS"

if [[ "$USE_CCACHE" == '1' ]]; then
if [ ${USE_CCACHE} = true ]; then
echo "Using ccache"
BUILD_OPTION="${IS_ARCHIVE_SKIPPED}"
else
echo "Not using ccache"
BUILD_OPTION="-DDISABLE_CCACHE_USAGE=ON ${IS_ARCHIVE_SKIPPED}"
BUILD_OPTION="-DUSE_CCACHE_CACHING=OFF ${IS_ARCHIVE_SKIPPED}"
fi

echo "Build option: ${BUILD_OPTION}"
Expand All @@ -95,14 +102,14 @@ elif [[ "$CI_NAME" == 'linux' ]]; then
mkdir -p ${CI_BUILD_DIR}/deploy
mkdir -p .ccache

if [[ "$USE_CCACHE" == '1' ]]; then
if [ ${USE_CCACHE} = true ]; then
echo "Using ccache"
BUILD_OPTION="${IS_ARCHIVE_SKIPPED}"
cache_env="export CCACHE_DIR=/.ccache && ccache -z"
ls -a .ccache
else
echo "Not using ccache"
BUILD_OPTION="-DDISABLE_CCACHE_USAGE=ON ${IS_ARCHIVE_SKIPPED}"
BUILD_OPTION="-DUSE_CCACHE_CACHING=OFF ${IS_ARCHIVE_SKIPPED}"
cache_env="true"
fi

Expand All @@ -115,7 +122,11 @@ elif [[ "$CI_NAME" == 'linux' ]]; then
chmod -R a+rw ${CI_BUILD_DIR}/deploy
versionFile=`cat version`
sed -i "s/{VERSION}/${versionFile}/" PKGBUILD
sed -i "s/{BUILD_OPTION}/${BUILD_OPTION}/" PKGBUILD
if [ ${USE_CCACHE} = true ]; then
sed -i "s/{BUILD_OPTION}/${BUILD_OPTION} -DUSE_PRECOMPILED_HEADERS=OFF/" PKGBUILD
else
sed -i "s/{BUILD_OPTION}/${BUILD_OPTION}/" PKGBUILD
fi
chmod -R a+rw ${CI_BUILD_DIR}/.ccache
else
executeCommand="cd build && ( cmake ${BUILD_OPTION} -DPLATFORM=${PLATFORM} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DDEBIAN_NAME_TAG=${DOCKER_TAG} -DUSE_STANDARD_INSTALLER_NAME=${USE_STANDARD_INSTALLER_NAME} ../ || exit 2 )"
Expand Down
24 changes: 13 additions & 11 deletions .github/workflows/push-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ on:
# pull_request:

env:
USE_CACHE: "1"
RESET_CACHE: "0"
USE_CODEQL: "0"
USE_CACHE: ${{ vars.USE_CACHE && vars.USE_CACHE || true }}
RESET_CACHE: ${{ vars.RESET_CACHE && vars.RESET_CACHE || false }}
USE_CODEQL: ${{ vars.USE_CODEQL && vars.USE_CODEQL || false }}
BUILD_ARCHIVES: ${{ startsWith(github.event.ref, 'refs/tags') && 1 || 0 }}

jobs:
Expand Down Expand Up @@ -73,7 +73,7 @@ jobs:

# generate cache id
- name: Prepare ccache timestamp
if: env.USE_CACHE == '1'
if: env.USE_CACHE == 'true'
id: ccache_cache_timestamp
shell: cmake -P {0}
run: |
Expand All @@ -82,7 +82,7 @@ jobs:
# download cache
- name: Download ccache files
if: ( env.USE_CACHE == '1' )
if: env.USE_CACHE == 'true'
uses: actions/cache@v4
with:
path: .ccache
Expand Down Expand Up @@ -151,7 +151,7 @@ jobs:

# Generate cache id
- name: Prepare ccache timestamp
if: env.USE_CACHE == '1'
if: env.USE_CACHE == 'true'
id: ccache_cache_timestamp
shell: cmake -P {0}
run: |
Expand All @@ -160,7 +160,7 @@ jobs:
# Download cache
- name: Download ccache files
if: ( env.USE_CACHE == '1' )
if: env.USE_CACHE == 'true'
uses: actions/cache@v4
with:
path: build/.ccache
Expand Down Expand Up @@ -236,7 +236,7 @@ jobs:
# Generate cache id
- name: Prepare ccache timestamp
if: env.USE_CACHE == '1'
if: env.USE_CACHE == 'true'
id: ccache_cache_timestamp
shell: cmake -P {0}
run: |
Expand All @@ -245,7 +245,7 @@ jobs:
# Download cache
- name: Download ccache files
if: ( env.USE_CACHE == '1' )
if: env.USE_CACHE == 'true'
uses: actions/cache@v4
with:
path: build/.ccache
Expand Down Expand Up @@ -305,6 +305,8 @@ jobs:
analyze:
name: Analyze (CodeQL)
runs-on: ubuntu-latest
if: ${{ vars.USE_CODEQL == 'true' && vars.USE_CODEQL || false }}

permissions:
actions: read
contents: read
Expand All @@ -318,13 +320,13 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
if: ( env.USE_CODEQL == '1' )
if: env.USE_CODEQL == 'true'
with:
submodules: true

- name: Run composite CodeQL job for '${{matrix.language}}' language
uses: ./.github/actions/codeql
if: ( env.USE_CODEQL == '1' )
if: env.USE_CODEQL == 'true'
with:
language: ${{matrix.language}}

Expand Down
2 changes: 1 addition & 1 deletion include/effects/EffectDefinition.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#ifndef PCH_ENABLED
#include <cstring>
#include <string>
#include <functional>
#endif

Expand Down
2 changes: 1 addition & 1 deletion sources/grabber/osx/AVF/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ if(USE_PRECOMPILED_HEADERS AND COMMAND target_precompile_headers)
target_precompile_headers(AVF-grabber REUSE_FROM precompiled_hyperhdr_headers)
endif()

if(APPLE AND USE_CCACHE_CACHING)
if(APPLE)
set_source_files_properties(${CURRENT_SOURCE_DIR}/AVFGrabber.mm PROPERTIES SKIP_PRECOMPILE_HEADERS ON)
endif()
2 changes: 1 addition & 1 deletion sources/grabber/osx/macOS/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ if(USE_PRECOMPILED_HEADERS AND COMMAND target_precompile_headers)
target_precompile_headers(MACOS-grabber REUSE_FROM precompiled_hyperhdr_headers)
endif()

if(APPLE AND USE_CCACHE_CACHING)
if(APPLE)
set_source_files_properties(${CURRENT_SOURCE_DIR}/macOsGrabber.mm PROPERTIES SKIP_PRECOMPILE_HEADERS ON)
endif()
2 changes: 1 addition & 1 deletion sources/performance-counters/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ if(USE_PRECOMPILED_HEADERS AND COMMAND target_precompile_headers)
target_precompile_headers(performance-counters REUSE_FROM precompiled_hyperhdr_headers)
endif()

if(APPLE AND USE_CCACHE_CACHING)
if(APPLE)
set_source_files_properties(${CURRENT_SOURCE_DIR}/SystemPerformanceCounters.mm PROPERTIES SKIP_PRECOMPILE_HEADERS ON)
endif()
2 changes: 1 addition & 1 deletion sources/sound-capture/macos/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ target_link_libraries(sound-capture-macos
Qt${Qt_VERSION}::Network
)

if(USE_PRECOMPILED_HEADERS AND COMMAND target_precompile_headers AND (NOT APPLE OR NOT USE_CCACHE_CACHING))
if(USE_PRECOMPILED_HEADERS AND COMMAND target_precompile_headers AND (NOT APPLE))
target_precompile_headers(sound-capture-macos REUSE_FROM precompiled_hyperhdr_headers)
endif()

0 comments on commit a25b006

Please sign in to comment.