Skip to content

Commit 1f039a0

Browse files
committed
Add GH action workflows for test and release.
1 parent fe1fde3 commit 1f039a0

File tree

2 files changed

+199
-0
lines changed

2 files changed

+199
-0
lines changed
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
name: Build and release version as draft
2+
on:
3+
workflow_dispatch:
4+
push:
5+
tags:
6+
- "*"
7+
8+
jobs:
9+
10+
release:
11+
name: Create Release
12+
runs-on: ubuntu-latest
13+
outputs:
14+
upload_url: ${{ steps.create_release.outputs.upload_url }}
15+
version: ${{ steps.get_version.outputs.version }}
16+
name: 'DSEP4TP'
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-tags: true
22+
sparse-checkout: |
23+
CHANGELOG.md
24+
25+
- name: Get Version
26+
id: get_version
27+
run: echo "version=$(git describe --tags --abbrev=0)" >> "$GITHUB_OUTPUT"
28+
29+
- name: "Check if release exists"
30+
uses: actions/github-script@v7
31+
id: check_release
32+
with:
33+
result-encoding: string
34+
script: |
35+
const tag = '${{ steps.get_version.outputs.version }}';
36+
let exists = false;
37+
try {
38+
const releases = await github.rest.repos.listReleases(context.repo);
39+
exists = releases.data.some((r) => r.tag_name == tag );
40+
}
41+
catch { core.setFailed(err); }
42+
console.log("Release for tag", tag, "already exists:", exists);
43+
core.setOutput('release_exists', exists);
44+
45+
- name: "Get release notes"
46+
if: ${{ steps.check_release.outputs.release_exists == 'false' }}
47+
uses: mpaperno/ghaction-get-release-notes@v1
48+
id: release_notes
49+
with:
50+
version_tag: ${{ steps.get_version.outputs.version }}
51+
fallback_to_latest: true
52+
53+
- name: Create Release
54+
id: create_release
55+
uses: ncipollo/release-action@v1
56+
with:
57+
tag: v${{ steps.get_version.outputs.version }}
58+
name: ${{ steps.release_notes.outputs.release_title }}
59+
body: ${{ steps.release_notes.outputs.release_notes }}
60+
draft: true
61+
prerelease: true
62+
allowUpdates: true
63+
updateOnlyUnreleased: true
64+
skipIfReleaseExists: false
65+
removeArtifacts: true
66+
omitBodyDuringUpdate: true
67+
omitDraftDuringUpdate: true
68+
omitNameDuringUpdate: true
69+
omitPrereleaseDuringUpdate: true
70+
71+
build:
72+
name: Build
73+
needs: release
74+
strategy:
75+
fail-fast: false
76+
matrix:
77+
os: [
78+
windows-latest,
79+
macos-latest,
80+
# macos-13,
81+
ubuntu-latest
82+
]
83+
runs-on: ${{ matrix.os }}
84+
steps:
85+
- name: Checkout repository
86+
uses: actions/checkout@v4
87+
88+
- name: Install Qt
89+
uses: jurplel/install-qt-action@v4
90+
with:
91+
version: 6.5.*
92+
tools: ${{ startsWith(matrix.os, 'windows') && 'tools_ninja tools_opensslv3_x64' || 'tools_ninja' }}
93+
# modules: 'qtwebsockets'
94+
95+
- name: Configure MSVC
96+
if: ${{ startsWith(matrix.os, 'windows') }}
97+
# https://github.com/ilammy/msvc-dev-cmd
98+
uses: ilammy/msvc-dev-cmd@v1
99+
with:
100+
arch: x64
101+
toolset: 14.29
102+
103+
- name: Configure CMake
104+
env:
105+
QTHOME: '${{ env.IQTA_TOOLS }}/..'
106+
run: |
107+
cmake -G "Ninja" -B ./build-Release -S ./src -DCMAKE_PREFIX_PATH:PATH=${QT_ROOT_DIR} -DCMAKE_BUILD_TYPE=Release -DTPClient_BUILD_SHARED_LIBS:BOOL=OFF
108+
109+
- name: Build
110+
run: cmake --build ./build-Release --target ${{ needs.release.outputs.name }} install
111+
112+
- name: Mac extra deploy step
113+
if: ${{ startsWith(matrix.os, 'macos') }}
114+
run: cmake --build ./build-Release --target deployqt
115+
116+
- name: Install Info-zip
117+
if: ${{ startsWith(matrix.os, 'windows') }}
118+
run: |
119+
choco install zip
120+
121+
- name: Make distro
122+
run: |
123+
cd build
124+
node ./distro.mjs
125+
126+
- id: get_os_arch
127+
uses: actions/github-script@v7
128+
with:
129+
result-encoding: string
130+
script: return `${process.env.RUNNER_OS}-${process.arch}`
131+
132+
- name: Upload assets
133+
id: upload-release-asset
134+
uses: actions/upload-release-asset@v1
135+
env:
136+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
137+
archive_name: ${{ needs.release.outputs.name }}-${{ steps.get_os_arch.outputs.result }}-${{ needs.release.outputs.version }}.tpp
138+
with:
139+
upload_url: ${{ needs.release.outputs.upload_url }}
140+
asset_path: ./dist/${{ env.archive_name }}
141+
asset_name: ${{ env.archive_name }}
142+
asset_content_type: application/zip

.github/workflows/test-builds.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Test Builds
2+
on:
3+
workflow_dispatch:
4+
5+
jobs:
6+
build:
7+
name: Build
8+
strategy:
9+
fail-fast: false
10+
matrix:
11+
os: [
12+
windows-latest,
13+
macos-latest,
14+
# macos-13,
15+
ubuntu-latest
16+
]
17+
runs-on: ${{ matrix.os }}
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
22+
- name: Install Qt
23+
uses: jurplel/install-qt-action@v4
24+
with:
25+
version: 6.5.*
26+
tools: ${{ startsWith(matrix.os, 'windows') && 'tools_ninja tools_opensslv3_x64' || 'tools_ninja' }}
27+
# modules: 'qtwebsockets'
28+
29+
- name: Configure MSVC
30+
if: ${{ startsWith(matrix.os, 'windows') }}
31+
uses: ilammy/msvc-dev-cmd@v1
32+
with:
33+
arch: x64
34+
toolset: 14.29
35+
36+
- name: Configure CMake
37+
env:
38+
QTHOME: '${{ env.IQTA_TOOLS }}/..'
39+
run: |
40+
cmake -G "Ninja" -B ./build-Release -S ./src -DCMAKE_PREFIX_PATH:PATH=${QT_ROOT_DIR} -DCMAKE_BUILD_TYPE=Release -DTPClient_BUILD_SHARED_LIBS:BOOL=OFF
41+
42+
- name: Build
43+
run: cmake --build ./build-Release --target DSEP4TP install
44+
45+
- name: Mac extra deploy step
46+
if: ${{ startsWith(matrix.os, 'macos') }}
47+
run: cmake --build ./build-Release --target deployqt
48+
49+
- name: Install zip
50+
if: ${{ startsWith(matrix.os, 'windows') }}
51+
run: |
52+
choco install zip
53+
54+
- name: Make distro
55+
run: |
56+
cd build
57+
node ./distro.mjs

0 commit comments

Comments
 (0)