CI added GitHub actions

This commit is contained in:
Frank Morgner
2022-01-18 17:47:36 +01:00
parent 24c502f152
commit 111eb86d3d
5 changed files with 231 additions and 0 deletions

27
.github/build-ccid.sh vendored Executable file
View File

@@ -0,0 +1,27 @@
#!/bin/bash
# CI script to build for "ubuntu", "coverity"
set -ex -o xtrace
# todo openpace
pushd ccid
git submodule update --init .
sudo apt-get install gengetopt help2man libpcsclite-dev
autoreconf -vis
./configure
case "$1" in
ubuntu)
make distcheck
;;
coverity)
# exclude opensc from analysis by building it here
make -C src/OpenSC
esac
popd

58
.github/build-pcsc-relay.sh vendored Executable file
View File

@@ -0,0 +1,58 @@
#!/bin/bash
# CI script to build for "ubuntu", "coverity", "mingw-32", "mingw-64", "macos"
set -ex -o xtrace
pushd pcsc-relay
DEPS="gengetopt help2man automake"
case "$1" in
ubuntu|coverity)
DEPS="$DEPS libnfc-dev libpcsclite-dev"
;;
mingw-32)
DEPS="$DEPS binutils-mingw-w64-i686 gcc-mingw-w64-i686 mingw-w64-i686-dev"
;;
mingw-64)
DEPS="$DEPS binutils-mingw-w64-x86-64 gcc-mingw-w64-x86-64 mingw-w64-x86-64-dev"
;;
macos)
DEPS="$DEPS libnfc"
;;
esac
case "$1" in
ubuntu|coverity|mingw-32|mingw-64)
sudo apt-get install -y $DEPS
;;
macos)
brew install $DEPS
;;
esac
autoreconf -vis
case "$1" in
ubuntu|coverity|macos)
./configure
;;
mingw-32)
env ac_cv_func_malloc_0_nonnull=yes ac_cv_func_realloc_0_nonnull=yes ./configure --host=i686-w64-mingw32 --target=i686-w64-mingw32 CFLAGS=-I/usr/i686-w64-mingw32/include LDFLAGS=-L/usr/i686-w64-mingw32/lib PCSC_LIBS=-lwinscard
;;
mingw-64)
env ac_cv_func_malloc_0_nonnull=yes ac_cv_func_realloc_0_nonnull=yes ./configure --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 CFLAGS=-I/usr/x86_64-w64-mingw32/include LDFLAGS=-L/usr/x86_64-w64-mingw32/lib PCSC_LIBS=-lwinscard
;;
esac
case "$1" in
ubuntu|macos)
make distcheck
;;
mingw-32|mingw-64)
make
;;
esac
popd

42
.github/build-virtualsmartcard.sh vendored Executable file
View File

@@ -0,0 +1,42 @@
#!/bin/bash
# CI script to build for "ubuntu", "coverity", "macos"
set -ex -o xtrace
pushd virtualsmartcard
DEPS="help2man automake libtool"
case "$1" in
ubuntu|coverity)
DEPS="$DEPS libpcsclite-dev libqrencode-dev"
;;
macos)
DEPS="$DEPS gengetopt"
;;
esac
case "$1" in
ubuntu|coverity)
sudo apt-get install -y $DEPS
;;
macos)
brew install $DEPS
;;
esac
autoreconf -vis
./configure
case "$1" in
ubuntu)
make distcheck
;;
macos)
make osx
;;
esac
popd

82
.github/workflows/ci.yml vendored Normal file
View File

@@ -0,0 +1,82 @@
name: Build
on:
pull_request:
paths:
- '**.c'
- '**.h'
- '**.in'
- '**.sh'
- '**.py'
- '**.java'
- .github/workflows/ci.yml
push:
jobs:
virtualsmartcard-macos:
runs-on: macos-11
steps:
- uses: actions/checkout@v2
- run: .github/build-virtualsmartcard.sh macos
- uses: actions/upload-artifact@v2
with:
name: virtualsmartcard-macos
path:
virtualsmartcard/virtualsmartcard*.dmg
virtualsmartcard-ubuntu:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- run: .github/build-virtualsmartcard.sh ubuntu
- uses: actions/upload-artifact@v2
with:
name: virtualsmartcard
path:
virtualsmartcard/virtualsmartcard*.tar.gz
ccid-ubuntu:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- run: .github/build-ccid.sh ubuntu
- uses: actions/upload-artifact@v2
with:
name: ccid-emulator
path:
ccid/ccid-emulator*.tar.gz
pcsc-relay-macos:
runs-on: macos-11
steps:
- uses: actions/checkout@v2
- run: .github/build-pcsc-relay.sh macos
pcsc-relay-ubuntu:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- run: .github/build-pcsc-relay.sh ubuntu
- uses: actions/upload-artifact@v2
with:
name: pcsc-relay
path:
pcsc-relay/pcsc-relay*.tar.gz
# pcsc-relay-mingw-32:
# runs-on: ubuntu-20.04
# steps:
# - uses: actions/checkout@v2
# - run: .github/build-pcsc-relay.sh mingw-32
pcsc-relay-mingw-64:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- run: .github/build-pcsc-relay.sh mingw-64
- uses: actions/upload-artifact@v2
with:
name: pcsc-relay-mingw-64
path:
pcsc-relay/src/pcsc-relay.exe

22
.github/workflows/coverity.yml vendored Normal file
View File

@@ -0,0 +1,22 @@
name: Coverity Scan
# We only want to test master or explicitly via coverity branch
on:
push:
branches: [master, coverity]
jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- run: .github/build-virtualsmartcard.sh coverity
- run: .github/build-ccid.sh coverity
- run: .github/build-pcsc-relay.sh coverity
- uses: vapier/coverity-scan-action@v0
with:
project: frankmorgner%2Fvsmartcard
token: ${{ secrets.COVERITY_SCAN_TOKEN }}
email: 'frankmorgner@gmail.com'
command: 'make -C $GITHUB_WORKSPACE/virtualsmartcard; make -C $GITHUB_WORKSPACE/ccid; make -C $GITHUB_WORKSPACE/pcsc-relay'