diff --git a/.github/workflows/generate-release.yaml b/.github/workflows/generate-release.yaml new file mode 100644 index 0000000000..7352a87f31 --- /dev/null +++ b/.github/workflows/generate-release.yaml @@ -0,0 +1,65 @@ +name: Generate Release +on: + push: + branches: + - master + schedule: + - cron: "0 0 * * *" + +env: + REPO: nugu-linux + REPOSLUG: nugu-developers/nugu-linux + +jobs: + release: + runs-on: ubuntu-latest + steps: + - name: Get last commit from nugu-developers/nugu-linux + env: + GITHUB_EVENT: ${{ toJson(github.event) }} + run: | + LAST_COMMIT=$(curl -s -H "Authorization: token ${{ secrets.GH_TOKEN }}" -X GET https://api.github.com/repos/${REPOSLUG}/commits/master) + SHA=$(echo $LAST_COMMIT | jq '.sha' -r) + SHORTSHA=$(echo $SHA | cut -c -7) + MSG=$(echo $LAST_COMMIT | jq '.commit.message' -r) + + TZ=UTC date + TZ=Asia/Seoul date + echo "event = $GITHUB_EVENT" + echo "event_name = ${{ github.event_name }}" + + echo "SHA=$SHA" + echo "SHORTSHA=$SHORTSHA" + echo "MSG=$MSG" + echo "sha=$SHA" >> $GITHUB_ENV + echo "shortsha=$SHORTSHA" >> $GITHUB_ENV + echo "body<> $GITHUB_ENV + echo "$MSG" >> $GITHUB_ENV + echo "EOF" >> $GITHUB_ENV + + - name: Check existing release for ${{ env.shortsha }} + run: | + echo "SHA=${{ env.sha }}" + ID=$(curl -s -H "Authorization: token ${{ secrets.GH_TOKEN }}" -X GET https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/tags/${{ env.shortsha }} | jq '.id' -r) + echo "> Release ID = ${ID}" + if [[ ${ID} != "null" ]]; then + echo "Release ${ID} is already exist" + echo "exist=1" >> $GITHUB_ENV + else + echo "Release ${ID} is not exist." + echo "exist=0" >> $GITHUB_ENV + fi + + - name: Done + if: ${{ env.exist == '1'}} + run: echo "Done" + + - name: Generate new release + if: ${{ env.exist == '0'}} + run: | + jq -n --arg body "${{ env.body }}" \ + --arg tag_name "${{ env.shortsha }}" \ + --arg name "${{ env.shortsha }}" \ + '{ "tag_name": $tag_name, "name": $name, "body": $body }' | curl -D - \ + -H "Authorization: token ${{ secrets.GH_TOKEN }}" \ + -X POST https://api.github.com/repos/${GITHUB_REPOSITORY}/releases -d@- diff --git a/.github/workflows/release-CHANGES.yaml b/.github/workflows/release-CHANGES.yaml new file mode 100644 index 0000000000..9d474332f0 --- /dev/null +++ b/.github/workflows/release-CHANGES.yaml @@ -0,0 +1,35 @@ +name: Build CHANGES.txt +on: + release: + types: + - created + +env: + REPO: nugu-linux + REPOSLUG: nugu-developers/nugu-linux + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Generate CHANGES.txt + run: | + # Remove "refs/tags/" from "refs/tags/xxxxxxx" + SHORTSHA=$(echo ${GITHUB_REF} | cut -c11-) + + git clone https://github.com/${REPOSLUG} + touch CHANGES.txt + cd ${REPO} + git checkout ${SHORTSHA} + git reset --hard + git log $(git describe --tags --abbrev=0)..HEAD --oneline > ../CHANGES.txt + cd .. + cat CHANGES.txt + + - name: Upload + uses: svenstaro/upload-release-action@v2 + with: + file: CHANGES.txt + repo_token: ${{ secrets.GH_TOKEN }} + overwrite: true + tag: ${{ github.ref }} diff --git a/.github/workflows/release-agl.yaml b/.github/workflows/release-agl.yaml new file mode 100644 index 0000000000..9dbed48cf1 --- /dev/null +++ b/.github/workflows/release-agl.yaml @@ -0,0 +1,152 @@ +name: Build AGL +on: + release: + types: + - created + workflow_dispatch: + inputs: + hash: + description: 'SDK Commit' + required: true + default: '' + comment: + description: 'Comment' + required: false + default: '' + +env: + REPO: nugu-linux + REPOSLUG: nugu-developers/nugu-linux + +# +# Jobs +# -> build (matrix) +# - Generate .tgz +# - Upload to Github release +# + +jobs: + build: + runs-on: ubuntu-latest + strategy: + fail-fast: true + matrix: + target: [ koi_rpi4, koi_x64 ] + steps: + - name: Get SHA and ID from Release ${{ github.ref }} + run: | + if [ -z "${{ github.event.inputs.hash }}" ]; then + # Remove "refs/tags/" from "refs/tags/xxxxxxx" + SHORTSHA=$(echo ${GITHUB_REF} | cut -c11-) + else + SHORTSHA=${{ github.event.inputs.hash }} + fi + echo "SHA: $SHORTSHA" + + # Get ID for Release-tag + ID=$(curl -s -H "Authorization: token ${{ secrets.GH_TOKEN }}" -X GET https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/tags/${SHORTSHA} | jq '.id' -r) + echo "> Release ID = ${ID}" + if [[ ${ID} == "null" ]]; then + echo "Release ${ID} not exist." + exit + fi + echo "Release-ID: $ID" + + echo "id=$ID" >> $GITHUB_ENV + echo "sha=$SHORTSHA" >> $GITHUB_ENV + + - name: Check for duplicated files + run: | + COUNT=0 + MATCH_COUNT=1 + RESULT=$(curl -s -H "Authorization: token ${{ secrets.GH_TOKEN }}" -X GET https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/${{ env.id }}/assets?per_page=80) + FILES=$(echo $RESULT | jq '.[].name' -r) + + for item in $FILES + do + echo "Check artifacts - $item" + + if [[ $item == *"agl"* ]]; then + : + else + continue; + fi + + declare -i COUNT; COUNT+=1 + echo "> Found build artifacts: [${COUNT}/${MATCH_COUNT}] ${item}" + done + + # Mark to flag file to trigger the build + if [[ $COUNT == $MATCH_COUNT ]]; then + echo "> There is no need to rebuild." + echo "exist=1" >> $GITHUB_ENV + else + echo "> Rebuild required" + echo "exist=0" >> $GITHUB_ENV + fi + + - name: The build artifact already exists, so the build is skipped. + if: ${{ env.exist == '1'}} + run: echo "Done" + + - name: Prepare SDK source + if: ${{ env.exist == '0'}} + run: | + git clone https://github.com/${REPOSLUG} --recursive + cd ${REPO} + git checkout ${{ env.sha }} + git reset --hard + rm -rf .git + + # Fix permissions for docker + chmod 777 $PWD + + ls -l + + - name: Prepare AGL Docker image + if: ${{ env.exist == '0'}} + run: docker pull ghcr.io/webispy/agl:${{ matrix.target }} + + - name: Build + if: ${{ env.exist == '0'}} + run: | + cd ${REPO} + + cat < sdkbuild.sh + #!/bin/bash + set -e + + source /opt/agl-sdk/11.0.*/environment-setup-* + + rm -rf build + mkdir build + cd build + cmake .. -DENABLE_BUILTIN_OPUS=ON \ + -DENABLE_PORTAUDIO_PLUGIN=OFF \ + -DENABLE_ASAN=OFF \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DCMAKE_TOOLCHAIN_FILE=/opt/toolchain/Toolchain.cmake + make -j6 + + mkdir SDK + DESTDIR=SDK make install + tar cvfz files_agl_${{ matrix.target }}_${{ env.sha }}.tgz SDK + EOF + + chmod 755 sdkbuild.sh + + echo "> Build cross-compile" + docker run -t --rm -v $PWD:$PWD -w $PWD \ + ghcr.io/webispy/agl:${{ matrix.target }} ./sdkbuild.sh + + cp build/files_*.tgz /tmp/ + + - name: Upload + if: ${{ env.exist == '0'}} + uses: svenstaro/upload-release-action@v2 + with: + file: /tmp/*.tgz + file_glob: true + repo_token: ${{ secrets.GH_TOKEN }} + overwrite: true + tag: ${{ github.ref }} diff --git a/.github/workflows/release-allwinner.yaml b/.github/workflows/release-allwinner.yaml new file mode 100644 index 0000000000..b140f9f33c --- /dev/null +++ b/.github/workflows/release-allwinner.yaml @@ -0,0 +1,128 @@ +name: Build Allwinner +on: + release: + types: + - created + +env: + REPO: nugu-linux + REPOSLUG: nugu-developers/nugu-linux + +# +# Jobs +# -> build +# - Generate .tgz +# - Upload to Github release +# + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Get SHA and ID from Release ${{ github.ref }} + run: | + # Remove "refs/tags/" from "refs/tags/xxxxxxx" + SHORTSHA=$(echo ${GITHUB_REF} | cut -c11-) + echo "SHA: $SHORTSHA" + + # Get ID for Release-tag + ID=$(curl -s -H "Authorization: token ${{ secrets.GH_TOKEN }}" -X GET https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/tags/${SHORTSHA} | jq '.id' -r) + echo "> Release ID = ${ID}" + if [[ ${ID} == "null" ]]; then + echo "Release ${ID} not exist." + exit + fi + echo "Release-ID: $ID" + + echo "id=$ID" >> $GITHUB_ENV + echo "sha=$SHORTSHA" >> $GITHUB_ENV + + - name: Check for duplicated files + run: | + COUNT=0 + MATCH_COUNT=1 + RESULT=$(curl -s -H "Authorization: token ${{ secrets.GH_TOKEN }}" -X GET https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/${{ env.id }}/assets?per_page=80) + FILES=$(echo $RESULT | jq '.[].name' -r) + + for item in $FILES + do + echo "Check artifacts - $item" + + if [[ $item == *"allwinner"* ]]; then + : + else + continue; + fi + + declare -i COUNT; COUNT+=1 + echo "> Found build artifacts: [${COUNT}/${MATCH_COUNT}] ${item}" + done + + # Mark to flag file to trigger the build + if [[ $COUNT == $MATCH_COUNT ]]; then + echo "> There is no need to rebuild." + echo "exist=1" >> $GITHUB_ENV + else + echo "> Rebuild required" + echo "exist=0" >> $GITHUB_ENV + fi + + - name: The build artifact already exists, so the build is skipped. + if: ${{ env.exist == '1'}} + run: echo "Done" + + - name: Build + if: ${{ env.exist == '0'}} + run: | + git clone https://github.com/${REPOSLUG} --recursive + cd ${REPO} + git checkout ${{ env.sha }} + git reset --hard + rm -rf .git + + # Fix permissions for docker + chmod 777 $PWD + + cat < sdkbuild.sh + #!/bin/zsh + set -e + + mkdir -p /mnt/UDISK + + rm -rf build + mkdir build + cd build + + cmake .. \ + -DENABLE_ASAN=OFF \ + -DCMAKE_INSTALL_PREFIX=/mnt/UDISK \ + -DCMAKE_INSTALL_LIBDIR=/mnt/UDISK/lib \ + -DCMAKE_TOOLCHAIN_FILE=/opt/toolchain/Toolchain.cmake + make -j6 + make install + mv /mnt/UDISK ./SDK + tar cvfz files_allwinner_${{ env.sha }}.tgz SDK + EOF + + chmod 755 sdkbuild.sh + + echo "> Build cross-compile" + docker run -t --rm -v $PWD:$PWD -w $PWD \ + nugulinux/devenv:allwinner ./sdkbuild.sh + + mkdir /tmp/result + cp build/files_*.tgz /tmp/result/ + + cd .. + whoami + ls -l + + - name: Upload + if: ${{ env.exist == '0'}} + uses: svenstaro/upload-release-action@v2 + with: + file: /tmp/result/* + file_glob: true + repo_token: ${{ secrets.GH_TOKEN }} + overwrite: true + tag: ${{ github.ref }} diff --git a/.github/workflows/release-docker.yaml b/.github/workflows/release-docker.yaml new file mode 100644 index 0000000000..b797c20983 --- /dev/null +++ b/.github/workflows/release-docker.yaml @@ -0,0 +1,97 @@ +name: Build Docker +on: + page_build: + workflow_dispatch: + inputs: + comment: + description: 'Comment' + required: false + default: '' + +env: + REPO: nugu-linux + REPOSLUG: nugu-developers/nugu-linux + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v4 + - name: Generate docker image + run: | + echo "OS=$OSTYPE" + + function docker_check() { + docker pull nugulinux/sdk:unstable + } + + if docker_check; then + echo "Download success" + else + echo "Image not exist" + echo "commit=x" >> $GITHUB_ENV + exit + fi + + URL_PACKAGES=https://raw.githubusercontent.com/nugulinux/sdk-unstable/gh-pages/ubuntu/dists/focal/main/binary-amd64/Packages + PKG_VERSION=$(curl -s -X GET $URL_PACKAGES | grep Version | head -1) + PKG_SHA=$(echo $PKG_VERSION | sed 's/.*\(.......\)~.*/\1/') + echo "Commit from Github pages: $PKG_SHA" + + LAST_COMMIT=`docker run -t --rm nugulinux/sdk:unstable printenv | grep LAST_COMMIT` + echo $LAST_COMMIT + + COMMIT= + if [[ "$OSTYPE" == "linux-gnu"* ]]; then + COMMIT=$(echo $LAST_COMMIT | sed -r 's/LAST_COMMIT=(.*)/\1/' | tr -d '\r') + elif [[ "$OSTYPE" == "darwin"* ]]; then + COMMIT=$(echo $LAST_COMMIT | gsed -r 's/LAST_COMMIT=(.*)/\1/' | tr -d '\r') + fi + + echo "nugulinux/sdk:unstable docker commit='${COMMIT}'" + + if [[ "${COMMIT}" == "${PKG_SHA}" ]]; then + echo "Same version" + NEED_BUILD=0 + else + echo "not match" + NEED_BUILD=1 + fi + + if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then + echo "force build" + NEED_BUILD=1 + fi + + echo "commit=${COMMIT}" >> $GITHUB_ENV + echo "sha=${PKG_SHA}" >> $GITHUB_ENV + echo "build=${NEED_BUILD}" >> $GITHUB_ENV + + - name: Information + run: | + echo "${{ env.sha }}" + echo "${{ env.commit }}" + echo "${{ env.build }}" + - name: Set up QEMU + if: ${{ env.build == 1}} + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + if: ${{ env.build == 1}} + uses: docker/setup-buildx-action@v3 + - name: Login to GitHub Container Registry + if: ${{ env.build == 1}} + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - name: Build and push + if: ${{ env.build == 1}} + uses: docker/build-push-action@v5 + with: + context: docker/. + platforms: linux/amd64,linux/arm64 + push: true + tags: nugulinux/sdk:unstable + build-args: | + LAST_COMMIT=${{ env.sha }} diff --git a/.github/workflows/release-tizen.yaml b/.github/workflows/release-tizen.yaml new file mode 100644 index 0000000000..d2dc5c83d2 --- /dev/null +++ b/.github/workflows/release-tizen.yaml @@ -0,0 +1,173 @@ +name: Build Tizen +on: + workflow_dispatch: + inputs: + comment: + description: 'Comment' + required: false + default: '' +# release: +# types: +# - created + +env: + REPO: nugu-linux + REPOSLUG: nugu-developers/nugu-linux + +# +# Jobs +# check +# -> build (matrix: emulator, device) +# - Generate .tgz +# - Upload to Github release +# + +jobs: + check: + runs-on: ubuntu-latest + outputs: + release_id: ${{ steps.check.outputs.id }} + sha: ${{ steps.check.outputs.sha }} + steps: + - name: Get SHA and ID from Release ${{ github.ref }} + id: check + run: | + # Remove "refs/tags/" from "refs/tags/xxxxxxx" + SHORTSHA=$(echo ${GITHUB_REF} | cut -c11-) + echo "SHA: $SHORTSHA" + + # Get ID for Release-tag + ID=$(curl -s -H "Authorization: token ${{ secrets.GH_TOKEN }}" -X GET https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/tags/${SHORTSHA} | jq '.id' -r) + echo "> Release ID = ${ID}" + if [[ ${ID} == "null" ]]; then + echo "Release ${ID} not exist." + exit + fi + echo "Release-ID: $ID" + + echo "id=$ID" >> $GITHUB_OUTPUT + echo "sha=$SHORTSHA" >> $GITHUB_OUTPUT + + build: + runs-on: ubuntu-latest + needs: check + strategy: + fail-fast: true + matrix: + target: [emulator, device] + steps: + - name: Setup + run: | + echo "id=${{ needs.check.outputs.release_id }}" >> $GITHUB_ENV + echo "sha=${{ needs.check.outputs.sha }}" >> $GITHUB_ENV + + - name: Check for duplicated files + run: | + COUNT=0 + MATCH_COUNT=1 + RESULT=$(curl -s -H "Authorization: token ${{ secrets.GH_TOKEN }}" -X GET https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/${{ env.id }}/assets?per_page=80) + FILES=$(echo $RESULT | jq '.[].name' -r) + + for item in $FILES + do + echo "Check artifacts - $item" + + if [[ $item == *"tizen"* ]]; then + : + else + continue; + fi + + if [[ $item == *"${{ matrix.target }}"* ]]; then + : + else + continue; + fi + + declare -i COUNT; COUNT+=1 + echo "> Found build artifacts: [${COUNT}/${MATCH_COUNT}] ${item}" + done + + # Mark to flag file to trigger the build + if [[ $COUNT == $MATCH_COUNT ]]; then + echo "> There is no need to rebuild." + echo "exist=1" >> $GITHUB_ENV + else + echo "> Rebuild required" + echo "exist=0" >> $GITHUB_ENV + fi + + - name: The build artifact already exists, so the build is skipped. + if: ${{ env.exist == '1'}} + run: echo "Done" + + - name: Build + if: ${{ env.exist == '0'}} + run: | + git clone https://github.com/${REPOSLUG} --recursive + cd ${REPO} + git checkout ${{ env.sha }} + git reset --hard + rm -rf .git + + # Fix permissions for docker + chmod 777 $PWD -R + + SDKPATH=$PWD/SDK + echo "> SDK Install PATH=$SDKPATH" + + cat < sdkbuild.sh + #!/bin/zsh + set -e + + source ~/${{ matrix.target }}.env + + echo $PWD + + rm -rf SDK + mkdir SDK + + rm -rf build + mkdir build + + cd build + cmake .. \ + -DCMAKE_INSTALL_PREFIX=/ \ + -DCMAKE_TOOLCHAIN_FILE=~/Toolchain.cmake \ + -DENABLE_LOG_ANSICOLOR=OFF \ + -DENABLE_OPUS_PLUGIN=ON \ + -DENABLE_GSTREAMER_PLUGIN=OFF \ + -DENABLE_PORTAUDIO_PLUGIN=OFF \ + -DENABLE_VENDOR_LIBRARY=ON \ + -DENABLE_BUILTIN_OPUS=ON + + make -j6 + + DESTDIR=$SDKPATH make install + + cd .. + tar cvfz files_tizen_${{ matrix.target }}_${{ env.sha }}.tgz SDK + EOF + + chmod 755 sdkbuild.sh + + echo "> Build cross-compile" + docker run -t --rm -v $PWD:$PWD -w $PWD \ + nugulinux/devenv:tizen ./sdkbuild.sh + + mkdir /tmp/result + cp files_*.tgz /tmp/result/ + + cd .. + whoami + ls -l + + - name: Upload + if: ${{ env.exist == '0'}} + uses: svenstaro/upload-release-action@v2 + with: + file: /tmp/result/* + file_glob: true + repo_token: ${{ secrets.GH_TOKEN }} + overwrite: true + tag: ${{ github.ref }} diff --git a/.github/workflows/release-ubuntu.yaml b/.github/workflows/release-ubuntu.yaml new file mode 100644 index 0000000000..2011acd5cd --- /dev/null +++ b/.github/workflows/release-ubuntu.yaml @@ -0,0 +1,397 @@ +name: Build Ubuntu +on: + release: + types: + - created + +env: + REPO: nugu-linux + REPOSLUG: nugu-developers/nugu-linux + +# +# Jobs +# check +# -> build (matrix) +# - Generate DEB package and .tgz +# - Upload to Github release +# -> pages +# - Doxygen +# - DEB Repository +# - Upload to Github pages +# -> docker +# - Generate nugulinux/sdk:unstable docker image +# + +jobs: + check: + runs-on: ubuntu-latest + outputs: + release_id: ${{ steps.check.outputs.id }} + sha: ${{ steps.check.outputs.sha }} + steps: + - name: Get SHA and ID from Release ${{ github.ref }} + id: check + run: | + # Remove "refs/tags/" from "refs/tags/xxxxxxx" + SHORTSHA=$(echo ${GITHUB_REF} | cut -c11-) + echo "SHA: $SHORTSHA" + + # Get ID for Release-tag + ID=$(curl -s -H "Authorization: token ${{ secrets.GH_TOKEN }}" -X GET https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/tags/${SHORTSHA} | jq '.id' -r) + echo "> Release ID = ${ID}" + if [[ ${ID} == "null" ]]; then + echo "Release ${ID} not exist." + exit + fi + echo "Release-ID: $ID" + + echo "id=$ID" >> $GITHUB_OUTPUT + echo "sha=$SHORTSHA" >> $GITHUB_OUTPUT + + build: + runs-on: ubuntu-latest + needs: check + strategy: + fail-fast: true + matrix: + target: + [ + bionic_x64, + bionic_arm64, + bionic_armhf, + focal_x64, + focal_arm64, + focal_armhf, + jammy_x64, + jammy_arm64, + jammy_armhf, + ] + steps: + - name: Setup + run: | + UBUNTU_VER=$(echo ${{ matrix.target }} | cut -d "_" -f 1) + ARCH=$(echo ${{ matrix.target }} | cut -d "_" -f 2) + if [ "$ARCH" == "x64" ]; then + ARCH2="amd64" + else + ARCH2="${ARCH}" + fi + + echo "ubuntuver=$UBUNTU_VER" >> $GITHUB_ENV + echo "arch=$ARCH" >> $GITHUB_ENV + echo "arch2=$ARCH2" >> $GITHUB_ENV + echo "id=${{ needs.check.outputs.release_id }}" >> $GITHUB_ENV + echo "sha=${{ needs.check.outputs.sha }}" >> $GITHUB_ENV + + - name: Check for duplicated files + run: | + COUNT=0 + MATCH_COUNT=6 + RESULT=$(curl -s -H "Authorization: token ${{ secrets.GH_TOKEN }}" -X GET https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/${{ env.id }}/assets?per_page=80) + FILES=$(echo $RESULT | jq '.[].name' -r) + + for item in $FILES + do + echo "Check artifacts - $item" + + # Check ARCH or ARCH2 + if [[ $item == *"${{ env.arch }}"* ]]; then + : + elif [[ $item == *"${{ env.arch2 }}"* ]]; then + : + else + continue; + fi + + # Check Ubuntu version (jammy / focal / bionic) + if [[ $item == *"${{ env.ubuntuver }}"* ]]; then + : + else + continue; + fi + + declare -i COUNT; COUNT+=1 + echo "> Found build artifacts: [${COUNT}/${MATCH_COUNT}] ${item}" + done + + # Mark to flag file to trigger the build + if [[ $COUNT == $MATCH_COUNT ]]; then + echo "> There is no need to rebuild." + echo "exist=1" >> $GITHUB_ENV + else + echo "> Rebuild required" + echo "exist=0" >> $GITHUB_ENV + fi + + - name: The build artifact already exists, so the build is skipped. + if: ${{ env.exist == '1'}} + run: echo "Done" + + - name: Start Ubuntu build + if: ${{ env.exist == '0'}} + run: | + # Get date for commit to generate version + DATETIME=$(curl -s -H "Authorization: token ${{ secrets.GH_TOKEN }}" -X GET https://api.github.com/repos/${REPOSLUG}/commits/${{ env.sha }} | jq '.commit.committer.date' -r) + echo "commit.committer.date = ${DATETIME}" + + STAMP=$(date -d ${DATETIME} +%Y%m%d) + VERSION="${STAMP}${{ env.sha }}" + echo "package version = ${VERSION}" + + echo "Clone the sdk repository" + git clone https://github.com/${REPOSLUG} --recursive + cd ${REPO} + git checkout ${{ env.sha }} + git reset --hard + rm -rf .git + + echo "Add commit-id(${{ env.sha }}) to package version" + sed -i "1 s/ubuntu[0-9]*~bionic/ubuntu${VERSION}~bionic/" packaging/bionic/changelog + sed -i "1 s/ubuntu[0-9]*~focal/ubuntu${VERSION}~focal/" packaging/focal/changelog + sed -i "1 s/ubuntu[0-9]*~jammy/ubuntu${VERSION}~jammy/" packaging/jammy/changelog + head -1 packaging/bionic/changelog + head -1 packaging/focal/changelog + head -1 packaging/jammy/changelog + cd - + + # Fix permissions for docker + chmod 777 $PWD + chmod 777 $PWD/${REPO} + + echo "Build debian package" + docker run -t --rm --privileged -v $PWD:$PWD -w $PWD/${REPO} \ + -v /var/lib/schroot/chroots \ + nugulinux/buildenv:${{ matrix.target }} sdkbuild.sh + + ls -l + + echo "Create /tmp/result" + mkdir /tmp/result + + cp *.deb /tmp/result/ + + echo "Completed" + echo "files=1" >> $GITHUB_ENV + + - name: Generate tgz + if: ${{ env.files == '1'}} + run: | + FILENAME=files_${{ matrix.target }}_${{ env.sha }} + + # Create temporary directory + mkdir dest + + # Extract all deb packages + FILES=$(ls *.deb) + for item in $FILES + do + echo "Extract ${item}" + ar x ${item} + if [ -f data.tar.xz ]; then + tar -C dest -xvf data.tar.xz + rm data.tar.xz + elif [ -f data.tar.zst ]; then + tar -C dest -xvf data.tar.zst + rm data.tar.zst + fi + done + + # Generate tgz + cd dest + tar cvfz ../${FILENAME}.tgz . + cd - + + cp ${FILENAME}.tgz /tmp/result/ + + - name: Upload artifact to release + if: ${{ env.files == '1'}} + uses: svenstaro/upload-release-action@v2 + with: + file: /tmp/result/* + file_glob: true + repo_token: ${{ secrets.GH_TOKEN }} + overwrite: true + tag: ${{ github.ref }} + + pages: + runs-on: ubuntu-latest + needs: [check, build] + env: + BASEROOT: /tmp/www + steps: + - name: Check out the repo + uses: actions/checkout@v4 + - name: Setup + id: setup + run: | + sudo apt-get install doxygen graphviz + + POOL_BIONIC=${BASEROOT}/ubuntu/dists/bionic/pool + POOL_FOCAL=${BASEROOT}/ubuntu/dists/focal/pool + POOL_JAMMY=${BASEROOT}/ubuntu/dists/jammy/pool + + DIRS=( + ${POOL_BIONIC} + ${POOL_JAMMY} + ${BASEROOT}/ubuntu/dists/bionic/main/binary-amd64 + ${BASEROOT}/ubuntu/dists/bionic/main/binary-arm64 + ${BASEROOT}/ubuntu/dists/bionic/main/binary-armhf + ${BASEROOT}/ubuntu/dists/focal/main/binary-amd64 + ${BASEROOT}/ubuntu/dists/focal/main/binary-arm64 + ${BASEROOT}/ubuntu/dists/focal/main/binary-armhf + ${BASEROOT}/ubuntu/dists/jammy/main/binary-amd64 + ${BASEROOT}/ubuntu/dists/jammy/main/binary-arm64 + ${BASEROOT}/ubuntu/dists/jammy/main/binary-armhf + ) + + for item in "${DIRS[@]}" + do + echo "- Create ${item}" + if [[ ! -d ${item} ]]; then + mkdir -p ${item} + fi + done + + # Generate index.html + DATE=$(date) + cat < ${BASEROOT}/index.html + + +

DEB Package repository for unstable release

+ +

+ last unstable commit: ${{ env.sha }} +

+ +

+ API Document(doxygen): https://nugulinux.github.io/sdk-unstable/doxygen/ +

+ +
+ +

NUGU SDK for Linux PPA Setup (stable release)

+
+              add-apt-repository ppa:nugulinux/sdk
+              apt-get update
+          
+ +
+ +

Unstable package repository setup

+ +

Jammy (22.04)

+
+              echo "deb [trusted=yes] https://nugulinux.github.io/sdk-unstable/ubuntu/ jammy main" > /etc/apt/sources.list.d/nugudev.list
+              apt-get update
+          
+ +

Focal (20.04)

+
+              echo "deb [trusted=yes] https://nugulinux.github.io/sdk-unstable/ubuntu/ focal main" > /etc/apt/sources.list.d/nugudev.list
+              apt-get update
+          
+ +

Bionic (18.04)

+
+              echo "deb [trusted=yes] https://nugulinux.github.io/sdk-unstable/ubuntu/ bionic main" > /etc/apt/sources.list.d/nugudev.list
+              apt-get update
+          
+ +
+ +

Generated at ${DATE}

+ + + + EOF + + echo "id=${{ needs.check.outputs.release_id }}" >> $GITHUB_ENV + echo "sha=${{ needs.check.outputs.sha }}" >> $GITHUB_ENV + echo "pool_bionic=${POOL_BIONIC}" >> $GITHUB_ENV + echo "pool_focal=${POOL_FOCAL}" >> $GITHUB_ENV + echo "pool_jammy=${POOL_JAMMY}" >> $GITHUB_ENV + + - name: Generate doxygen + run: | + git clone https://github.com/${REPOSLUG} + cd ${REPO} + git checkout ${{ env.sha }} + git reset --hard + rm -rf .git + + doxygen + mv doc/html ${BASEROOT}/doxygen + cd .. + rm -rf ${REPO} + + - name: Generate unstable DEB repository + run: | + function generate { + DIST=$1 + HOST=$2 + PKGSREPO="dists/${DIST}/pool" + PKGS="dists/${DIST}/main/binary-${HOST}/" + + echo "> DEB Repo: ${PKGSREPO}" + echo "> Packages path: ${PKGS}" + + cd ${BASEROOT}/ubuntu + dpkg-scanpackages -m -a $HOST ${PKGSREPO} > ${PKGS}/Packages + cd - + } + + echo "> Get file list" + RESULT=$(curl -s -H "Authorization: token ${{ secrets.GH_TOKEN }}" -X GET https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/${{ env.id }}/assets?per_page=80) + FILES=$(echo $RESULT | jq '.[].browser_download_url' -r) + for item in $FILES + do + if [[ $item != *.deb ]]; then + echo "- ignore: ${item}" + continue + fi + + echo "Download ${item}" + + if [[ $item == *"bionic"* ]]; then + echo "- 18.04: ${item}" + wget -nv ${item} -P ${{ env.pool_bionic }} + if [[ $item == *"amd64"* ]]; then + generate "bionic" "amd64" + elif [[ $item == *"armhf"* ]]; then + generate "bionic" "armhf" + elif [[ $item == *"arm64"* ]]; then + generate "bionic" "arm64" + fi + elif [[ $item == *"focal"* ]]; then + echo "- 20.04: ${item}" + wget -nv ${item} -P ${{ env.pool_focal }} + if [[ $item == *"amd64"* ]]; then + generate "focal" "amd64" + elif [[ $item == *"armhf"* ]]; then + generate "focal" "armhf" + elif [[ $item == *"arm64"* ]]; then + generate "focal" "arm64" + fi + elif [[ $item == *"jammy"* ]]; then + echo "- 20.04: ${item}" + wget -nv ${item} -P ${{ env.pool_jammy }} + if [[ $item == *"amd64"* ]]; then + generate "jammy" "amd64" + elif [[ $item == *"armhf"* ]]; then + generate "jammy" "armhf" + elif [[ $item == *"arm64"* ]]; then + generate "jammy" "arm64" + fi + else + echo "- unknown version: ${item}" + fi + done + + - name: Deploy to Github Pages + uses: JamesIves/github-pages-deploy-action@v4 + with: + token: ${{ secrets.GH_TOKEN }} + branch: gh-pages + folder: /tmp/www + clean: true + single-commit: true diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 301176de40..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,45 +0,0 @@ -language: shell -dist: xenial -env: - global: - - REPO=nugu-linux - - REPOSLUG=nugu-developers/nugu-linux - - UPLOAD=0 -addons: - apt: - packages: - - jq -branches: - only: - - master - - ubuntu - - allwinner - - tizen - -script: | - export SHA=$(curl -s -H "Authorization: token ${GITHUB_TOKEN}" -X GET https://api.github.com/repos/${REPOSLUG}/commits/master | jq '.sha' -r) - export SHORTSHA=$(echo ${SHA} | cut -c -7) - export TRAVIS_TAG=${SHORTSHA} - - mkdir /tmp/result - - ./changes.sh /tmp/result/CHANGES.txt - if [ -f /tmp/result/CHANGES.txt ]; then - UPLOAD=1 - fi - - ./trigger.sh nugulinux sdk-unstable allwinner - ./trigger.sh nugulinux sdk-unstable ubuntu - ./trigger.sh nugulinux sdk-unstable tizen - echo "Upload = $UPLOAD" - -deploy: - provider: releases - api_key: - secure: n+T33vCZNGTLlISJw/olUQHWXmAL4WvSyeiSKR6iamVb49axHcsBdHtMHnagTWCcwDRhJrKokmgn8pzjXnChANaTwp9ySxCmWhxYt1sOKQwHV3exl+5ilY3EqbEJxNRauckuT5w3kLTa6206Dh+ah+sLm8e42mAWuZJiAUQUKFOuOA7kdsWqCo9vNScd+7gFs/7EnMapsvWD43Jzo568VnyNXZK04GTmaUwoei2YV/aB4fe/stW+adCK7SmWCzeeY5a1fq7bgzJzKR8EpAJMOyoU5GaNdY1bxUsAguYEyS8l9I9t+RaP3OExXKYbxAxeh26cvpGSM1m9bYXK9Tt+AdDU1OmsGNULqzieLixH0BCByMqV7v+gGGqOQISGSWbWDQPoFZRY4YLODkVgL6wt4vMCLhvOevX790mWF8oDCE+aZwqvBOGfmUnZKoX0omTUwLHqLf+p+FZKsh4gzkbtY9QzDhrqyjTVFt5h83sZRe9qR/llxKfsP3k4b4ukAzVrRkqO2mtTjwMd9zmosOFxQH5XZqqqwiTtRf7aGcS92TaZvqHkhcXDpZTjp8/Uk/VfompKHzYkcyfO+WeYI37mLhye4HdMvWvl09D2Fp7do3ZjzYp352hnG4PG+yhiW/NAk2jNh9vYIpzniMVBcNRk0dYDGuY9OOgrJQ6QN4eO2e0= - file_glob: true - file: /tmp/result/* - on: - repo: nugulinux/sdk-unstable - condition: $UPLOAD = 1 - overwrite: true diff --git a/README.md b/README.md index 0b57df8292..38e6dd6b96 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Build Status](https://travis-ci.org/nugulinux/sdk-unstable.svg?branch=master)](https://travis-ci.org/nugulinux/sdk-unstable) +[![Build Ubuntu](https://github.com/nugulinux/sdk-unstable/workflows/Build%20Ubuntu/badge.svg)]((https://github.com/nugulinux/sdk-unstable/actions?query=workflow%3A%22Build+Ubuntu%22)) [![Build Allwinner](https://github.com/nugulinux/sdk-unstable/workflows/Build%20Allwinner/badge.svg)]((https://github.com/nugulinux/sdk-unstable/actions?query=workflow%3A%22Build+Allwinner%22)) # NUGU SDK for Linux unstable repository @@ -14,14 +14,18 @@ Add NUGU SDK for Linux PPA: Create a `/etc/apt/sources.list.d/nugu-unstable.list` file with following content. -Ubuntu 16.04: - - deb [trusted=yes] https://nugulinux.github.io/sdk-unstable/ubuntu/ xenial main - Ubuntu 18.04: deb [trusted=yes] https://nugulinux.github.io/sdk-unstable/ubuntu/ bionic main +Ubuntu 20.04: + + deb [trusted=yes] https://nugulinux.github.io/sdk-unstable/ubuntu/ focal main + +Ubuntu 22.04: + + deb [trusted=yes] https://nugulinux.github.io/sdk-unstable/ubuntu/ jammy main + Update the package information sudo apt-get update diff --git a/changes.sh b/changes.sh deleted file mode 100755 index 594997a71a..0000000000 --- a/changes.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash -set -e - -if [ $# != 1 ]; then - echo "Usage: $0 {flag-file-name}" - exit 1 -fi - -echo "> output flag file: $1" - -echo "> TRAVIS_ACCESS_TOKEN: $TRAVIS_ACCESS_TOKEN" - -# Check for duplicate releases -ID=$(curl -s -H "Authorization: token ${GITHUB_TOKEN}" -X GET https://api.github.com/repos/${TRAVIS_REPO_SLUG}/releases/tags/${SHORTSHA} | jq '.id' -r) -echo "> Release ID = ${ID}" -if [[ ${ID} != "null" ]]; then - echo "Skip deploy to release ${ID}" - exit -fi - -# Get commit message -MSG=$(curl -s -H "Authorization: token ${GITHUB_TOKEN}" -X GET https://api.github.com/repos/${REPOSLUG}/commits/master | jq '.commit.message' -r) - -# Create new release -jq -n --arg body "${MSG}" \ - --arg tag_name "${SHORTSHA}" \ - --arg name "${SHORTSHA}" \ - '{ "tag_name": $tag_name, "name": $name, "body": $body }' | curl -D - \ - -H "Authorization: token ${GITHUB_TOKEN}" \ - -X POST https://api.github.com/repos/${TRAVIS_REPO_SLUG}/releases -d@- - -# Get commit history from latest official release tag -git clone https://github.com/${REPOSLUG} -cd ${REPO} -git checkout ${SHA} -git reset --hard -git log $(git describe --tags --abbrev=0)..HEAD --oneline > $1 -cd - -rm -rf ${REPO} diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000000..7146e20cb6 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,27 @@ +FROM ubuntu:focal +LABEL maintainer="nugulinux@gmail.com" \ + version="0.1" \ + description="nugulinux unstable sdk" + +ARG LAST_COMMIT + +ENV DEBIAN_FRONTEND=noninteractive \ + LC_ALL=C \ + LANG=C \ + LANGUAGE=C \ + SHELL=/bin/bash \ + PULSE_SERVER=host.docker.internal \ + LAST_COMMIT=$LAST_COMMIT + +RUN apt-get update && apt-get install -y software-properties-common ca-certificates --no-install-recommends \ + && add-apt-repository -y ppa:nugulinux/sdk \ + && echo "deb [trusted=yes] https://nugulinux.github.io/sdk-unstable/ubuntu/ focal main" > /etc/apt/sources.list.d/nugu-unstable.list \ + && apt-get update && apt-get install -y --no-install-recommends \ + gstreamer1.0-pulseaudio \ + libnugu \ + libnugu-plugins-default \ + libnugu-examples \ + pulseaudio \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* \ + && mkdir -p /var/lib/nugu diff --git a/trigger.sh b/trigger.sh deleted file mode 100755 index a7f235d459..0000000000 --- a/trigger.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -if [ $# != 3 ]; then - echo "Usage: $0 {repo_owner} {repo_name} {branch}" - exit 1 -fi - -TRAVIS_ACCESS_TOKEN=zVfGbxmw0I_zz4EAXvbDZA -REPO_OWNER=$1 -REPO_NAME=$2 -BRANCH=$3 - -echo "> Travis trigger REPO = ${REPO_OWNER}/${REPO_NAME}" -echo "> Travis trigger BRANCH = ${BRANCH}" - -jq -n --arg branch "${BRANCH}" \ - '{ "request": { "branch": $branch } }' | curl -s -D - \ - -H "Content-Type: application/json" \ - -H "Accept: application/json" \ - -H "Travis-API-Version: 3" \ - -H "Authorization: token ${TRAVIS_ACCESS_TOKEN}" \ - -X POST https://api.travis-ci.org/repo/${REPO_OWNER}%2F${REPO_NAME}/requests -d@- - -echo -echo "> Travis trigger completed (${REPO_OWNER}/${REPO_NAME} ${BRANCH})"