]>
Commit | Line | Data |
---|---|---|
3161d66b | 1 | --- |
8ab49f77 VB |
2 | name: CI |
3 | on: | |
4 | push: | |
3161d66b VB |
5 | branches: |
6 | - master | |
7 | tags: | |
8 | - 1.* | |
8ab49f77 VB |
9 | pull_request: |
10 | schedule: | |
11 | - cron: 0 7 1 * * | |
12 | jobs: | |
e47df85e VB |
13 | build-linux: |
14 | runs-on: ubuntu-latest | |
8ab49f77 VB |
15 | strategy: |
16 | matrix: | |
8ab49f77 VB |
17 | config-args: |
18 | - "--with-embedded-libevent" | |
19 | - "--disable-shared --enable-static" | |
20 | - "--disable-privsep --with-snmp" | |
21 | - "--with-snmp --disable-lldpmed --disable-dot1 --disable-dot3 --disable-custom" | |
22 | - "--enable-oldies" | |
23 | - "--enable-dtrace" | |
24 | - "--with-seccomp" | |
25 | compiler: | |
26 | - gcc | |
27 | release: | |
28 | - false | |
29 | include: | |
e47df85e | 30 | - config-args: '' |
8ab49f77 | 31 | release: true |
e47df85e | 32 | - compiler: clang |
1ca42cab | 33 | config-args: "--without-snmp --with-xml" |
8ab49f77 | 34 | steps: |
e8e5d15e | 35 | - uses: actions/checkout@v4 |
8ab49f77 VB |
36 | with: |
37 | submodules: true | |
cd5c1a6e | 38 | - name: Unshallow repository |
b341c404 | 39 | if: matrix.release |
cd5c1a6e VB |
40 | run: | |
41 | git fetch --tags | |
42 | git fetch --unshallow | |
8ab49f77 VB |
43 | - name: Install stuff |
44 | run: ./tests/ci/install.sh | |
45 | - name: Build and run tests | |
46 | run: ./tests/ci/run.sh | |
47 | env: | |
48 | LLDPD_CONFIG_ARGS: ${{ matrix.config-args }} | |
b64391c6 | 49 | LLDPD_RELEASE: ${{ matrix.release }} |
8ab49f77 | 50 | CC: ${{ matrix.compiler }} |
5e62e262 | 51 | - name: Generate release body |
e47df85e | 52 | if: matrix.release |
b373cd61 | 53 | run: ./tests/ci/release.sh build > ./release.md |
8ab49f77 | 54 | - name: Upload release tarball |
79c42d4a | 55 | uses: actions/upload-artifact@v4 |
e47df85e | 56 | if: matrix.release |
8ab49f77 VB |
57 | with: |
58 | name: tarball | |
518eb927 | 59 | path: build/lldpd-*.tar.gz |
8ab49f77 | 60 | if-no-files-found: error |
e47df85e | 61 | - name: Upload release summary |
79c42d4a | 62 | uses: actions/upload-artifact@v4 |
e47df85e VB |
63 | if: matrix.release |
64 | with: | |
65 | name: release | |
66 | path: release.md | |
67 | if-no-files-found: error | |
68 | ||
69 | build-macos: | |
70 | runs-on: macos-latest | |
71 | strategy: | |
72 | matrix: | |
73 | include: | |
e6afe118 | 74 | - config-args: "--without-snmp --with-xml" |
e47df85e VB |
75 | release: false |
76 | - config-args: > | |
77 | --prefix=/usr/local | |
78 | --localstatedir=/var | |
79 | --sysconfdir=/private/etc | |
80 | --with-embedded-libevent | |
81 | --without-snmp | |
82 | --without-xml | |
83 | release: true | |
84 | steps: | |
e8e5d15e | 85 | - uses: actions/checkout@v4 |
e47df85e VB |
86 | with: |
87 | submodules: true | |
88 | - name: Install stuff | |
89 | run: ./tests/ci/install.sh | |
90 | - name: Build and run tests | |
91 | run: ./tests/ci/run.sh | |
92 | env: | |
93 | LLDPD_CONFIG_ARGS: ${{ matrix.config-args }} | |
94 | CC: clang | |
8ab49f77 | 95 | - name: Upload MacOS release package |
79c42d4a | 96 | uses: actions/upload-artifact@v4 |
e47df85e | 97 | if: matrix.release |
8ab49f77 VB |
98 | with: |
99 | name: package | |
518eb927 | 100 | path: build/lldpd-*.pkg |
8ab49f77 | 101 | if-no-files-found: error |
e47df85e VB |
102 | |
103 | build-bsd: | |
104 | timeout-minutes: 20 | |
105 | strategy: | |
106 | fail-fast: false | |
107 | matrix: | |
108 | os: | |
109 | - name: freebsd | |
0fa2c9ac VB |
110 | version: '13.2' |
111 | runner: macos-latest | |
112 | hypervisor: qemu | |
113 | - name: netbsd | |
114 | version: '9.3' | |
870702b0 | 115 | runner: macos-latest |
727fd19f | 116 | hypervisor: qemu |
e47df85e | 117 | - name: openbsd |
0fa2c9ac | 118 | version: '7.4' |
870702b0 | 119 | runner: macos-latest |
727fd19f | 120 | hypervisor: xhyve |
e47df85e VB |
121 | runs-on: ${{ matrix.os.runner }} |
122 | steps: | |
e8e5d15e | 123 | - uses: actions/checkout@v4 |
5e62e262 | 124 | with: |
e47df85e VB |
125 | submodules: true |
126 | - name: Test on ${{ matrix.os.name }} | |
35eeac67 | 127 | uses: cross-platform-actions/action@v0.22.0 |
e47df85e VB |
128 | with: |
129 | operating_system: ${{ matrix.os.name }} | |
130 | version: ${{ matrix.os.version }} | |
727fd19f | 131 | hypervisor: ${{ matrix.os.hypervisor }} |
e47df85e VB |
132 | environment_variables: LLDPD_CONFIG_ARGS |
133 | shell: bash | |
134 | run: | | |
135 | set -e | |
136 | ./tests/ci/install.sh | |
137 | ./tests/ci/run.sh | |
5e62e262 | 138 | |
a244ecfb | 139 | docker: |
e47df85e VB |
140 | needs: |
141 | - build-linux | |
142 | - build-macos | |
143 | - build-bsd | |
a244ecfb VB |
144 | runs-on: ubuntu-latest |
145 | name: Build Docker images | |
146 | if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') | |
147 | steps: | |
e8e5d15e | 148 | - uses: actions/checkout@v4 |
192caf1e | 149 | - uses: docker/setup-qemu-action@v3 |
75c23e7f | 150 | - uses: docker/setup-buildx-action@v3 |
a59512cb | 151 | - uses: docker/metadata-action@v5 |
a244ecfb VB |
152 | id: meta |
153 | with: | |
154 | images: | | |
155 | ghcr.io/lldpd/lldpd | |
156 | tags: | | |
157 | type=schedule,pattern=master | |
158 | type=ref,event=branch | |
159 | type=semver,pattern={{version}} | |
160 | type=semver,pattern={{major}}.{{minor}} | |
161 | type=semver,pattern={{major}} | |
fa7c0784 | 162 | - uses: docker/login-action@v3 |
a244ecfb VB |
163 | with: |
164 | registry: ghcr.io | |
165 | username: ${{ github.repository_owner }} | |
166 | password: ${{ secrets.GITHUB_TOKEN }} | |
edcf7bdf | 167 | - uses: docker/build-push-action@v5 |
a244ecfb VB |
168 | with: |
169 | context: . | |
170 | file: Dockerfile | |
dad4ed45 | 171 | platforms: ${{ startsWith(github.ref, 'refs/tags/') && 'linux/amd64,linux/arm64,linux/arm/v6' || 'linux/amd64' }} |
a244ecfb VB |
172 | push: true |
173 | tags: ${{ steps.meta.outputs.tags }} | |
174 | labels: ${{ steps.meta.outputs.labels }} | |
5e62e262 VB |
175 | |
176 | release: | |
e47df85e | 177 | needs: |
dad4ed45 | 178 | - docker |
5e62e262 VB |
179 | runs-on: ubuntu-latest |
180 | name: Publish release | |
181 | if: startsWith(github.ref, 'refs/tags/') | |
abfb5c13 | 182 | steps: |
5e62e262 | 183 | - name: Download TGZ tarball |
fcc87c77 | 184 | uses: actions/download-artifact@v3 |
5e62e262 VB |
185 | with: |
186 | name: tarball | |
187 | - name: Download MacOS package | |
fcc87c77 | 188 | uses: actions/download-artifact@v3 |
5e62e262 VB |
189 | with: |
190 | name: package | |
191 | - name: Download release text | |
fcc87c77 | 192 | uses: actions/download-artifact@v3 |
5e62e262 VB |
193 | with: |
194 | name: release | |
195 | - name: Publish release | |
196 | uses: softprops/action-gh-release@v1 | |
197 | with: | |
198 | body_path: release.md | |
a818d643 | 199 | draft: true |
5e62e262 VB |
200 | files: | |
201 | *.tar.gz | |
202 | *.pkg | |
203 | env: | |
204 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |