mirror of
https://github.com/LizardByte/Sunshine.git
synced 2025-10-29 11:23:23 +00:00
ci: use actionlint and problem matchers (#4116)
This commit is contained in:
parent
4bac84ee38
commit
99cf9ac960
5
.gitattributes
vendored
5
.gitattributes
vendored
@ -1,6 +1,5 @@
|
||||
# ensure dockerfiles are checked out with LF line endings
|
||||
# ensure Linux specific files are checked out with LF line endings
|
||||
Dockerfile text eol=lf
|
||||
*.dockerfile text eol=lf
|
||||
|
||||
# ensure flatpak lint json files are checked out with LF line endings
|
||||
*flatpak-lint-*.json text eol=lf
|
||||
*.sh text eol=lf
|
||||
|
||||
17
.github/matchers/copr-ci.json
vendored
Normal file
17
.github/matchers/copr-ci.json
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"problemMatcher": [
|
||||
{
|
||||
"owner": "copr-ci-gcc",
|
||||
"pattern": [
|
||||
{
|
||||
"regexp": "^/?(?:[^/]+/){5}([^:]+):(\\d+):(\\d+):\\s+(?:fatal\\s+)?(warning|error):\\s+(.*)$",
|
||||
"file": 1,
|
||||
"line": 2,
|
||||
"column": 3,
|
||||
"severity": 4,
|
||||
"message": 5
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
17
.github/matchers/docker.json
vendored
Normal file
17
.github/matchers/docker.json
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"problemMatcher": [
|
||||
{
|
||||
"owner": "docker-gcc",
|
||||
"pattern": [
|
||||
{
|
||||
"regexp": "^(?:#\\d+\\s+\\d+\\.\\d+\\s+)?/?(?:[^/]+/){2}([^:]+):(\\d+):(\\d+):\\s+(?:fatal\\s+)?(warning|error):\\s+(.*)$",
|
||||
"file": 1,
|
||||
"line": 2,
|
||||
"column": 3,
|
||||
"severity": 4,
|
||||
"message": 5
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
17
.github/matchers/gcc-strip3.json
vendored
Normal file
17
.github/matchers/gcc-strip3.json
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"problemMatcher": [
|
||||
{
|
||||
"owner": "gcc-strip3",
|
||||
"pattern": [
|
||||
{
|
||||
"regexp": "^/?(?:[^/]+/){3}([^:]+):(\\d+):(\\d+):\\s+(?:fatal\\s+)?(warning|error):\\s+(.*)$",
|
||||
"file": 1,
|
||||
"line": 2,
|
||||
"column": 3,
|
||||
"severity": 4,
|
||||
"message": 5
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
29
.github/matchers/gcc.json
vendored
Normal file
29
.github/matchers/gcc.json
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
{
|
||||
"problemMatcher": [
|
||||
{
|
||||
"owner": "gcc",
|
||||
"pattern": [
|
||||
{
|
||||
"regexp": "^(.*):(\\d+):(\\d+):\\s+(?:fatal\\s+)?(warning|error):\\s+(.*)$",
|
||||
"file": 1,
|
||||
"line": 2,
|
||||
"column": 3,
|
||||
"severity": 4,
|
||||
"message": 5
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"owner": "doxygen",
|
||||
"pattern": [
|
||||
{
|
||||
"regexp": "^.*?([A-Za-z]:[\\\\/][^:]+|[\\\\/][^:]+):(\\d+): ([a-zA-Z]+): (.+)$",
|
||||
"file": 1,
|
||||
"line": 2,
|
||||
"severity": 3,
|
||||
"message": 4
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
4
.github/workflows/ci-copr.yml
vendored
4
.github/workflows/ci-copr.yml
vendored
@ -16,6 +16,10 @@ on:
|
||||
required: false
|
||||
COPR_CLI_CONFIG:
|
||||
required: false
|
||||
GH_BOT_TOKEN:
|
||||
required: false
|
||||
VIRUSTOTAL_API_KEY:
|
||||
required: false
|
||||
|
||||
concurrency:
|
||||
group: "_${{ github.workflow }}-${{ github.ref }}"
|
||||
|
||||
41
.github/workflows/ci-flatpak.yml
vendored
41
.github/workflows/ci-flatpak.yml
vendored
@ -73,15 +73,16 @@ jobs:
|
||||
cmake \
|
||||
flatpak
|
||||
|
||||
sudo su $(whoami) -c "flatpak --user remote-add --if-not-exists flathub \
|
||||
https://flathub.org/repo/flathub.flatpakrepo"
|
||||
sudo su "$(whoami)" -c "flatpak --user remote-add --if-not-exists flathub \
|
||||
https://flathub.org/repo/flathub.flatpakrepo
|
||||
"
|
||||
|
||||
sudo su $(whoami) -c "flatpak --user install -y flathub \
|
||||
sudo su "$(whoami)" -c "flatpak --user install -y flathub \
|
||||
org.flatpak.Builder \
|
||||
org.freedesktop.Platform/${{ matrix.arch }}/${PLATFORM_VERSION} \
|
||||
org.freedesktop.Sdk/${{ matrix.arch }}/${PLATFORM_VERSION} \
|
||||
org.freedesktop.Sdk.Extension.node${NODE_VERSION}/${{ matrix.arch }}/${PLATFORM_VERSION} \
|
||||
"
|
||||
"
|
||||
|
||||
flatpak run org.flatpak.Builder --version
|
||||
|
||||
@ -101,9 +102,11 @@ jobs:
|
||||
flatpak-${{ matrix.arch }}-
|
||||
|
||||
- name: Configure Flatpak Manifest
|
||||
env:
|
||||
BRANCH: ${{ github.head_ref }}
|
||||
run: |
|
||||
# variables for manifest
|
||||
branch="${{ github.head_ref }}"
|
||||
branch="${{ env.BRANCH }}"
|
||||
build_version=${{ inputs.release_version }}
|
||||
commit=${{ inputs.release_commit }}
|
||||
|
||||
@ -137,19 +140,20 @@ jobs:
|
||||
|
||||
- name: Debug Manifest
|
||||
working-directory: build
|
||||
run: cat ${APP_ID}.yml
|
||||
run: cat "${APP_ID}.yml"
|
||||
|
||||
- name: Build Linux Flatpak
|
||||
working-directory: build
|
||||
run: |
|
||||
sudo su $(whoami) -c "flatpak run org.flatpak.Builder \
|
||||
echo "::add-matcher::.github/matchers/gcc-strip3.json"
|
||||
sudo su "$(whoami)" -c "flatpak run org.flatpak.Builder \
|
||||
--arch=${{ matrix.arch }} \
|
||||
--force-clean \
|
||||
--repo=repo \
|
||||
--sandbox \
|
||||
--stop-at=cuda build-sunshine ${APP_ID}.yml"
|
||||
cp -r .flatpak-builder copy-of-flatpak-builder
|
||||
sudo su $(whoami) -c "flatpak run org.flatpak.Builder \
|
||||
sudo su "$(whoami)" -c "flatpak run org.flatpak.Builder \
|
||||
--arch=${{ matrix.arch }} \
|
||||
--force-clean \
|
||||
--repo=repo \
|
||||
@ -157,15 +161,16 @@ jobs:
|
||||
build-sunshine ${APP_ID}.yml"
|
||||
rm -rf .flatpak-builder
|
||||
mv copy-of-flatpak-builder .flatpak-builder
|
||||
sudo su $(whoami) -c "flatpak build-bundle \
|
||||
sudo su "$(whoami)" -c "flatpak build-bundle \
|
||||
--arch=${{ matrix.arch }} \
|
||||
./repo \
|
||||
../artifacts/sunshine_${{ matrix.arch }}.flatpak ${APP_ID}"
|
||||
sudo su $(whoami) -c "flatpak build-bundle \
|
||||
sudo su "$(whoami)" -c "flatpak build-bundle \
|
||||
--runtime \
|
||||
--arch=${{ matrix.arch }} \
|
||||
./repo \
|
||||
../artifacts/sunshine_debug_${{ matrix.arch }}.flatpak ${APP_ID}.Debug"
|
||||
echo "::remove-matcher owner=gcc-strip3::"
|
||||
|
||||
- name: Lint Flatpak
|
||||
working-directory: build
|
||||
@ -177,7 +182,7 @@ jobs:
|
||||
--exceptions \
|
||||
--user-exceptions "${exceptions_file}" \
|
||||
manifest \
|
||||
${APP_ID}.yml
|
||||
"${APP_ID}.yml"
|
||||
|
||||
echo "Linting flatpak repo"
|
||||
# TODO: add arg
|
||||
@ -193,13 +198,13 @@ jobs:
|
||||
if: matrix.arch == 'x86_64'
|
||||
run: |
|
||||
mkdir -p flathub/modules
|
||||
cp ./build/generated-sources.json ./flathub/
|
||||
cp ./build/package-lock.json ./flathub/
|
||||
cp ./build/${APP_ID}.yml ./flathub/
|
||||
cp ./build/${APP_ID}.metainfo.xml ./flathub/
|
||||
cp ./packaging/linux/flatpak/README.md ./flathub/
|
||||
cp ./packaging/linux/flatpak/flathub.json ./flathub/
|
||||
cp -r ./packaging/linux/flatpak/modules/. ./flathub/modules/
|
||||
cp "./build/generated-sources.json" "./flathub/"
|
||||
cp "./build/package-lock.json" "./flathub/"
|
||||
cp "./build/${APP_ID}.yml" "./flathub/"
|
||||
cp "./build/${APP_ID}.metainfo.xml" "./flathub/"
|
||||
cp "./packaging/linux/flatpak/README.md" "./flathub/"
|
||||
cp "./packaging/linux/flatpak/flathub.json" "./flathub/"
|
||||
cp -r "./packaging/linux/flatpak/modules/." "./flathub/modules/"
|
||||
# submodules will need to be handled in the workflow that creates the PR
|
||||
|
||||
# create the archive
|
||||
|
||||
16
.github/workflows/ci-homebrew.yml
vendored
16
.github/workflows/ci-homebrew.yml
vendored
@ -73,9 +73,13 @@ jobs:
|
||||
brew install python3
|
||||
|
||||
- name: Configure formula
|
||||
env:
|
||||
HEAD_REF: ${{ github.head_ref }}
|
||||
PR_HEAD_REF: ${{ github.event.pull_request.head.ref }}
|
||||
PR_DEFAULT_BRANCH: ${{ github.event.pull_request.head.repo.default_branch }}
|
||||
run: |
|
||||
# variables for formula
|
||||
branch="${{ github.head_ref }}"
|
||||
branch="${{ env.HEAD_REF }}"
|
||||
build_version=${{ inputs.release_version }}
|
||||
commit=${{ inputs.release_commit }}
|
||||
|
||||
@ -96,9 +100,9 @@ jobs:
|
||||
else
|
||||
echo "This is a PR event"
|
||||
clone_url=${{ github.event.pull_request.head.repo.clone_url }}
|
||||
branch="${{ github.event.pull_request.head.ref }}"
|
||||
default_branch="${{ github.event.pull_request.head.repo.default_branch }}"
|
||||
tag="${{ github.event.pull_request.head.ref }}"
|
||||
branch="${{ env.PR_HEAD_REF }}"
|
||||
default_branch="${{ env.PR_DEFAULT_BRANCH }}"
|
||||
tag="${{ env.PR_HEAD_REF }}"
|
||||
fi
|
||||
echo "Branch: ${branch}"
|
||||
echo "Clone URL: ${clone_url}"
|
||||
@ -143,8 +147,9 @@ jobs:
|
||||
export DISPLAY=:1
|
||||
Xvfb ${DISPLAY} -screen 0 1024x768x24 &
|
||||
|
||||
echo "DISPLAY=${DISPLAY}" >> $GITHUB_ENV
|
||||
echo "DISPLAY=${DISPLAY}" >> "${GITHUB_ENV}"
|
||||
|
||||
- run: echo "::add-matcher::.github/matchers/gcc-strip3.json"
|
||||
- name: Validate Homebrew Formula
|
||||
id: test
|
||||
if: matrix.release != true
|
||||
@ -156,6 +161,7 @@ jobs:
|
||||
publish: false
|
||||
token: ${{ secrets.GH_TOKEN }}
|
||||
validate: true
|
||||
- run: echo "::remove-matcher owner=gcc-strip3::"
|
||||
|
||||
- name: Setup python
|
||||
id: python
|
||||
|
||||
8
.github/workflows/ci-linux.yml
vendored
8
.github/workflows/ci-linux.yml
vendored
@ -79,8 +79,8 @@ jobs:
|
||||
--enable-x11 \
|
||||
--enable-glx \
|
||||
--enable-wayland \
|
||||
--without-legacy # emgd, nvctrl, fglrx
|
||||
make -j $(nproc)
|
||||
--without-legacy
|
||||
make -j "$(nproc)"
|
||||
sudo make install
|
||||
cd .. && rm -rf libva-*
|
||||
|
||||
@ -91,6 +91,7 @@ jobs:
|
||||
COMMIT: ${{ inputs.release_commit }}
|
||||
run: |
|
||||
chmod +x ./scripts/linux_build.sh
|
||||
echo "::add-matcher::.github/matchers/gcc.json"
|
||||
./scripts/linux_build.sh \
|
||||
--publisher-name='${{ github.repository_owner }}' \
|
||||
--publisher-website='https://app.lizardbyte.dev' \
|
||||
@ -98,12 +99,13 @@ jobs:
|
||||
--skip-cleanup \
|
||||
--skip-package \
|
||||
--ubuntu-test-repo ${{ matrix.EXTRA_ARGS }}
|
||||
echo "::remove-matcher owner=gcc::"
|
||||
|
||||
- name: Set AppImage Version
|
||||
if: matrix.name == 'AppImage'
|
||||
run: |
|
||||
version=${{ inputs.release_version }}
|
||||
echo "VERSION=${version}" >> $GITHUB_ENV
|
||||
echo "VERSION=${version}" >> "${GITHUB_ENV}"
|
||||
|
||||
- name: Package Linux - AppImage
|
||||
if: matrix.name == 'AppImage'
|
||||
|
||||
10
.github/workflows/ci-windows.yml
vendored
10
.github/workflows/ci-windows.yml
vendored
@ -199,12 +199,12 @@ jobs:
|
||||
ignore_list=$(IFS=,; echo "${ignore_packages[*]}")
|
||||
|
||||
# install pinned dependencies
|
||||
if [ -n "$tarballs" ]; then
|
||||
pacman -U --noconfirm ${tarballs}
|
||||
if [ -n "${tarballs}" ]; then
|
||||
pacman -U --noconfirm "${tarballs}"
|
||||
fi
|
||||
|
||||
# Only add --ignore if we have packages to ignore
|
||||
if [ -n "$ignore_list" ]; then
|
||||
if [ -n "${ignore_list}" ]; then
|
||||
pacman -Syu --noconfirm --ignore="${ignore_list}" "${dependencies[@]}"
|
||||
else
|
||||
pacman -Syu --noconfirm "${dependencies[@]}"
|
||||
@ -251,7 +251,7 @@ jobs:
|
||||
|
||||
# step output
|
||||
echo "python-path=${python_path}"
|
||||
echo "python-path=${python_path}" >> $GITHUB_OUTPUT
|
||||
echo "python-path=${python_path}" >> "${GITHUB_OUTPUT}"
|
||||
|
||||
- name: Build Windows
|
||||
shell: msys2 {0}
|
||||
@ -272,7 +272,9 @@ jobs:
|
||||
-DSUNSHINE_PUBLISHER_NAME='${{ github.repository_owner }}' \
|
||||
-DSUNSHINE_PUBLISHER_WEBSITE='https://app.lizardbyte.dev' \
|
||||
-DSUNSHINE_PUBLISHER_ISSUE_URL='https://app.lizardbyte.dev/support'
|
||||
echo "::add-matcher::.github/matchers/gcc.json"
|
||||
ninja -C build
|
||||
echo "::remove-matcher owner=gcc::"
|
||||
|
||||
- name: Package Windows
|
||||
shell: msys2 {0}
|
||||
|
||||
8
.github/workflows/localize.yml
vendored
8
.github/workflows/localize.yml
vendored
@ -48,9 +48,9 @@ jobs:
|
||||
if [ -f "${{ env.file }}" ];
|
||||
then
|
||||
rm ${{ env.file }}
|
||||
echo "new_file=false" >> $GITHUB_ENV
|
||||
echo "new_file=false" >> "${GITHUB_ENV}"
|
||||
else
|
||||
echo "new_file=true" >> $GITHUB_ENV
|
||||
echo "new_file=true" >> "${GITHUB_ENV}"
|
||||
fi
|
||||
|
||||
# extract the new strings
|
||||
@ -67,7 +67,7 @@ jobs:
|
||||
|
||||
# set the variable with minimal output, replacing `\t` with ` `
|
||||
OUTPUT=$(git diff --numstat locale/sunshine.po | sed -e "s#\t# #g")
|
||||
echo "git_diff=${OUTPUT}" >> $GITHUB_ENV
|
||||
echo "git_diff=${OUTPUT}" >> "${GITHUB_ENV}"
|
||||
|
||||
- name: git reset
|
||||
# only run if a single line changed (date/time) and file already existed
|
||||
@ -79,7 +79,7 @@ jobs:
|
||||
|
||||
- name: Get current date
|
||||
id: date
|
||||
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
|
||||
run: echo "date=$(date +'%Y-%m-%d')" >> "${GITHUB_OUTPUT}"
|
||||
|
||||
- name: Create/Update Pull Request
|
||||
uses: peter-evans/create-pull-request@v7
|
||||
|
||||
@ -1,18 +1,18 @@
|
||||
# Set build variables if env variables are defined
|
||||
# These are used in configured files such as manifests for different packages
|
||||
if(DEFINED ENV{BRANCH}) # cmake-lint: disable=W0106
|
||||
if(DEFINED ENV{BRANCH})
|
||||
set(GITHUB_BRANCH $ENV{BRANCH})
|
||||
endif()
|
||||
if(DEFINED ENV{BUILD_VERSION}) # cmake-lint: disable=W0106
|
||||
set(BUILD_VERSION $ENV{BUILD_VERSION})
|
||||
endif()
|
||||
if(DEFINED ENV{CLONE_URL}) # cmake-lint: disable=W0106
|
||||
if(DEFINED ENV{CLONE_URL})
|
||||
set(GITHUB_CLONE_URL $ENV{CLONE_URL})
|
||||
endif()
|
||||
if(DEFINED ENV{COMMIT}) # cmake-lint: disable=W0106
|
||||
if(DEFINED ENV{COMMIT})
|
||||
set(GITHUB_COMMIT $ENV{COMMIT})
|
||||
endif()
|
||||
if(DEFINED ENV{TAG}) # cmake-lint: disable=W0106
|
||||
if(DEFINED ENV{TAG})
|
||||
set(GITHUB_TAG $ENV{TAG})
|
||||
endif()
|
||||
|
||||
|
||||
@ -32,7 +32,6 @@ ENV CLONE_URL=${CLONE_URL}
|
||||
|
||||
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||
|
||||
# hadolint ignore=SC2016
|
||||
RUN <<_SETUP
|
||||
#!/bin/bash
|
||||
set -e
|
||||
@ -42,6 +41,7 @@ useradd -m builder
|
||||
echo 'builder ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
|
||||
|
||||
# patch the build flags
|
||||
# shellcheck disable=SC2016
|
||||
sed -i 's,#MAKEFLAGS="-j2",MAKEFLAGS="-j$(nproc)",g' /etc/makepkg.conf
|
||||
|
||||
# install dependencies
|
||||
|
||||
@ -19,7 +19,6 @@ ENV DISPLAY=:0
|
||||
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||
|
||||
# install dependencies
|
||||
# hadolint ignore=SC1091
|
||||
RUN <<_DEPS
|
||||
#!/bin/bash
|
||||
set -e
|
||||
@ -74,7 +73,6 @@ WORKDIR /build/cuda
|
||||
# versions: https://developer.nvidia.com/cuda-toolkit-archive
|
||||
ENV CUDA_VERSION="11.8.0"
|
||||
ENV CUDA_BUILD="520.61.05"
|
||||
# hadolint ignore=SC3010
|
||||
RUN <<_INSTALL_CUDA
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
@ -42,7 +42,6 @@ _BUILD
|
||||
|
||||
# run tests
|
||||
WORKDIR /build/sunshine/build/tests
|
||||
# hadolint ignore=SC1091
|
||||
RUN <<_TEST
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
@ -42,7 +42,6 @@ _BUILD
|
||||
|
||||
# run tests
|
||||
WORKDIR /build/sunshine/build/tests
|
||||
# hadolint ignore=SC1091
|
||||
RUN <<_TEST
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
@ -42,7 +42,6 @@ _BUILD
|
||||
|
||||
# run tests
|
||||
WORKDIR /build/sunshine/build/tests
|
||||
# hadolint ignore=SC1091
|
||||
RUN <<_TEST
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
@ -97,9 +97,6 @@ tar -xzf %{SOURCE0} -C %{_builddir}/Sunshine
|
||||
# list directory
|
||||
ls -a %{_builddir}/Sunshine
|
||||
|
||||
# patches
|
||||
%autopatch -p1
|
||||
|
||||
%build
|
||||
# exit on error
|
||||
set -e
|
||||
|
||||
@ -2,12 +2,12 @@
|
||||
|
||||
# User Service
|
||||
mkdir -p ~/.config/systemd/user
|
||||
cp /app/share/sunshine/systemd/user/sunshine.service $HOME/.config/systemd/user/sunshine.service
|
||||
echo Sunshine User Service has been installed.
|
||||
echo Use [systemctl --user enable sunshine] once to autostart Sunshine on login.
|
||||
cp "/app/share/sunshine/systemd/user/sunshine.service" "$HOME/.config/systemd/user/sunshine.service"
|
||||
echo "Sunshine User Service has been installed."
|
||||
echo "Use [systemctl --user enable sunshine] once to autostart Sunshine on login."
|
||||
|
||||
# Udev rule
|
||||
UDEV=$(cat /app/share/sunshine/udev/rules.d/60-sunshine.rules)
|
||||
echo Configuring mouse permission.
|
||||
echo "Configuring mouse permission."
|
||||
flatpak-spawn --host pkexec sh -c "echo '$UDEV' > /etc/udev/rules.d/60-sunshine.rules"
|
||||
echo Restart computer for mouse permission to take effect.
|
||||
echo "Restart computer for mouse permission to take effect."
|
||||
|
||||
@ -2,10 +2,10 @@
|
||||
|
||||
# User Service
|
||||
systemctl --user stop sunshine
|
||||
rm $HOME/.config/systemd/user/sunshine.service
|
||||
rm "$HOME/.config/systemd/user/sunshine.service"
|
||||
systemctl --user daemon-reload
|
||||
echo Sunshine User Service has been removed.
|
||||
echo "Sunshine User Service has been removed."
|
||||
|
||||
# Udev rule
|
||||
flatpak-spawn --host pkexec sh -c "rm /etc/udev/rules.d/60-sunshine.rules"
|
||||
echo Input rules removed. Restart computer to take effect.
|
||||
echo "Input rules removed. Restart computer to take effect."
|
||||
|
||||
@ -1,61 +1,63 @@
|
||||
#!/bin/bash
|
||||
|
||||
if ! [ -x "$(command -v ./go-png2ico)" ]; then
|
||||
echo "./go-png2ico not found"
|
||||
echo "download the executable from https://github.com/J-Siu/go-png2ico"
|
||||
echo "and drop it in this folder"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! [ -x "$(command -v ./oxipng)" ]; then
|
||||
echo "./oxipng executable not found"
|
||||
echo "download the executable from https://github.com/shssoichiro/oxipng"
|
||||
echo "and drop it in this folder"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! [ -x "$(command -v inkscape)" ]; then
|
||||
echo "inkscape executable not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
icon_base_sizes=(16 64)
|
||||
icon_sizes_keys=() # associative array to prevent duplicates
|
||||
icon_sizes_keys[256]=1
|
||||
|
||||
for icon_base_size in ${icon_base_sizes[@]}; do
|
||||
# increment in 25% till 400%
|
||||
icon_size_increment=$((icon_base_size / 4))
|
||||
for ((i = 0; i <= 12; i++)); do
|
||||
icon_sizes_keys[$((icon_base_size + i * icon_size_increment))]=1
|
||||
done
|
||||
done
|
||||
|
||||
# convert to normal array
|
||||
icon_sizes=${!icon_sizes_keys[@]}
|
||||
|
||||
echo "using icon sizes:"
|
||||
echo ${icon_sizes[@]}
|
||||
|
||||
src_vectors=("../../src_assets/common/assets/web/public/images/sunshine-locked.svg"
|
||||
"../../src_assets/common/assets/web/public/images/sunshine-pausing.svg"
|
||||
"../../src_assets/common/assets/web/public/images/sunshine-playing.svg"
|
||||
"../../sunshine.svg")
|
||||
|
||||
echo "using sources vectors:"
|
||||
echo ${src_vectors[@]}
|
||||
|
||||
for src_vector in ${src_vectors[@]}; do
|
||||
file_name=`basename "$src_vector" .svg`
|
||||
png_files=()
|
||||
for icon_size in ${icon_sizes[@]}; do
|
||||
png_file="${file_name}${icon_size}.png"
|
||||
echo "converting ${png_file}"
|
||||
inkscape -w $icon_size -h $icon_size "$src_vector" --export-filename "${png_file}" &&
|
||||
./oxipng -o max --strip safe --alpha "${png_file}" &&
|
||||
png_files+=("${png_file}")
|
||||
done
|
||||
|
||||
echo "packing ${file_name}.ico"
|
||||
./go-png2ico "${png_files[@]}" "${file_name}.ico"
|
||||
done
|
||||
#!/bin/bash
|
||||
|
||||
if ! [ -x "$(command -v ./go-png2ico)" ]; then
|
||||
echo "./go-png2ico not found"
|
||||
echo "download the executable from https://github.com/J-Siu/go-png2ico"
|
||||
echo "and drop it in this folder"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! [ -x "$(command -v ./oxipng)" ]; then
|
||||
echo "./oxipng executable not found"
|
||||
echo "download the executable from https://github.com/shssoichiro/oxipng"
|
||||
echo "and drop it in this folder"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! [ -x "$(command -v inkscape)" ]; then
|
||||
echo "inkscape executable not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
icon_base_sizes=(16 64)
|
||||
icon_sizes_keys=() # associative array to prevent duplicates
|
||||
icon_sizes_keys[256]=1
|
||||
|
||||
for icon_base_size in "${icon_base_sizes[@]}"; do
|
||||
# increment in 25% till 400%
|
||||
icon_size_increment=$((icon_base_size / 4))
|
||||
for ((i = 0; i <= 12; i++)); do
|
||||
icon_sizes_keys[icon_base_size + i * icon_size_increment]=1
|
||||
done
|
||||
done
|
||||
|
||||
# convert to normal array
|
||||
icon_sizes=("${!icon_sizes_keys[@]}")
|
||||
|
||||
echo "using icon sizes:"
|
||||
# shellcheck disable=SC2068 # intentionally word split
|
||||
echo ${icon_sizes[@]}
|
||||
|
||||
src_vectors=("../../src_assets/common/assets/web/public/images/sunshine-locked.svg"
|
||||
"../../src_assets/common/assets/web/public/images/sunshine-pausing.svg"
|
||||
"../../src_assets/common/assets/web/public/images/sunshine-playing.svg"
|
||||
"../../sunshine.svg")
|
||||
|
||||
echo "using sources vectors:"
|
||||
# shellcheck disable=SC2068 # intentionally word split
|
||||
echo ${src_vectors[@]}
|
||||
|
||||
for src_vector in "${src_vectors[@]}"; do
|
||||
file_name=$(basename "${src_vector}" .svg)
|
||||
png_files=()
|
||||
for icon_size in "${icon_sizes[@]}"; do
|
||||
png_file="${file_name}${icon_size}.png"
|
||||
echo "converting ${png_file}"
|
||||
inkscape -w "${icon_size}" -h "${icon_size}" "${src_vector}" --export-filename "${png_file}" &&
|
||||
./oxipng -o max --strip safe --alpha "${png_file}" &&
|
||||
png_files+=("${png_file}")
|
||||
done
|
||||
|
||||
echo "packing ${file_name}.ico"
|
||||
./go-png2ico "${png_files[@]}" "${file_name}.ico"
|
||||
done
|
||||
|
||||
@ -460,6 +460,8 @@ function run_install() {
|
||||
nvm_url="https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh"
|
||||
echo "nvm url: ${nvm_url}"
|
||||
wget -qO- ${nvm_url} | bash
|
||||
|
||||
# shellcheck source=/dev/null # we don't care that shellcheck cannot find nvm.sh
|
||||
source "$HOME/.nvm/nvm.sh"
|
||||
nvm install node
|
||||
nvm use node
|
||||
|
||||
@ -27,7 +27,8 @@ for dir in ${DIRECTORIES}; do
|
||||
|
||||
# remove the directory if it is empty
|
||||
if [[ $empty_dir != "" ]]; then # prevent the loop from running and failing if no directories found
|
||||
for i in "${empty_dir}"; do # don't split words as we already know this will be a single directory
|
||||
# shellcheck disable=SC2066 # don't split words as we already know this will be a single directory
|
||||
for i in "${empty_dir}"; do
|
||||
echo "Removing empty directory: ${i}"
|
||||
rmdir "${i}"
|
||||
done
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user