From 12ffa3adeaeda53251ca282c9d2ffe2245969249 Mon Sep 17 00:00:00 2001 From: wiserain Date: Wed, 30 Dec 2020 07:17:24 +0900 Subject: [PATCH] prepare libtorrent 2.0.2 (#2) - (actions) accept pushes from current branch only - (actions) should not be triggered on tag - (actions) fix runner verison to ubuntu-20.04 - (actions) suppress notification for sub-jobs if not failed - add dependabot - drop support ubuntu 19.10 eoan --- .github/dependabot.yml | 14 ++++ .github/workflows/docker-buildx.yml | 109 ++++++++++----------------- ubuntu19.10/Dockerfile | 112 ---------------------------- 3 files changed, 53 insertions(+), 182 deletions(-) create mode 100644 .github/dependabot.yml delete mode 100644 ubuntu19.10/Dockerfile diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..11f67cb --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,14 @@ +version: 2 +updates: + + # Maintain dependencies for GitHub Actions + - package-ecosystem: "github-actions" + target-branch: "master" + directory: "/" + schedule: + interval: "daily" + - package-ecosystem: "github-actions" + target-branch: "v1.2" + directory: "/" + schedule: + interval: "daily" diff --git a/.github/workflows/docker-buildx.yml b/.github/workflows/docker-buildx.yml index cbcced8..fc823b1 100644 --- a/.github/workflows/docker-buildx.yml +++ b/.github/workflows/docker-buildx.yml @@ -5,10 +5,7 @@ on: types: [started] push: branches: - - '*' - - '!master' # excludes master - tags: - - '*' + - 'master' pull_request: env: @@ -18,8 +15,8 @@ env: jobs: alpine310: - runs-on: ubuntu-latest - if: github.actor == github.event.repository.owner.login + runs-on: ubuntu-20.04 + if: (github.event_name != 'watch') || (github.actor == github.event.repository.owner.login) steps: - name: Load Variables @@ -56,7 +53,7 @@ jobs: - name: Send Notification uses: sarisia/actions-status-discord@v1 - if: always() + if: failure() with: webhook: ${{ secrets.DISCORD_WEBHOOK }} status: ${{ job.status }} @@ -69,8 +66,8 @@ jobs: - ${{ env.LIBTORRENT_VER }}-${{ steps.vars.outputs.distro }}-py3 alpine311: - runs-on: ubuntu-latest - if: github.actor == github.event.repository.owner.login + runs-on: ubuntu-20.04 + if: (github.event_name != 'watch') || (github.actor == github.event.repository.owner.login) steps: - name: Load Variables @@ -107,7 +104,7 @@ jobs: - name: Send Notification uses: sarisia/actions-status-discord@v1 - if: always() + if: failure() with: webhook: ${{ secrets.DISCORD_WEBHOOK }} status: ${{ job.status }} @@ -120,8 +117,8 @@ jobs: - ${{ env.LIBTORRENT_VER }}-${{ steps.vars.outputs.distro }}-py3 alpine312: - runs-on: ubuntu-latest - if: github.actor == github.event.repository.owner.login + runs-on: ubuntu-20.04 + if: (github.event_name != 'watch') || (github.actor == github.event.repository.owner.login) steps: - name: Load Variables @@ -146,44 +143,7 @@ jobs: - name: Send Notification uses: sarisia/actions-status-discord@v1 - if: always() - with: - webhook: ${{ secrets.DISCORD_WEBHOOK }} - status: ${{ job.status }} - description: | - Image: ${{ env.DOCKERHUB_USER }}/${{ env.DOCKERHUB_REPO }} - Tags: - - latest-${{ steps.vars.outputs.distro }}-py3 - - ${{ env.LIBTORRENT_VER }}-${{ steps.vars.outputs.distro }}-py3 - - ubuntu1910: - runs-on: ubuntu-latest - if: github.actor == github.event.repository.owner.login - steps: - - - name: Load Variables - id: vars - run: | - echo ::set-output name=distro::ubuntu19.10 - - - name: Checkout - uses: actions/checkout@v2 - - - name: Run Buildx - uses: ilteoood/docker_buildx@1.1.0 - with: - imageName: ${{ env.DOCKERHUB_USER }}/${{ env.DOCKERHUB_REPO }} - tag: latest-${{ steps.vars.outputs.distro }}-py3,${{ env.LIBTORRENT_VER }}-${{ steps.vars.outputs.distro }}-py3 - dockerFile: ${{ steps.vars.outputs.distro }}/Dockerfile - buildArg: LIBTORRENT_VER=${{ env.LIBTORRENT_VER }} - publish: true - platform: linux/amd64,linux/arm/v7,linux/arm64 - dockerUser: ${{ env.DOCKERHUB_USER }} - dockerPassword: ${{ secrets.DOCKERHUB_PASS }} - - - name: Send Notification - uses: sarisia/actions-status-discord@v1 - if: always() + if: failure() with: webhook: ${{ secrets.DISCORD_WEBHOOK }} status: ${{ job.status }} @@ -194,8 +154,8 @@ jobs: - ${{ env.LIBTORRENT_VER }}-${{ steps.vars.outputs.distro }}-py3 ubuntu2004: - runs-on: ubuntu-latest - if: github.actor == github.event.repository.owner.login + runs-on: ubuntu-20.04 + if: (github.event_name != 'watch') || (github.actor == github.event.repository.owner.login) steps: - name: Load Variables @@ -220,7 +180,7 @@ jobs: - name: Send Notification uses: sarisia/actions-status-discord@v1 - if: always() + if: failure() with: webhook: ${{ secrets.DISCORD_WEBHOOK }} status: ${{ job.status }} @@ -231,8 +191,8 @@ jobs: - ${{ env.LIBTORRENT_VER }}-${{ steps.vars.outputs.distro }}-py3 ubuntu2010: - runs-on: ubuntu-latest - if: github.actor == github.event.repository.owner.login + runs-on: ubuntu-20.04 + if: (github.event_name != 'watch') || (github.actor == github.event.repository.owner.login) steps: - name: Load Variables @@ -257,7 +217,7 @@ jobs: - name: Send Notification uses: sarisia/actions-status-discord@v1 - if: always() + if: failure() with: webhook: ${{ secrets.DISCORD_WEBHOOK }} status: ${{ job.status }} @@ -272,18 +232,17 @@ jobs: - alpine310 - alpine311 - alpine312 - - ubuntu1910 - ubuntu2004 - ubuntu2010 - runs-on: ubuntu-latest - if: github.actor == github.event.repository.owner.login + runs-on: ubuntu-20.04 + if: (github.event_name != 'watch') || (github.actor == github.event.repository.owner.login) steps: - name: Load Variables id: vars run: | echo ::set-output name=date::$(date -u +'%y%m%d') - echo ::set-output name=tags::"alpine3.10-py2 alpine3.10-py3 alpine3.11-py2 alpine3.11-py3 alpine3.12-py3 ubuntu19.10-py3 ubuntu20.04-py3 ubuntu20.10-py3" + echo ::set-output name=tags::"alpine3.10-py2 alpine3.10-py3 alpine3.11-py2 alpine3.11-py3 alpine3.12-py3 ubuntu20.04-py3 ubuntu20.10-py3" echo ::set-output name=github_desc::$(curl -sX GET https://api.github.com/repos/wiserain/docker-libtorrent | jq -r .description) - name: Checkout @@ -296,6 +255,7 @@ jobs: - name: Create Release id: create_release + if: (github.event_name != 'pull_request') uses: actions/create-release@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token @@ -307,19 +267,28 @@ jobs: prerelease: false - name: Upload Assets to Release with a wildcard + if: (github.event_name != 'pull_request') uses: csexton/release-asset-action@v2 with: pattern: "release/*.tar.gz" github-token: ${{ secrets.GITHUB_TOKEN }} release-url: ${{ steps.create_release.outputs.upload_url }} - - - name: push README to Dockerhub - uses: christian-korneck/update-container-description-action@v1 - env: - DOCKER_USER: ${{ env.DOCKERHUB_USER }} - DOCKER_PASS: ${{ secrets.DOCKERHUB_PASS }} + - + name: Update Dockerhub description + if: (github.event_name != 'pull_request') + uses: peter-evans/dockerhub-description@v2 + with: + username: ${{ env.DOCKERHUB_USER }} + password: ${{ secrets.DOCKERHUB_PASS }} + repository: ${{ env.DOCKERHUB_USER }}/${{ env.DOCKERHUB_REPO }} + short-description: ${{ steps.vars.outputs.github_desc }} + - + name: Send Notification + uses: sarisia/actions-status-discord@v1 + if: always() with: - destination_container_repo: ${{ env.DOCKERHUB_USER }}/${{ env.DOCKERHUB_REPO }} - provider: dockerhub - short_description: ${{ steps.vars.outputs.github_desc }} - readme_file: 'README.md' + webhook: ${{ secrets.DISCORD_WEBHOOK }} + status: ${{ job.status }} + description: | + Image: ${{ env.DOCKERHUB_USER }}/${{ env.DOCKERHUB_REPO }} + Tags: ${{ steps.vars.outputs.tags }} diff --git a/ubuntu19.10/Dockerfile b/ubuntu19.10/Dockerfile deleted file mode 100644 index 90682c3..0000000 --- a/ubuntu19.10/Dockerfile +++ /dev/null @@ -1,112 +0,0 @@ -FROM ubuntu:19.10 AS ubuntu -FROM ubuntu AS build-base - -ARG LIBTORRENT_VER -ARG TARGETARCH -ARG DEBIAN_FRONTEND="noninteractive" - -RUN \ - echo "**** install build-deps ****" && \ - apt-get update && \ - apt-get install -yq \ - build-essential \ - git \ - libboost-chrono-dev \ - libboost-python-dev \ - libboost-random-dev \ - libboost-system-dev \ - libssl-dev \ - `# python-deps` \ - python3-setuptools python3-all-dev - -ENV CMAKE_VER="3.19.0" -RUN \ - echo "**** install cmake v${CMAKE_VER} ****" && \ - apt-get update && \ - apt-get install -yq \ - build-essential \ - libssl-dev \ - wget && \ - if [ $TARGETARCH = "arm" ]; then \ - export CFLAGS="-D_FILE_OFFSET_BITS=64" && \ - export CXXFLAGS="-D_FILE_OFFSET_BITS=64"; \ - fi && \ - cd $(mktemp -d) && \ - wget https://cmake.org/files/v${CMAKE_VER%.*}/cmake-${CMAKE_VER}.tar.gz --no-check-certificate && \ - tar -xzf cmake-${CMAKE_VER}.tar.gz --strip-components=1 && \ - ./bootstrap \ - --prefix=/usr \ - --parallel=$(nproc) \ - -- \ - -DCMAKE_BUILD_TYPE:STRING=Release && \ - make -j$(nproc) && \ - make install - -RUN \ - echo "**** clone source ****" && \ - git clone --recurse-submodules https://github.com/arvidn/libtorrent.git /tmp/libtorrent -b "v${LIBTORRENT_VER}" --depth 1 - -RUN \ - echo "**** build libtorrent ****" && \ - PY_VER=$(python3 -c 'import sys; print(".".join([str(x) for x in sys.version_info[:2]]))') && \ - _PY_VER="$(echo "${PY_VER}" | sed 's/\.//g')" && \ - if [ $TARGETARCH = "amd64" ]; then \ - BOOST_LIB_DIR="x86_64-linux-gnu"; \ - elif [ $TARGETARCH = "arm64" ]; then \ - BOOST_LIB_DIR="aarch64-linux-gnu"; \ - elif [ $TARGETARCH = "arm" ]; then \ - BOOST_LIB_DIR="arm-linux-gnueabihf"; \ - fi && \ - mkdir /tmp/libtorrent/_build -p && \ - cd /tmp/libtorrent/_build && \ - cmake \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX="/usr" \ - -DCMAKE_INSTALL_LIBDIR="lib/${BOOST_LIB_DIR}" \ - -Dpython-bindings=ON \ - -Dboost-python-module-name="python${_PY_VER}" \ - -DBoost_LIBRARY_DIR="/usr/lib/${BOOST_LIB_DIR}" \ - "../" && \ - make VERBOSE=1 -j$(nproc) && \ - echo "**** install libtorrent ****" && \ - cd /tmp/libtorrent && \ - make -C "_build" DESTDIR=/libtorrent-build install && \ - rm -rf /libtorrent-build/usr/lib/cmake - -# -# TEST -# -FROM ubuntu AS test - -ARG LIBTORRENT_VER -ARG TARGETARCH -ARG DEBIAN_FRONTEND="noninteractive" - -COPY --from=build-base /libtorrent-build/usr/ /usr/ - -RUN \ - echo "**** install runtime packages ****" && \ - apt-get update && \ - apt-get install -yq \ - libboost-chrono-dev \ - libboost-python-dev \ - libboost-random-dev \ - libboost-system-dev \ - libboost-tools-dev \ - python3-minimal - -RUN \ - BUILD_VER=$(python3 -c 'import libtorrent as lt; print(lt.version)') && \ - if [ $LIBTORRENT_VER = ${BUILD_VER%.*} ]; then \ - echo "Successfully built with version: ${BUILD_VER}"; \ - else \ - echo "Something went wrong: ${BUILD_VER}"; \ - exit 1; \ - fi - -# -# RELEASE -# -FROM ubuntu -LABEL maintainer "wiserain" -COPY --from=build-base /libtorrent-build/usr/ /libtorrent-build/usr/