Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh actions #509

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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 <openSUSE:[email protected]>
#
#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

21 changes: 12 additions & 9 deletions .travis/obs.sh
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -35,6 +37,7 @@ ${REPONAME} (${FULLVERS}) UNRELEASED; urgency=medium
-- Travis CI <[email protected]> ${FULLDATE}
EOF


cat <<EOF > ~/.oscrc
[general]
apiurl = https://api.opensuse.org
Expand All @@ -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}"
Expand Down