-
-
Notifications
You must be signed in to change notification settings - Fork 68
154 lines (140 loc) · 5.33 KB
/
Copy pathdocker.yml
File metadata and controls
154 lines (140 loc) · 5.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# Author: Kang Lin <kl222@126.com>
name: docker
on:
workflow_call:
outputs:
name:
description: "The artifact name"
value: ${{ jobs.build_docker.outputs.name }}
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
jobs:
build_docker:
strategy:
matrix:
variant:
- PACKAGE: deb
image: ubuntu
lable: "24.04"
os: ubuntu-24.04
- PACKAGE: appimage
image: ubuntu
lable: "24.04"
os: ubuntu-24.04-arm
- PACKAGE: appimage
image: ubuntu
lable: "26.04"
os: ubuntu-24.04
- PACKAGE: deb
image: ubuntu
lable: "26.04"
os: ubuntu-24.04-arm
- PACKAGE: deb
image: debian
lable: "12"
os: ubuntu-24.04
- PACKAGE: deb
image: debian
lable: "12"
os: ubuntu-24.04-arm
- PACKAGE: deb
image: debian
lable: "13"
os: ubuntu-24.04
- PACKAGE: deb
image: debian
lable: "13"
os: ubuntu-24.04-arm
- PACKAGE: rpm
image: fedora
lable: "43"
os: ubuntu-24.04
- PACKAGE: rpm
image: fedora
lable: "43"
os: ubuntu-24.04-arm
- PACKAGE: rpm
image: fedora
lable: "42"
os: ubuntu-24.04
- PACKAGE: rpm
image: fedora
lable: "42"
os: ubuntu-24.04-arm
- PACKAGE: rpm
image: fedora
lable: "41"
os: ubuntu-24.04
- PACKAGE: rpm
image: fedora
lable: "41"
os: ubuntu-24.04-arm
# See: [About GitHub-hosted runners](https://docs.github.com/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners)
# See: [Choosing the runner for a job](https://docs.github.com/actions/writing-workflows/choosing-where-your-workflow-runs/choosing-the-runner-for-a-job)
# See: https://github.com/actions/runner-images/
runs-on: ${{matrix.variant.os}}
env:
SerialPortAssistant_VERSION: 0.5.34-dev
artifact_name: build_docker
BUILD_DIR: ${{github.workspace}}/build
SOURCE_DIR: ${{github.workspace}}/.cache/source
TOOLS_DIR: ${{github.workspace}}/.cache/tools_${{matrix.variant.os}}
INSTALL_DIR: ${{github.workspace}}/.cache/install_docker_${{matrix.variant.PACKAGE}}_${{matrix.variant.image}}_${{matrix.variant.lable}}_${{matrix.variant.os}}
BUILD_VERBOSE: ${{matrix.variant.BUILD_VERBOSE}}
# Map the job outputs to step outputs
outputs:
name: ${{ env.artifact_name }}
steps:
- name: Checkout Repository
uses: actions/checkout@v6
with:
submodules: true
fetch-depth: 0
- name: Make directories
run: |
cmake -E make_directory ${{env.BUILD_DIR}}
cmake -E make_directory ${{env.SOURCE_DIR}}
cmake -E make_directory ${{env.TOOLS_DIR}}
cmake -E make_directory ${{env.INSTALL_DIR}}
- name: Cache installed
uses: actions/cache@v5
id: cache-installed
with:
path: |
${{env.INSTALL_DIR}}
${{env.TOOLS_DIR}}/linuxdeploy-*
${{env.TOOLS_DIR}}/qt_*
key: install_docker_${{matrix.variant.PACKAGE}}_${{matrix.variant.image}}${{matrix.variant.lable}}_${{matrix.variant.os}}
- name: run docker
run: |
if [ -n "${{matrix.variant.lable}}" ]; then
docker_image="${{matrix.variant.image}}:${{matrix.variant.lable}}"
else
docker_image="${{matrix.variant.image}}"
fi
./Script/build_linux.sh --install=${{env.INSTALL_DIR}} \
--source=${{env.SOURCE_DIR}} \
--tools=${{env.TOOLS_DIR}} \
--docker-image="${docker_image}" --docker-platform="${{matrix.variant.platform}}" --${{matrix.variant.PACKAGE}}
if [ "${{matrix.variant.PACKAGE}}" = "deb" ]; then
echo "Copy deb package ......"
pushd ${{env.BUILD_DIR}}/build_linux/
export ARCH=`dpkg --print-architecture`
cp serialportassistant_*.deb serialportassistant_${{env.SerialPortAssistant_VERSION}}_${{matrix.variant.image}}_${{matrix.variant.lable}}_${ARCH}.deb
popd
fi
if [ "${{matrix.variant.PACKAGE}}" = "appimage" ]; then
echo "Package appimage ......"
pushd ${{env.BUILD_DIR}}/build_linux
mv install SerialPortAssistant_${{env.SerialPortAssistant_VERSION}}_Linux_${ARCH}_Setup
zip SerialPortAssistant_${{env.SerialPortAssistant_VERSION}}_Linux_${ARCH}_Setup.zip SerialPortAssistant_${{env.SerialPortAssistant_VERSION}}_Linux_${ARCH}_Setup/*
fi
- name: Update artifact
if: ${{matrix.variant.PACKAGE == 'rpm'}}
uses: actions/upload-artifact@v4
with:
name: ${{ env.artifact_name }}_${{matrix.variant.PACKAGE}}_${{matrix.variant.image}}_${{matrix.variant.lable}}_${{matrix.variant.os}}
path: |
${{env.BUILD_DIR}}/build_linux/serialportassistant*.rpm
${{env.BUILD_DIR}}/build_linux/serialportassistant*.deb
${{env.BUILD_DIR}}/build_linux/SerialPortAssistant_*.zip