Merge pull request #12 from gonicus/v1.0.7 #37
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
name: GOnnect Build | |
on: | |
workflow_dispatch: # can be manually dispatched under GitHub's "Actions" tab | |
# Run the build only, if the branch is main or a PR with main as target is used | |
# Also run only, if files were changed, which result in a changed build. | |
push: | |
branches: [ "main" ] | |
paths: | |
- 'CMakeList.txt' | |
- 'resources/**' | |
- 'media/**' | |
- 'migrate/**' | |
- 'i18n/*' | |
- 'scripts/**' | |
- 'specs/**' | |
- 'src/**' | |
# Use the main branch workflow/actions definitions rather the pull_request definitions | |
pull_request_target: | |
branches: [ "main" ] | |
paths: | |
- 'CMakeList.txt' | |
- 'resources/**' | |
- 'media/**' | |
- 'migrate/**' | |
- 'i18n/*' | |
- 'scripts/**' | |
- 'specs/**' | |
- 'src/**' | |
env: | |
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | |
BUILD_TYPE: Release | |
QT_VERSION: '6.8.1' | |
EXT_BASE: ${{github.workspace}} | |
jobs: | |
build: | |
runs-on: ubuntu-24.04 | |
name: "Build GOnnect" | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: 'recursive' | |
- name: Prepare | |
uses: ./.github/actions/prepare | |
with: | |
qt-version: ${{ env.QT_VERSION }} | |
- name: Configure CMake | |
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_TESTING=ON -DCMAKE_PREFIX_PATH="${{github.workspace}}/pjproject;${{github.workspace}}/qca/lib/cmake" | |
- name: Build | |
# Build your program with the given configuration | |
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel $(nproc --all) | |
- name: Upload Test artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: gonnect-tests | |
path: build/tests/contactsTest | |
retention-days: 1 | |
format: | |
runs-on: ubuntu-24.04 | |
name: "Code Formatting" | |
needs: build | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Run clang-format style check for C/C++/Protobuf programs. | |
uses: jidicula/[email protected] | |
with: | |
clang-format-version: '19' | |
check-path: 'src' | |
clang: | |
runs-on: ubuntu-24.04 | |
needs: build | |
name: "Static Code Analyzer" | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: 'recursive' | |
- name: Prepare | |
uses: ./.github/actions/prepare | |
with: | |
qt-version: ${{ env.QT_VERSION }} | |
- name: Run clang | |
shell: bash | |
run: | | |
pip install scan-build | |
export ANALYZE_ARGS="--exclude ${QT_ROOT_DIR} --exclude ${{github.workspace}}/external" | |
scripts/static-clang-analyzer.sh | |
- name: Save Report | |
uses: actions/upload-artifact@v4 | |
with: | |
name: clang-report | |
path: /tmp/build.log | |
# clazy: | |
# runs-on: ubuntu-24.04 | |
# #needs: build | |
# name: "Qt Semantics" | |
# | |
# steps: | |
# - uses: actions/checkout@v4 | |
# with: | |
# submodules: 'recursive' | |
# | |
# - name: Prepare | |
# uses: ./.github/actions/prepare | |
# with: | |
# qt-version: ${{ env.QT_VERSION }} | |
# for-clazy: 'true' | |
# | |
# - name: Run clazy | |
# shell: bash | |
# run: | | |
# find ~/.local/clazy/lib | |
# LD_LIBRARY_PATH=~/.local/clazy/lib scripts/static-clazy-analyzer.sh | |
tests: | |
runs-on: ubuntu-24.04 | |
name: "Unit Tests" | |
needs: build | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Prepare | |
uses: ./.github/actions/prepare | |
with: | |
qt-version: ${{ env.QT_VERSION }} | |
qt-only: 'true' | |
- name: Download Test artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: gonnect-tests | |
- name: Run Unit Tests | |
shell: bash | |
run: | | |
chmod +x contactsTest | |
LD_LIBRARY_PATH=${QT_ROOT_DIR}/lib ./contactsTest | |
semantic-release: | |
runs-on: ubuntu-24.04 | |
name: Semantic Release | |
needs: ["tests", "format", "clang"] | |
# A release will only be triggered by a push to the main branch, not on pull requests. | |
if: github.ref == 'refs/heads/main' | |
permissions: | |
contents: write # to be able to publish a GitHub release | |
issues: write # to be able to comment on released issues | |
pull-requests: write # to be able to comment on released pull requests | |
steps: | |
- name: Get token | |
id: get_token | |
uses: actions/create-github-app-token@v1 | |
with: | |
app-id: ${{ secrets.RELEASE_APP_ID }} | |
private-key: ${{ secrets.RELEASE_APP_KEY }} | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
token: ${{ steps.get_token.outputs.token }} | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "lts/*" | |
- name: Install dependencies | |
run: | | |
sudo apt update | |
sudo apt install -y xmlstarlet jq | |
- name: Release | |
env: | |
GITHUB_TOKEN: ${{ steps.get_token.outputs.token }} | |
run: npx --package=semantic-release --package=@semantic-release/changelog --package=@semantic-release/git --package=@semantic-release/exec -- semantic-release |