-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use shared workflow and correct opensuse dependencies
- Loading branch information
Showing
2 changed files
with
7 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,156 +17,7 @@ permissions: | |
contents: write | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: | ||
- name: ubuntu | ||
image: ubuntu:24.10 | ||
- name: ubuntu | ||
image: ubuntu:24.04 | ||
- name: opensuse | ||
image: opensuse/tumbleweed | ||
- name: fedora | ||
image: fedora:40 | ||
plasma_version: [plasma5, plasma6] | ||
exclude: | ||
- os: | ||
image: ubuntu:24.10 | ||
plasma_version: plasma5 | ||
- os: | ||
image: ubuntu:24.04 | ||
plasma_version: plasma6 | ||
|
||
runs-on: ubuntu-latest | ||
name: ${{ matrix.os.name }}-${{ matrix.plasma_version }} | ||
container: | ||
image: ${{ matrix.os.image }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
sparse-checkout: | | ||
README.md | ||
- name: Install dependencies | ||
shell: bash | ||
run: | | ||
echo "Dependencies for install-${{ matrix.os.name }}-${{ matrix.plasma_version }}" | ||
CMD=$(sed -n '/```bash install-${{ matrix.os.name }}-${{ matrix.plasma_version }}/,/```/p' README.md | head -n -1 | tail -n +2 |sed 's/sudo //') | ||
if [[ "${{ matrix.os.name }}" == "ubuntu" ]]; then | ||
apt update | ||
export DEBIAN_FRONTEND=noninteractive | ||
echo 'APT::Get::Assume-Yes "true";' >> /etc/apt/apt.conf | ||
elif [[ "${{ matrix.os.name }}" == "fedora" ]]; then | ||
echo "defaultyes=True" >> /etc/dnf/dnf.conf | ||
dnf install rpm-build | ||
elif [[ "${{ matrix.os.name }}" == "opensuse" ]]; then | ||
zypper refresh | ||
CMD=$(echo $CMD | sed 's/zypper/zypper --non-interactive/') | ||
zypper install -y rpm-build | ||
else | ||
echo "Unsupported OS: ${{ matrix.os.name }}" | ||
exit 1 | ||
fi | ||
echo "$CMD" | ||
eval $CMD | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
fetch-depth: 0 | ||
|
||
- name: Get defined project version | ||
shell: bash | ||
run: echo project_version=$(sed -nr 's/set\(CMAKE_PROJECT_VERSION "(.+)"\)/\1/p' CMakeLists.txt) >> $GITHUB_ENV | ||
|
||
- name: Update Version in CMakeLists | ||
if: inputs.publish-version | ||
shell: bash | ||
run: | | ||
publish_version="${{ inputs.publish-version }}" | ||
if ! [[ $publish_version =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | ||
echo "Error: Invalid version format for publish-version: $publish_version. It must be in the format x.y.z." | ||
exit 1 | ||
fi | ||
if [ "$(printf "%s\n%s" "${{ env.project_version }}" "$publish_version" | sort -V | head -n1)" != "${{ env.project_version }}" ] || [ "${{ env.project_version }}" == "$publish_version" ]; then | ||
echo "CMake version ${{ env.project_version }} is not smaller than publish-version $publish_version." | ||
exit 1 | ||
fi | ||
sed -i -E "s/(set\s*\(\s*CMAKE_PROJECT_VERSION\s*\")[0-9]+\.[0-9]+\.[0-9]+(\")/\1${publish_version}\2/" CMakeLists.txt | ||
- name: Create build directory | ||
run: mkdir -p build | ||
|
||
- name: Build and install | ||
working-directory: build/ | ||
shell: bash | ||
run: | | ||
CMAKE_ARGS=".. -DCMAKE_BUILD_TYPE=Release -DCPACK_OS=${{ matrix.os.name }}" | ||
if [[ "${{ matrix.plasma_version }}" == "plasma6" ]]; then | ||
CMAKE_ARGS="$CMAKE_ARGS -DBUILD_WITH_QT6=ON" | ||
else | ||
CMAKE_ARGS="$CMAKE_ARGS -DBUILD_WITH_QT6=OFF" | ||
fi | ||
echo cmake $CMAKE_ARGS | ||
cmake $CMAKE_ARGS | ||
cmake --build . -j2 | ||
cmake --install . | ||
- name: Run tests | ||
working-directory: build/ | ||
run: ctest -V | ||
|
||
- name: CPack | ||
if: inputs.publish-version | ||
working-directory: build | ||
id: cpack | ||
shell: bash | ||
run: | | ||
cpack | tee cpack.out | ||
filepath=$(sed -nr 's/.*package: (.+) generated\./\1/p' cpack.out) | ||
echo "filepath=$filepath" >> "$GITHUB_OUTPUT" | ||
- uses: actions/upload-artifact@v4 | ||
if: inputs.publish-version | ||
with: | ||
name: ${{ matrix.os.name }}-${{ matrix.plasma_version }} | ||
path: ${{ steps.cpack.outputs.filepath }} | ||
|
||
release: | ||
runs-on: ubuntu-latest | ||
needs: build | ||
if: inputs.publish-version | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
fetch-depth: 0 | ||
- name: Update Version in CMakeLists | ||
run: | | ||
sed -i -E "s/(set\s*\(\s*CMAKE_PROJECT_VERSION\s*\")[0-9]+\.[0-9]+\.[0-9]+(\")/\1${{ inputs.publish-version }}\2/" CMakeLists.txt | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
path: binaries | ||
- name: Collect files | ||
id: collect_artifacts | ||
shell: bash | ||
run: | | ||
files=$(find binaries -type f | paste -sd "," -) | ||
echo "uploaded_files=$files" >> "$GITHUB_OUTPUT" | ||
- name: Create Tag | ||
shell: bash | ||
run: | | ||
git config --global user.name 'alex1701c' | ||
git config --global user.email '[email protected]' | ||
git commit -am "New release ${{ inputs.publish-version }}" | ||
git tag -a "${{ inputs.publish-version }}" -m "Release version ${{ inputs.publish-version }}" | ||
git push | ||
git push --tags | ||
- uses: ncipollo/release-action@v1 | ||
with: | ||
artifacts: ${{ steps.collect_artifacts.outputs.uploaded_files }} | ||
tag: ${{ inputs.publish-version }} | ||
generateReleaseNotes: true | ||
|
||
build-and-publish: | ||
uses: alex1701c/actions/.github/workflows/plugin_ci_publish.yaml@main | ||
with: | ||
publish-version: ${{ inputs.publish-version }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters