Merge branch 'new/http-buildx' into new/http

This commit is contained in:
DL6ER 2023-06-04 19:29:58 +02:00
commit 8176254fb0
No known key found for this signature in database
GPG Key ID: 00135ACBD90B28DD
3 changed files with 63 additions and 25 deletions

32
.github/Dockerfile vendored Normal file
View File

@ -0,0 +1,32 @@
FROM ghcr.io/pi-hole/ftl-build:ftl-build-buildx AS builder
WORKDIR /app
COPY . /app
ARG CI_ARCH="linux/amd64"
ENV CI_ARCH ${CI_ARCH}
ARG GIT_BRANCH="test"
ENV GIT_BRANCH ${GIT_BRANCH}
ARG GIT_TAG="test"
ENV GIT_TAG ${GIT_TAG}
# Build FTL
# Remove possible old build files
RUN rm -rf cmake && \
# Build FTL
bash build.sh "-DSTATIC=${STATIC}" && \
# Run binary architecture tests
bash test/arch_test.sh && \
# Run full test suite
bash test/run.sh && \
# Move FTL binary to root directory
cd / &&\
mv /app/pihole-FTL . && \
# Create tarball of API docs
tar -C /app/src/api/docs/content/ -czvf /api-docs.tar.gz .
# Create final image containing only the FTL binary and API docs
FROM scratch AS result
COPY --from=builder /pihole-FTL /pihole-FTL
COPY --from=builder /api-docs.tar.gz /api-docs.tar.gz

View File

@ -51,7 +51,6 @@ jobs:
build:
runs-on: ubuntu-latest
needs: smoke-tests
container: ghcr.io/pi-hole/ftl-build:v2.0
strategy:
fail-fast: false
matrix:
@ -61,13 +60,13 @@ jobs:
- platform: linux/386
bin_name: pihole-FTL-386
- platform: linux/arm/v6
bin_name: pi-hole-FTL-armv6
bin_name: pihole-FTL-armv6
- platform: linux/arm/v7
bin_name: pi-hole-FTL-armv7
bin_name: pihole-FTL-armv7
- platform: linux/arm64/v8
bin_name: pi-hole-FTL-arm64
bin_name: pihole-FTL-arm64
- platform: linux/riscv64
bin_name: pi-hole-FTL-riscv64
bin_name: pihole-FTL-riscv64
env:
CI_ARCH: ${{ matrix.platform }}
@ -78,15 +77,15 @@ jobs:
-
name: Checkout code
uses: actions/checkout@v3.5.2
-
name: "Fix ownership of repository"
run: chown -R root .
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v2.5.0
-
name: Build and push
uses: docker/build-push-action@v3
name: Print directory contents
run: ls -l
-
name: Build and test FTL in ftl-build container (QEMU)
uses: docker/build-push-action@v4.0.0
with:
# tags: ghcr.io/pi-hole/ftl-build:v2.0
platforms: ${{ matrix.platform }}
@ -94,36 +93,39 @@ jobs:
pull: true
# Do not push anything
push: false
# Load into daemon for subsequent steps
load: true
context: .
target: result
file: .github/Dockerfile
outputs: |
type=tar,dest=build.tar
build-args: |
"CI_ARCH=${{ matrix.platform }}"
"GIT_BRANCH=${{ needs.smoke-tests.outputs.GIT_BRANCH }}"
"GIT_TAG=${{ needs.smoke-tests.outputs.GIT_TAG }}"
-
name: "Build"
run: |
bash build.sh "-DSTATIC=${STATIC}"
name: List files in current directory
run: ls -l
-
name: "Binary checks"
name: Extract FTL binary from container
run: |
bash test/arch_test.sh
-
name: "Test binaries"
run: |
bash test/run.sh
tar -xf build.tar pihole-FTL
-
name: "Generate checksum file"
run: |
mv pihole-FTL "${{ matrix.bin_name }}"
sha1sum pihole-FTL-* > ${{ matrix.bin_name }}.sha1
-
name: Store binary artifacts for deployoment
name: Store binary artifacts for later deployoment
if: github.event_name != 'pull_request'
uses: actions/upload-artifact@v3.1.2
with:
name: tmp-storage
path: '${{ matrix.bin_name }}*'
-
name: Tar documentation files
name: Extract documentation files from container
if: github.event_name != 'pull_request' && matrix.platform == 'linux/amd64'
run: tar -C src/api/docs/content/ -czvf api-docs.tar.gz .
run: |
tar -xf build.tar api-docs.tar.gz
-
name: Upload documentation artifacts for deployoment
if: github.event_name != 'pull_request' && matrix.platform == 'linux/amd64'

View File

@ -133,5 +133,9 @@ umask "$OLDUMASK"
# Remove copied file
rm /home/pihole/pihole-FTL
# Stop local powerDNS resolver
killall pdns_server
killall pdns_recursor
# Exit with return code of bats tests
exit $RET