From 8b046f320f439fceeed3ad6bfb611aca3e04d2a2 Mon Sep 17 00:00:00 2001 From: / <> Date: Mon, 15 Feb 2021 18:46:02 +0100 Subject: gh actions --- .github/workflows/ci.yml | 62 ++++++++++++++++++++++++++++++++++++++++++++++++ .travis/obs.sh | 21 +++++++++------- 2 files changed, 74 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..80fc162 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,62 @@ +name: CI + +on: + - pull_request + - push + +jobs: + build: + runs-on: ubuntu-20.04 + + steps: + - uses: actions/checkout@v2 + - name: Dependencies + run: | + sudo apt-get update -y + sudo apt-get install -y --no-install-recommends clang git make libjson-glib-dev libpurple-dev clang-tools + + - name: purple-facebook + run: | + ./autogen.sh --enable-warnings + make all clean + - name: scan-build + run: | + scan-build -k --status-bugs make all clean + + + obs: + if: ${{github.ref == 'refs/head/master' && github.event_name == 'push'}} + runs-on: ubuntu-20.04 + needs: build + + steps: + - uses: actions/checkout@v2 + + - name: Dependencies + run: | + echo "deb http://download.opensuse.org/repositories/openSUSE:/Tools/xUbuntu_$(lsb_release -rs) ./" \ + | sudo tee /etc/apt/sources.list.d/suse.list + + ## this key expired literally three days ago: + ## + ## pub rsa2048 2018-09-25 [SC] [expired: 2020-12-03] + ## FCADAFC81273B9E7F184F2B0826659A9013E5B65 + ## uid openSUSE:Tools OBS Project + # + #curl -s "http://download.opensuse.org/repositories/openSUSE:/Tools/xUbuntu_$(lsb_release -rs)/Release.key" \ + # | sudo apt-key add - + # + ## and for Mysterious Reasons this other key exists with the same fingerprint, + ## but expiring three years later: + curl -s "https://download.opensuse.org/repositories/openSUSE:/Tools/openSUSE_Tumbleweed/repodata/repomd.xml.key" \ + | sudo apt-key add - + + sudo apt-get update -y + sudo apt-get install -y --no-install-recommends osc mercurial libjson-glib-dev + - name: Send job to OBS + env: + OBSUSER: ${{ secrets.OBSUSER }} + OBSPASS: ${{ secrets.OBSPASS }} + run: | + .travis/obs.sh + diff --git a/.travis/obs.sh b/.travis/obs.sh index 197cddc..888b9a6 100755 --- a/.travis/obs.sh +++ b/.travis/obs.sh @@ -1,15 +1,17 @@ #!/bin/bash -[ "${TRAVIS_PULL_REQUEST}" == "false" -a \ - "${TRAVIS_BRANCH}" == "${MY_DEPLOY_BRANCH}" \ -] || exit +#[ "${TRAVIS_PULL_REQUEST}" == "false" -a \ +# "${TRAVIS_BRANCH}" == "${MY_DEPLOY_BRANCH}" \ +#] || exit set -e -GITREV=$(git rev-parse --short=7 HEAD) -FULLVERS="$(date +%Y%m%d)-$(cat RELEASE_VERSION)-${GITREV}-${TRAVIS_BUILD_NUMBER}" +#GITREV=$(git rev-parse --short=7 HEAD) +#FULLVERS="$(date +%Y%m%d)-$(cat RELEASE_VERSION)-${GITREV}-${GITHUB_RUN_NUMBER}" +FULLVERS="$(date +%Y%m%d)~$(git rev-parse --short=7 HEAD)~${GITHUB_RUN_NUMBER}" FULLVERS_RPM="$(echo ${FULLVERS} | sed 's/-/~/g')" FULLDATE=$(date -R) -REPONAME=$(basename "${TRAVIS_REPO_SLUG}") +BUILD_DIR=$(pwd) +REPONAME=$(basename "${BUILD_DIR}") git reset -q --hard git clean -dfqx @@ -35,6 +37,7 @@ ${REPONAME} (${FULLVERS}) UNRELEASED; urgency=medium -- Travis CI ${FULLDATE} EOF + cat < ~/.oscrc [general] apiurl = https://api.opensuse.org @@ -44,13 +47,13 @@ pass = ${OBSPASS} EOF mkdir -p m4 -osc checkout "home:${OBSUSER}" "${REPONAME}" -o /tmp/obs +osc checkout "home:jgeboski" "${REPONAME}" -o /tmp/obs ( cd /tmp/obs rm -f *.{dsc,tar.gz} - dpkg-source -I -b "${TRAVIS_BUILD_DIR}" - cp "${TRAVIS_BUILD_DIR}/dist/_service" . + dpkg-source -I -b "${BUILD_DIR}" + cp "${BUILD_DIR}/dist/_service" . osc addremove -r osc commit -m "Updated to ${FULLVERS}" -- cgit v1.2.3