Skip to content

Commit

Permalink
Moved from Docker Hub to GitHub Container Registry for Docker compila…
Browse files Browse the repository at this point in the history
…tions
  • Loading branch information
Paulchen-Panther committed Sep 6, 2020
1 parent 8b2ebf3 commit 50e9084
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 68 deletions.
15 changes: 8 additions & 7 deletions .azure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@ jobs:
vmImage: 'ubuntu-16.04'
strategy:
matrix:
AMD64 (x64):
dockerTag: 'amd64'
dockerName: 'Debian Stretch (AMD64)'
x86_64:
dockerImage: 'x86_64'
dockerName: 'Debian Stretch (x86_64)'
platform: 'x11'
ARMv6hf (Raspberry Pi v1 & ZERO):
dockerTag: 'armv6hf'
dockerImage: 'armv6l'
dockerName: 'Debian Stretch (Raspberry Pi v1 & ZERO)'
platform: 'rpi'
ARMv7hf (Raspberry Pi 2 & 3):
dockerTag: 'armv7hf'
dockerImage: 'armv7l'
dockerName: 'Debian Stretch (Raspberry Pi 2 & 3)'
platform: 'rpi'
ARMv8 (Generic AARCH64):
dockerTag: 'aarch64'
dockerImage: 'aarch64'
dockerName: 'ARMv8 (Generic AARCH64)'
platform: 'amlogic'

Expand All @@ -35,7 +35,8 @@ jobs:
- bash: ./.ci/ci_build.sh
displayName: 'Build $(dockerName) packages'
env:
DOCKER_TAG: $(dockerTag)
DOCKER_IMAGE: $(dockerImage)
DOCKER_TAG: stretch
DOCKER_NAME: $(dockerName)
PLATFORM: $(platform)

Expand Down
6 changes: 4 additions & 2 deletions .ci/ci_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,17 @@ elif [[ $CI_NAME == *"mingw64_nt"* || "$CI_NAME" == 'windows_nt' ]]; then
exit 0;
exit 1 || { echo "---> Hyperion compilation failed! Abort"; exit 5; }
elif [[ "$CI_NAME" == 'linux' ]]; then
echo "Compile Hyperion with DOCKER_TAG = ${DOCKER_TAG} and friendly name DOCKER_NAME = ${DOCKER_NAME}"
echo "Compile Hyperion with DOCKER_IMAGE = ${DOCKER_IMAGE}, DOCKER_TAG = ${DOCKER_TAG} and friendly name DOCKER_NAME = ${DOCKER_NAME}"
# set GitHub Container Registry url
REGISTRY_URL="ghcr.io/hyperion-project/${DOCKER_IMAGE}"
# take ownership of deploy dir
mkdir ${CI_BUILD_DIR}/deploy

# run docker
docker run --rm \
-v "${CI_BUILD_DIR}/deploy:/deploy" \
-v "${CI_BUILD_DIR}:/source:ro" \
hyperionproject/hyperion-ci:$DOCKER_TAG \
$REGISTRY_URL:$DOCKER_TAG \
/bin/bash -c "mkdir hyperion && cp -r source/. /hyperion &&
cd /hyperion && mkdir build && cd build &&
cmake -DPLATFORM=${PLATFORM} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ../ || exit 2 &&
Expand Down
8 changes: 0 additions & 8 deletions .ci/ci_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,4 @@ if [[ $CI_NAME == 'osx' || $CI_NAME == 'darwin' ]]; then
brew update
dependencies=("qt5" "python" "libusb" "cmake" "doxygen")
installAndUpgrade "${dependencies[@]}"
# github actions uname -> windows-2019 -> mingw64_nt-10.0-17763
# TODO: Azure uname windows?
elif [[ $CI_NAME == *"mingw64_nt"* ]]; then
echo "Yes, we are Windows: $CI_NAME"
# Windows has no dependency manager
elif [[ $CI_NAME != 'linux' ]]; then
echo "Unsupported platform: $CI_NAME"
exit 5
fi
27 changes: 14 additions & 13 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
dockerTag: [ amd64, armv6hf, armv7hf, aarch64 ]
dockerImage: [ x86_64, armv6l, armv7l, aarch64 ]
include:
- dockerTag: amd64
dockerName: Debian Stretch (AMD64)
- dockerImage: x86_64
dockerName: Debian Stretch (x86_64)
platform: x11
- dockerTag: armv6hf
- dockerImage: armv6l
dockerName: Debian Stretch (Raspberry Pi v1 & ZERO)
platform: rpi
- dockerTag: armv7hf
- dockerImage: armv7l
dockerName: Debian Stretch (Raspberry Pi 2 & 3)
platform: rpi
- dockerTag: aarch64
- dockerImage: aarch64
dockerName: Debian Stretch (Generic AARCH64)
platform: amlogic

Expand All @@ -46,7 +46,8 @@ jobs:
# Build packages
- name: Build packages
env:
DOCKER_TAG: ${{ matrix.dockerTag }}
DOCKER_IMAGE: ${{ matrix.dockerImage }}
DOCKER_TAG: stretch
DOCKER_NAME: ${{ matrix.dockerName }}
PLATFORM: ${{ matrix.platform }}
shell: bash
Expand All @@ -56,17 +57,17 @@ jobs:
- name: Collecting deployable artifacts
shell: bash
run: |
mkdir -p ${{ matrix.dockerTag }}
mv deploy/*.tar.gz ${{ matrix.dockerTag }}
if: matrix.dockerTag != 'aarch64'
mkdir -p ${{ matrix.dockerImage }}
mv deploy/*.tar.gz ${{ matrix.dockerImage }}
if: matrix.dockerImage != 'aarch64'

# Upload artifacts
- name: Upload artifacts
uses: actions/upload-artifact@v1
with:
name: ${{ matrix.dockerTag }}
path: ${{ matrix.dockerTag }}
if: matrix.dockerTag != 'aarch64'
name: ${{ matrix.dockerImage }}
path: ${{ matrix.dockerImage }}
if: matrix.dockerImage != 'aarch64'

######################
###### macOS #########
Expand Down
15 changes: 8 additions & 7 deletions .github/workflows/push-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
dockerTag: [ amd64, armv6hf, armv7hf, aarch64 ]
dockerImage: [ x86_64, armv6l, armv7l, aarch64 ]
include:
- dockerTag: amd64
dockerName: Debian Stretch (AMD64)
- dockerImage: x86_64
dockerName: Debian Stretch (x86_64)
platform: x11
- dockerTag: armv6hf
- dockerImage: armv6l
dockerName: Debian Stretch (Raspberry Pi v1 & ZERO)
platform: rpi
- dockerTag: armv7hf
- dockerImage: armv7l
dockerName: Debian Stretch (Raspberry Pi 2 & 3)
platform: rpi
- dockerTag: aarch64
- dockerImage: aarch64
dockerName: Debian Stretch (Generic AARCH64)
platform: amlogic

Expand All @@ -41,7 +41,8 @@ jobs:
# build process
- name: Build packages
env:
DOCKER_TAG: ${{ matrix.dockerTag }}
DOCKER_IMAGE: ${{ matrix.dockerImage }}
DOCKER_TAG: stretch
DOCKER_NAME: ${{ matrix.dockerName }}
PLATFORM: ${{ matrix.platform }}
shell: bash
Expand Down
36 changes: 18 additions & 18 deletions CompileHowto.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,44 +2,44 @@
If you are using [Docker](https://www.docker.com/), you can compile Hyperion inside a docker container. This keeps your system clean and with a simple script it's easy to use. Supported is also cross compiling for Raspberry Pi (Debian Stretch or higher). To compile Hyperion just execute one of the following commands.

The compiled binaries and packages will be available at the deploy folder next to the script.<br/>
Note: call the script with `./docker-compile.sh -h` for more options
Note: call the script with `./docker-compile.sh -h` for more options.

## Native compiling on Raspberry Pi
## Native compilation on Raspberry Pi for:

**Raspbian Stretch**
```
wget -qN https://raw.github.com/hyperion-project/hyperion.ng/master/bin/scripts/docker-compile.sh && chmod +x *.sh && ./docker-compile.sh -t rpi-raspbian-stretch
wget -qN https://raw.github.com/hyperion-project/hyperion.ng/master/bin/scripts/docker-compile.sh && chmod +x *.sh && ./docker-compile.sh -i rpi-raspbian
```
**Raspbian Buster**
```
wget -qN https://raw.github.com/hyperion-project/hyperion.ng/master/bin/scripts/docker-compile.sh && chmod +x *.sh && ./docker-compile.sh -t rpi-raspbian-buster
wget -qN https://raw.github.com/hyperion-project/hyperion.ng/master/bin/scripts/docker-compile.sh && chmod +x *.sh && ./docker-compile.sh -i rpi-raspbian -t buster
```

## Cross compiling on X64_86 for:
## Cross compilation on x86_64 for:

**X64:**
**x86_64 (Debian Stretch):**
```
wget -qN https://raw.github.com/hyperion-project/hyperion.ng/master/bin/scripts/docker-compile.sh && chmod +x *.sh && ./docker-compile.sh
wget -qN https://raw.github.com/hyperion-project/hyperion.ng/master/bin/scripts/docker-compile.sh && chmod +x *.sh && ./docker-compile.sh -i x86_64
```
**i386:**
**x86_64 (Debian Buster):**
```
wget -qN https://raw.github.com/hyperion-project/hyperion.ng/master/bin/scripts/docker-compile.sh && chmod +x *.sh && ./docker-compile.sh -t i386
wget -qN https://raw.github.com/hyperion-project/hyperion.ng/master/bin/scripts/docker-compile.sh && chmod +x *.sh && ./docker-compile.sh -i x86_64 -t buster
```
**Raspberry Pi v1 & ZERO (Raspbian Stretch)**
**Raspberry Pi v1 & ZERO (Debian Stretch)**
```
wget -qN https://raw.github.com/hyperion-project/hyperion.ng/master/bin/scripts/docker-compile.sh && chmod +x *.sh && ./docker-compile.sh -t armv6hf
wget -qN https://raw.github.com/hyperion-project/hyperion.ng/master/bin/scripts/docker-compile.sh && chmod +x *.sh && ./docker-compile.sh -i armv6l
```
**Raspberry Pi 2 & 3 (Raspbian Stretch)**
**Raspberry Pi v1 & ZERO (Debian Buster)**
```
wget -qN https://raw.github.com/hyperion-project/hyperion.ng/master/bin/scripts/docker-compile.sh && chmod +x *.sh && ./docker-compile.sh -t armv7hf
wget -qN https://raw.github.com/hyperion-project/hyperion.ng/master/bin/scripts/docker-compile.sh && chmod +x *.sh && ./docker-compile.sh -i armv6l -t buster
```
**Raspberry Pi v1 & ZERO (Raspbian Buster)**
**Raspberry Pi 2/3/4 (Debian Stretch)**
```
wget -qN https://raw.github.com/hyperion-project/hyperion.ng/master/bin/scripts/docker-compile.sh && chmod +x *.sh && ./docker-compile.sh -t armv6hf-buster
wget -qN https://raw.github.com/hyperion-project/hyperion.ng/master/bin/scripts/docker-compile.sh && chmod +x *.sh && ./docker-compile.sh -i armv7l
```
**Raspberry Pi 2 & 3 (Raspbian Buster**
**Raspberry Pi 2/3/4 (Debian Buster)**
```
wget -qN https://raw.github.com/hyperion-project/hyperion.ng/master/bin/scripts/docker-compile.sh && chmod +x *.sh && ./docker-compile.sh -t armv7hf-buster
wget -qN https://raw.github.com/hyperion-project/hyperion.ng/master/bin/scripts/docker-compile.sh && chmod +x *.sh && ./docker-compile.sh -i armv7l -t buster
```

# The usual way
Expand Down Expand Up @@ -114,7 +114,7 @@ mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j $(nproc)
if this get stucked and dmseg says out of memory try:
if this get stucked and dmesg says out of memory try:
make -j 2
# optional: install into your system
sudo make install/strip
Expand Down
33 changes: 20 additions & 13 deletions bin/scripts/docker-compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@
DOCKER="docker"
# Git repo url of Hyperion
GIT_REPO_URL="https://github.com/hyperion-project/hyperion.ng.git"
# GitHub Container Registry url
REGISTRY_URL="ghcr.io/hyperion-project"
# cmake build type
BUILD_TYPE="Release"
# the image tag at hyperionproject/hyperion-ci
BUILD_TARGET="amd64"
# the docker image at GitHub Container Registry
BUILD_IMAGE="x86_64"
# the docker tag at GitHub Container Registry
BUILD_TAG="stretch"
# build packages (.deb .zip ...)
BUILD_PACKAGES=true
# packages string inserted to cmake cmd
Expand Down Expand Up @@ -42,26 +46,28 @@ function printHelp {
echo "########################################################
## A script to compile Hyperion inside a docker container
## Requires installed Docker: https://www.docker.com/
## Without arguments it will compile Hyperion for Debain Stretch (x64) or higher.
## Supports Raspberry Pi (armv6hf, armv7hf) cross compilation (Debian Stretch/Buster) and native compilation (Raspbian Stretch/Buster)
## Without arguments it will compile Hyperion for Debian Stretch (x86_64).
## Supports Raspberry Pi (armv6l, armv7l) cross compilation (Debian Stretch/Buster) and native compilation (Raspbian Stretch/Buster)
##
## Homepage: https://www.hyperion-project.org
## Forum: https://forum.hyperion-project.org
########################################################
# These are possible arguments to modify the script behaviour with their default values
#
# docker-compile.sh -h # Show this help message
# docker-compile.sh -t amd64 # The docker tag, one of amd64 | i386 | armv6hf | armv7hf | armv6hf-buster | armv7hf-buster | rpi-raspbian-stretch | rpi-raspbian-buster
# docker-compile.sh -i x86_64 # The docker image, one of x86_64 | armv6l | armv7l | rpi-raspbian
# docker-compile.sh -t stretch # The docker tag, stretch or buster
# docker-compile.sh -b Release # cmake Release or Debug build
# docker-compile.sh -p true # If true build packages with CPack
# More informations to docker tags at: https://hub.docker.com/r/hyperionproject/hyperion-ci/"
# More informations to docker tags at: https://github.com/Hyperion-Project/hyperion.docker-ci"
}

while getopts t:b:p:h option
while getopts i:t:b:p:h option
do
case "${option}"
in
t) BUILD_TARGET=${OPTARG};;
i) BUILD_IMAGE=${OPTARG};;
t) BUILD_TAG=${OPTARG};;
b) BUILD_TYPE=${OPTARG};;
p) BUILD_PACKAGES=${OPTARG};;
h) printHelp; exit 0;;
Expand All @@ -73,7 +79,7 @@ if [ $BUILD_PACKAGES == "true" ]; then
PACKAGES="package"
fi

echo "---> Initialize with BUILD_TARGET=${BUILD_TARGET}, BUILD_TYPE=${BUILD_TYPE}, BUILD_PACKAGES=${BUILD_PACKAGES}"
echo "---> Initialize with IMAGE:TAG=${BUILD_IMAGE}:${BUILD_TAG}, BUILD_TYPE=${BUILD_TYPE}, BUILD_PACKAGES=${BUILD_PACKAGES}"

# cleanup deploy folder, create folder for ownership
sudo rm -fr $SCRIPT_PATH/deploy >/dev/null 2>&1
Expand All @@ -84,18 +90,19 @@ echo "---> Downloading Hyperion source code from ${GIT_REPO_URL}"
sudo rm -fr $SCRIPT_PATH/hyperion >/dev/null 2>&1
git clone --recursive --depth 1 -q $GIT_REPO_URL $SCRIPT_PATH/hyperion || { echo "---> Failed to download Hyperion source code! Abort"; exit 1; }

# start compilation
# Steps:
# Update lokal docker image
# Remove container after stop
# Mount /deploy to /deploy
# Mount source dir to /source
# Target docker image
# Use target docker image
# execute inside container all commands on bash

echo "---> Startup docker..."
$DOCKER pull hyperionproject/hyperion-ci:$BUILD_TARGET
$DOCKER run --rm \
-v "${SCRIPT_PATH}/deploy:/deploy" \
-v "${SCRIPT_PATH}/hyperion:/source:ro" \
hyperionproject/hyperion-ci:$BUILD_TARGET \
$REGISTRY_URL/$BUILD_IMAGE:$BUILD_TAG \
/bin/bash -c "mkdir hyperion && cp -r /source/. /hyperion &&
cd /hyperion && mkdir build && cd build &&
cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE} .. || exit 2 &&
Expand Down

0 comments on commit 50e9084

Please sign in to comment.