Skip to content

Commit

Permalink
Speed up GitHub Actions (#9375)
Browse files Browse the repository at this point in the history
  • Loading branch information
ihhub authored Dec 24, 2024
1 parent b8caf92 commit 7ee9d84
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
sudo apt-get -y install gettext
- name: Generate translations
run: |
make -C files/lang -j 2
make -C files/lang -j "$(nproc)"
- name: Create keystore
if: ${{ github.event_name == 'push' && env.KEYSTORE_BASE64 != '' }}
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
- name: Build
run: |
cmake.exe -B build -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE=Debug -DENABLE_STRICT_COMPILATION=ON -DENABLE_IMAGE=ON \
-DENABLE_TOOLS=ON -DCMAKE_TOOLCHAIN_FILE="C:\\vcpkg\\scripts\\buildsystems\\vcpkg.cmake" \
-DENABLE_TOOLS=ON -DCMAKE_TOOLCHAIN_FILE=C:\\vcpkg\\scripts\\buildsystems\\vcpkg.cmake \
-DVCPKG_TARGET_TRIPLET=x64-windows
cmake.exe --build build --config Debug
- name: Install
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codechecker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ jobs:
cmake -B build -DCMAKE_BUILD_TYPE=Debug -DENABLE_STRICT_COMPILATION=ON -DENABLE_IMAGE=ON -DENABLE_TOOLS=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
- name: Analyze
run: |
export PATH="$HOME/.python-venv/bin:$PATH"
export PATH=$HOME/.python-venv/bin:$PATH
CodeChecker analyze --analyzers clangsa --ctu-all --ctu-ast-mode load-from-pch --output codechecker-output --ignore .codechecker-ignore build/compile_commands.json
- name: Display results
run: |
export PATH="$HOME/.python-venv/bin:$PATH"
export PATH=$HOME/.python-venv/bin:$PATH
CodeChecker parse --print-steps codechecker-output
4 changes: 2 additions & 2 deletions .github/workflows/iwyu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ jobs:
cmake -B build -DCMAKE_BUILD_TYPE=Debug -DENABLE_STRICT_COMPILATION=ON -DENABLE_IMAGE=ON -DENABLE_TOOLS=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
- name: Analyze
run: |
iwyu_tool -p build -j 2 -- -Xiwyu --cxx17ns -Xiwyu --error -Xiwyu --mapping_file="$GITHUB_WORKSPACE/iwyu.map" | (grep -E -v "^$|has correct #includes/fwd-decls" || true) \
| tee iwyu-result.txt
iwyu_tool -p build -j "$(nproc)" -- -Xiwyu --cxx17ns -Xiwyu --error -Xiwyu --mapping_file="$GITHUB_WORKSPACE/iwyu.map" \
| (grep -E -v "^$|has correct #includes/fwd-decls" || true) | tee iwyu-result.txt
- uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
Expand Down
22 changes: 14 additions & 8 deletions .github/workflows/make.yml
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,15 @@ jobs:
env:
# Do not update outdated dependencies of installed packages
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: ON
- name: Build
- name: Build (Linux)
if: ${{ startsWith( matrix.config.os, 'ubuntu-' ) }}
run: |
make -j "$(nproc)"
env: ${{ matrix.config.env }}
- name: Build (MacOS)
if: ${{ startsWith( matrix.config.os, 'macos-' ) }}
run: |
make -j 2
make -j "$(sysctl -n hw.logicalcpu)"
env: ${{ matrix.config.env }}
- name: Create package
if: ${{ matrix.config.package_name != '' && matrix.config.package_files != '' }}
Expand Down Expand Up @@ -244,7 +250,7 @@ jobs:
run: |
git clone --depth 1 https://github.com/vitasdk/vdpm
cd vdpm
export PATH="$VITASDK/bin:$PATH"
export PATH=$VITASDK/bin:$PATH
./bootstrap-vitasdk.sh
./install-all.sh
rm -rf ~/.vitasdk-cache
Expand All @@ -258,8 +264,8 @@ jobs:
fi
- name: Build
run: |
export PATH="$VITASDK/bin:$PATH"
make -f Makefile.vita -j 2
export PATH=$VITASDK/bin:$PATH
make -f Makefile.vita -j "$(nproc)"
env:
FHEROES2_STRICT_COMPILATION: ON
VITASDK: /usr/local/vitasdk
Expand Down Expand Up @@ -307,14 +313,14 @@ jobs:
sudo apt-get -y install gettext p7zip-full
- name: Build
run: |
export PATH="$DEVKITPRO/tools/bin:$DEVKITPRO/portlibs/switch/bin:$DEVKITPRO/devkitA64/bin:$PATH"
make -f Makefile.switch -j 2
export PATH=$DEVKITPRO/tools/bin:$DEVKITPRO/portlibs/switch/bin:$DEVKITPRO/devkitA64/bin:$PATH
make -f Makefile.switch -j "$(nproc)"
env:
FHEROES2_STRICT_COMPILATION: ON
DEVKITPRO: /opt/devkitpro
- name: Generate translations
run: |
make -C files/lang -j 2
make -C files/lang -j "$(nproc)"
- name: Create package
run: |
7z a -bb1 -tzip -- fheroes2_switch.zip LICENSE changelog.txt fheroes2.nro ./docs/README.txt ./docs/README_switch.md files/data/*.h2d files/lang/*.mo
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/translation_update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,33 +28,33 @@ jobs:
git config user.email "[email protected]"
- name: Create PR branch
run: |
PR_BRANCH="translation-update-$(uuidgen)"
PR_BRANCH=translation-update-$(uuidgen)
git switch -c "$PR_BRANCH"
echo "PR_BRANCH=$PR_BRANCH" >> "$GITHUB_ENV"
- name: Generate POT
run: |
make -C src/dist/fheroes2 -j 2 pot
make -C src/dist/fheroes2 -j "$(nproc)" pot
- name: Merge PO with POT
run: |
make -C files/lang -j 2 merge
make -C files/lang -j "$(nproc)" merge
- name: Generate statistics
run: |
mkdir -p docs/json
for PO_FILE in files/lang/*.po; do
STATISTICS="$(msgfmt --statistics --output-file=/dev/null -- "$PO_FILE" 2>&1)"
STATISTICS=$(msgfmt --statistics --output-file=/dev/null -- "$PO_FILE" 2>&1)
echo "$PO_FILE: $STATISTICS"
if [[ "$STATISTICS" =~ ([0-9]+)\ translated\ messages? ]]; then
TRANSLATED="${BASH_REMATCH[1]}"
TRANSLATED=${BASH_REMATCH[1]}
else
TRANSLATED=0
fi
if [[ "$STATISTICS" =~ ([0-9]+)\ fuzzy\ translations? ]]; then
FUZZY="${BASH_REMATCH[1]}"
FUZZY=${BASH_REMATCH[1]}
else
FUZZY=0
fi
if [[ "$STATISTICS" =~ ([0-9]+)\ untranslated\ messages? ]]; then
UNTRANSLATED="${BASH_REMATCH[1]}"
UNTRANSLATED=${BASH_REMATCH[1]}
else
UNTRANSLATED=0
fi
Expand All @@ -64,11 +64,11 @@ jobs:
else
PERCENT=$((TRANSLATED * 100 / OVERALL))
fi
LANGUAGE="$(basename "${PO_FILE%.po}")"
LANGUAGE=$(basename "${PO_FILE%.po}")
if [[ "$(head -n1 -- "$PO_FILE")" =~ ^\#\ (.+)\ translation ]]; then
LABEL="${BASH_REMATCH[1]}"
LABEL=${BASH_REMATCH[1]}
else
LABEL="$LANGUAGE"
LABEL=$LANGUAGE
fi
if ((PERCENT < 75)); then
COLOR="red"
Expand All @@ -82,7 +82,7 @@ jobs:
- name: Commit changes
run: |
git diff --name-only -z -- files/lang/*.po \
| xargs -r0 bash -c 'set -e; for NAME in "$@"; do if [[ -n "$(git diff "-I^\"POT-Creation-Date:[^\"]*\"$" -- "$NAME")" ]]; then git add -- "$NAME"; fi; done' dummy
| xargs -r0 bash -c 'set -e; for NAME in "$@"; do if [[ -n "$(git diff "-I^\"POT-Creation-Date:[^\"]*\"$" -- "$NAME")" ]]; then git add -- "$NAME"; fi; done' dummy
git add -- docs/json/lang_*.json
if git commit -m "Update translation files"; then git push origin HEAD; echo "CREATE_PR=YES" >> "$GITHUB_ENV"; fi
- name: Create PR
Expand Down
3 changes: 0 additions & 3 deletions sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ sonar.sources=.
# Encoding of the source code. Default is default system encoding.
#sonar.sourceEncoding=UTF-8

# Properties specific to the C/C++ analyzer.
sonar.cfamily.threads=2

# List of files completely excluded from the analysis.
sonar.exclusions=src/thirdparty/**/*

Expand Down

0 comments on commit 7ee9d84

Please sign in to comment.