mirror of https://github.com/nirenjan/libx52.git
Add CI using Github Actions
This commit adds workflows to handle the continuous integration builds as well as the CodeQL analysis on each push. This also adds a workflow to create a release and upload the orig.tar.gz file when pushing a tag.pull/26/head
parent
4f39078998
commit
1119fe3373
|
@ -0,0 +1,11 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# Run the build and tests
|
||||||
|
set -e
|
||||||
|
|
||||||
|
./autogen.sh
|
||||||
|
mkdir build
|
||||||
|
cd build
|
||||||
|
../configure
|
||||||
|
make -j V=0
|
||||||
|
make -j check V=0
|
||||||
|
make -j distcheck
|
|
@ -0,0 +1,16 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# Install dependencies to build and test on Ubuntu runners
|
||||||
|
brew install \
|
||||||
|
autoconf \
|
||||||
|
automake \
|
||||||
|
libtool \
|
||||||
|
pkg-config \
|
||||||
|
python3 \
|
||||||
|
gettext \
|
||||||
|
libusb \
|
||||||
|
hidapi \
|
||||||
|
doxygen \
|
||||||
|
rsync \
|
||||||
|
cmocka
|
||||||
|
|
||||||
|
exit 0
|
|
@ -0,0 +1,20 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# Install dependencies to build and test on Ubuntu runners
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y \
|
||||||
|
autoconf \
|
||||||
|
automake \
|
||||||
|
libtool \
|
||||||
|
pkg-config \
|
||||||
|
python3 \
|
||||||
|
gettext \
|
||||||
|
autopoint \
|
||||||
|
libusb-1.0-0-dev \
|
||||||
|
libhidapi-dev \
|
||||||
|
libevdev-dev \
|
||||||
|
doxygen \
|
||||||
|
rsync \
|
||||||
|
libcmocka-dev \
|
||||||
|
faketime
|
||||||
|
|
||||||
|
exit 0
|
|
@ -0,0 +1,37 @@
|
||||||
|
name: Build/Test
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- '*'
|
||||||
|
- '!gh-pages'
|
||||||
|
pull_request:
|
||||||
|
branches: [ master ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: ${{ join(matrix.*, '/') }}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
continue-on-error: ${{ matrix.os == 'macos-latest' }}
|
||||||
|
env:
|
||||||
|
CC: ${{ matrix.cc }}
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: ['ubuntu-16.04', 'ubuntu-18.04', 'ubuntu-20.04', 'macos-latest']
|
||||||
|
cc: ['gcc', 'clang']
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Install dependencies (Ubuntu)
|
||||||
|
run: ./.github/scripts/install-dependencies-ubuntu.sh
|
||||||
|
if: ${{ matrix.os != 'macos-latest' }}
|
||||||
|
|
||||||
|
- name: Install dependencies (MacOS)
|
||||||
|
run: ./.github/scripts/install-dependencies-macos.sh
|
||||||
|
if: ${{ matrix.os == 'macos-latest' }}
|
||||||
|
|
||||||
|
- name: Build and Test
|
||||||
|
run: ./.github/scripts/build-and-test.sh
|
|
@ -0,0 +1,57 @@
|
||||||
|
name: "CodeQL"
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: ['*', '!gh-pages']
|
||||||
|
pull_request:
|
||||||
|
# The branches below must be a subset of the branches above
|
||||||
|
branches: [master]
|
||||||
|
schedule:
|
||||||
|
- cron: '0 7 * * 1'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
analyse:
|
||||||
|
name: Analyse
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
# We must fetch at least the immediate parents so that if this is
|
||||||
|
# a pull request then we can checkout the head.
|
||||||
|
fetch-depth: 2
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: ./.github/scripts/install-dependencies-ubuntu.sh
|
||||||
|
|
||||||
|
# If this run was triggered by a pull request event, then checkout
|
||||||
|
# the head of the pull request instead of the merge commit.
|
||||||
|
- run: git checkout HEAD^2
|
||||||
|
if: ${{ github.event_name == 'pull_request' }}
|
||||||
|
|
||||||
|
# Initializes the CodeQL tools for scanning.
|
||||||
|
- name: Initialize CodeQL
|
||||||
|
uses: github/codeql-action/init@v1
|
||||||
|
# Override language selection by uncommenting this and choosing your languages
|
||||||
|
# with:
|
||||||
|
# languages: go, javascript, csharp, python, cpp, java
|
||||||
|
|
||||||
|
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||||
|
# If this step fails, then you should remove it and run the build manually (see below)
|
||||||
|
- name: Autobuild
|
||||||
|
uses: github/codeql-action/autobuild@v1
|
||||||
|
|
||||||
|
# ℹ️ Command-line programs to run using the OS shell.
|
||||||
|
# 📚 https://git.io/JvXDl
|
||||||
|
|
||||||
|
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
||||||
|
# and modify them (or add more) to build your code if your project
|
||||||
|
# uses a compiled language
|
||||||
|
|
||||||
|
#- run: |
|
||||||
|
# make bootstrap
|
||||||
|
# make release
|
||||||
|
|
||||||
|
- name: Perform CodeQL Analysis
|
||||||
|
uses: github/codeql-action/analyze@v1
|
|
@ -0,0 +1,48 @@
|
||||||
|
name: Create Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Upload Release Asset
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: ./.github/scripts/install-dependencies-ubuntu.sh
|
||||||
|
|
||||||
|
- name: Build project
|
||||||
|
run: ./.github/scripts/build-and-test.sh
|
||||||
|
|
||||||
|
- name: Find release tarball
|
||||||
|
id: find_release
|
||||||
|
run: |
|
||||||
|
echo "::set-output name=path::$(find $PWD -name 'x52pro-linux*.tar*')"
|
||||||
|
echo "::set-output name=asset::$(find . -name 'x52pro-linux*.tar*' -exec basename {} \; | sed 's/x52pro-linux-\(.*\)\.tar/x52pro-linux_\1.orig.tar/')"
|
||||||
|
|
||||||
|
- name: Create Release
|
||||||
|
id: create_release
|
||||||
|
uses: actions/create-release@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
tag_name: ${{ github.ref }}
|
||||||
|
release_name: Release ${{ github.ref }}
|
||||||
|
draft: false
|
||||||
|
prerelease: false
|
||||||
|
|
||||||
|
- name: Upload Release Tarball
|
||||||
|
id: upload-release-tarball
|
||||||
|
uses: actions/upload-release-asset@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||||
|
asset_path: ${{ steps.find_release.outputs.path }}
|
||||||
|
asset_name: ${{ steps.find_release.outputs.asset }}
|
||||||
|
asset_content_type: application/gzip
|
Loading…
Reference in New Issue