Skip to content

Commit b2882b7

Browse files
committed
Updated CI.
1 parent a445321 commit b2882b7

File tree

2 files changed

+28
-24
lines changed

2 files changed

+28
-24
lines changed

.github/workflows/main.yml

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,21 @@ on: push
22

33
env:
44
IMAGE: ${{ secrets.DOCKER_HUB_USERNAME }}/sdr-scanner
5+
PLATFORMS: linux/arm64/v8,linux/amd64
6+
CACHE_FROM: type=registry,ref=${{ secrets.DOCKER_HUB_USERNAME }}/sdr-scanner:cache
7+
CACHE_TO: type=registry,ref=${{ secrets.DOCKER_HUB_USERNAME }}/sdr-scanner:cache,mode=max
58

69
jobs:
710
main:
811
runs-on: ubuntu-latest
912
steps:
1013
- name: Checkout
11-
uses: actions/checkout@v4
12-
- name: Set up docker cache
13-
uses: actions/cache@v3
14-
with:
15-
path: cache
16-
key: docker
14+
uses: actions/checkout@v5
1715
- name: Set up QEMU
1816
uses: docker/setup-qemu-action@v3
17+
with:
18+
cache-image: false
19+
platforms: ${{ env.PLATFORMS }}
1920
- name: Set up Docker Buildx
2021
uses: docker/setup-buildx-action@v3
2122
- name: Login to Docker Hub
@@ -28,51 +29,51 @@ jobs:
2829
echo "constexpr auto GIT_COMMIT = \"${{ github.sha }}\";" > sources/version.h
2930
echo "constexpr auto GIT_TAG = \"${{ github.ref_name }}\";" >> sources/version.h
3031
- name: Build test
31-
uses: docker/build-push-action@v5
32+
uses: docker/build-push-action@v6
3233
with:
3334
context: .
3435
load: true
3536
target: test
3637
tags: ${{ env.IMAGE }}:test
37-
cache-from: type=local,src=cache
38-
cache-to: type=local,dest=cache,mode=max
38+
cache-from: ${{ env.CACHE_FROM }}
39+
cache-to: ${{ env.CACHE_TO }}
3940
- name: Build app
40-
uses: docker/build-push-action@v5
41+
uses: docker/build-push-action@v6
4142
with:
4243
build-args: |
4344
VERSION=${{ github.ref_name }}
4445
COMMIT=${{ github.sha }}
4546
context: .
46-
cache-from: type=local,src=cache
47-
cache-to: type=local,dest=cache,mode=max
47+
cache-from: ${{ env.CACHE_FROM }}
48+
cache-to: ${{ env.CACHE_TO }}
4849
- name: Run test
4950
run: |
5051
docker run --rm ${{ env.IMAGE }}:test
5152
- name: Push development version
5253
if: ${{ github.ref_type == 'branch' && contains(vars.CI_BRANCH, github.ref_name) }}
53-
uses: docker/build-push-action@v5
54+
uses: docker/build-push-action@v6
5455
with:
5556
build-args: |
5657
VERSION=${{ github.ref_name }}
5758
COMMIT=${{ github.sha }}
5859
context: .
5960
push: true
60-
platforms: linux/arm64/v8,linux/amd64
61+
platforms: ${{ env.PLATFORMS }}
6162
tags: ${{ env.IMAGE }}:${{ github.ref_name }}
62-
cache-from: type=local,src=cache
63-
cache-to: type=local,dest=cache,mode=max
63+
cache-from: ${{ env.CACHE_FROM }}
64+
cache-to: ${{ env.CACHE_TO }}
6465
- name: Push release version
6566
if: ${{ github.ref_type == 'tag' }}
66-
uses: docker/build-push-action@v5
67+
uses: docker/build-push-action@v6
6768
with:
6869
build-args: |
6970
VERSION=${{ github.ref_name }}
7071
COMMIT=${{ github.sha }}
7172
context: .
7273
push: true
73-
platforms: linux/arm64/v8,linux/amd64
74+
platforms: ${{ env.PLATFORMS }}
7475
tags: |
7576
${{ env.IMAGE }}:latest
7677
${{ env.IMAGE }}:${{ github.ref_name }}
77-
cache-from: type=local,src=cache
78-
cache-to: type=local,dest=cache,mode=max
78+
cache-from: ${{ env.CACHE_FROM }}
79+
cache-to: ${{ env.CACHE_TO }}

Dockerfile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ RUN chmod +x ./SDRplay_RSP_API-Linux-3.15.2.run && \
1616
ldconfig
1717

1818
WORKDIR /soapy_sdrplay
19-
RUN git clone --branch soapy-sdrplay3-0.5.2 https://github.com/pothosware/SoapySDRPlay3.git /soapy_sdrplay && \
20-
cmake -B build -DCMAKE_BUILD_TYPE=Release . && \
19+
RUN --mount=type=cache,target=/root/.cache/ccache,id=ccache \
20+
git clone --branch soapy-sdrplay3-0.5.2 https://github.com/pothosware/SoapySDRPlay3.git /soapy_sdrplay && \
21+
cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache . && \
2122
cmake --build build -j$(nproc) && \
2223
cmake --install build
2324

@@ -27,13 +28,15 @@ COPY tests tests
2728
COPY sources sources
2829

2930
FROM build AS build_release
30-
RUN cmake -B /root/auto-sdr/build -DCMAKE_BUILD_TYPE=Release /root/auto-sdr && \
31+
RUN --mount=type=cache,target=/root/.cache/ccache,id=ccache \
32+
cmake -B /root/auto-sdr/build -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache /root/auto-sdr && \
3133
cmake --build /root/auto-sdr/build -j$(nproc) && \
3234
strip /root/auto-sdr/build/auto_sdr && \
3335
strip /root/auto-sdr/build/auto_sdr_test
3436

3537
FROM build AS build_debug
36-
RUN cmake -B /root/auto-sdr/build -DCMAKE_BUILD_TYPE=Debug /root/auto-sdr && \
38+
RUN --mount=type=cache,target=/root/.cache/ccache,id=ccache \
39+
cmake -B /root/auto-sdr/build -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache /root/auto-sdr && \
3740
cmake --build /root/auto-sdr/build -j$(nproc)
3841

3942
FROM ubuntu:24.04 AS run

0 commit comments

Comments
 (0)