Skip to content
Permalink
Browse files

Merge pull request #107 from nickelc/actions

GitHub Actions for CI and release
  • Loading branch information
Turupawn committed Dec 9, 2019
2 parents 3fc34d4 + 9651ada commit 291f1e5869210baedbb5447f8f7388f50ec93950
Showing with 460 additions and 0 deletions.
  1. +102 −0 .github/workflows/ci.yml
  2. +20 −0 .github/workflows/convert-docs.sh
  3. +10 −0 .github/workflows/readme.txt
  4. +259 −0 .github/workflows/release.yml
  5. +4 −0 .gitignore
  6. +1 −0 README.md
  7. +9 −0 book/book.toml
  8. +55 −0 book/linkfix.py
@@ -0,0 +1,102 @@
name: ci

on: [push, pull_request]

jobs:
build:
name: ${{ matrix.name }}

strategy:
fail-fast: true
matrix:
name:
- Ubuntu 16.04 GCC
- Ubuntu 16.04 Clang
- Ubuntu 18.04 GCC
- Ubuntu 18.04 Clang
- Windows 2019 MSVC
# - Windows 2019 GCC
- macOS 10.14 GCC
- macOS 10.14 Clang
include:
- name: Ubuntu 16.04 GCC
os: ubuntu-16.04
compiler: gcc
cpp-compiler: g++

- name: Ubuntu 16.04 Clang
os: ubuntu-16.04
compiler: clang
cpp-compiler: clang++
packages: llvm-3.5

- name: Ubuntu 18.04 GCC
os: ubuntu-18.04
compiler: gcc
cpp-compiler: g++

- name: Ubuntu 18.04 Clang
os: ubuntu-18.04
compiler: clang
cpp-compiler: clang++
packages: llvm-3.9

- name: Windows 2019 MSVC
os: windows-2019
compiler: cl
cmake-args: -DBUILD_SHARED_LIBS=OFF -Dgtest_force_shared_crt=on

# - name: Windows 2019 GCC
# os: windows-2019
# compiler: gcc
# cmake-args: -G Ninja
# packages: ninja

- name: macOS 10.14 GCC
os: macOS-10.14
compiler: gcc
cpp-compiler: g++

- name: macOS 10.14 Clang
os: macOS-10.14
compiler: clang
cpp-compiler: clang++

runs-on: ${{ matrix.os }}

steps:
- name: Install packages (Ubuntu)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install libcurl4-gnutls-dev ${{ matrix.packages }}
- name: Install packages (Windows)
if: runner.os == 'Windows' && matrix.packages
run: |
choco install ${{ matrix.packages }}
- name: Checkout
uses: actions/checkout@v1

- name: Generate project files
run: |
mkdir ${{ matrix.build-dir || '.not-used' }}
cd ${{ matrix.build-dir || '.' }}
cmake ${{ matrix.build-src-dir || '.' }} -Dtest=on ${{ matrix.cmake-args }}
env:
CC: ${{ matrix.compiler }}
CXX: ${{ matrix.cpp-compiler }}
CFLAGS: ${{ matrix.cflags || env.CFLAGS }}
CXXFLAGS: ${{ matrix.cxxflags || env.CXXFLAGS }}
LDFLAGS: ${{ matrix.ldflags || env.LDFLAGS }}

- name: Compile source code
run: |
cd ${{ matrix.build-src-dir || '.' }}
cmake --build . --config ${{ matrix.build-config || 'Release' }}
- name: Run test cases
run: |
cd ${{ matrix.build-dir || '.' }}
ctest -C ${{ matrix.build-config || 'Release' }} --output-on-failure
@@ -0,0 +1,20 @@
#!/usr/bin/env bash

WIKI_DIR=$1
EXPORT_DIR=$2
TOKEN=$3

for file in $WIKI_DIR/*.md; do
filename=$(basename "$file" .md)
grip "$file" --no-inline --export $EXPORT_DIR/"$filename.html" --pass=$TOKEN

for file2 in $WIKI_DIR/*.md; do
filename2=$(basename "$file2" .md)

filename_with_spaces=${filename2//-/ }

expression="s/\[\[$filename_with_spaces]]/<a href='$filename2.html'>$filename_with_spaces<\/a>/g"

sed -i -e "$expression" $EXPORT_DIR/"$filename.html"
done
done
@@ -0,0 +1,10 @@
Mod.io SDK
==========

Welcome to mod.io SDK, built using C++. It allows game developers to host and
automatically install user-created mods in their games. It connects to
the mod.io API, the documentation for its endpoints can be viewed here:
https://docs.mod.io

SDK repository and documentation can be viewed here:
https://sdk.mod.io
@@ -0,0 +1,259 @@
name: release

on:
release:
types: [published]

jobs:
build:
name: ${{ matrix.name }}

strategy:
matrix:
name:
- Ubuntu 18.04 GCC+libcurl-gnutls
- Ubuntu 18.04 GCC+libcurl-gnutls +static
- Windows 2019 MSVC win32
- Windows 2019 MSVC win32 +static
- Windows 2019 MSVC win64
- Windows 2019 MSVC win64 +static
- macOS 10.14 Clang
- macOS 10.14 Clang +static
include:
- name: Ubuntu 18.04 GCC+libcurl-gnutls
os: ubuntu-18.04
artifact-name: x86_64-linux-gnu

- name: Ubuntu 18.04 GCC+libcurl-gnutls +static
os: ubuntu-18.04
cmake-args: -DBUILD_SHARED_LIBS=OFF
artifact-name: x86_64-linux-gnu+static

- name: Windows 2019 MSVC win32
os: windows-2019
cmake-args: -A Win32
artifact-name: i686-windows-msvc

- name: Windows 2019 MSVC win32 +static
os: windows-2019
cmake-args: -A Win32 -DBUILD_SHARED_LIBS=OFF
artifact-name: i686-windows-msvc+static

- name: Windows 2019 MSVC win64
os: windows-2019
cmake-args: -A x64
artifact-name: x86_64-windows-msvc

- name: Windows 2019 MSVC win64 +static
os: windows-2019
cmake-args: -A x64 -DBUILD_SHARED_LIBS=OFF
artifact-name: x86_64-windows-msvc+static

- name: macOS 10.14 Clang
os: macOS-10.14
artifact-name: x86_64-apple-darwin

- name: macOS 10.14 Clang +static
os: macOS-10.14
cmake-args: -DBUILD_SHARED_LIBS=OFF
artifact-name: x86_64-apple-darwin+static

runs-on: ${{ matrix.os }}

steps:
- name: Install packages (Ubuntu)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install libcurl4-gnutls-dev
- name: Checkout
uses: actions/checkout@v1

- name: Generate project files
run: |
mkdir ${{ matrix.build-dir || '.not-used' }}
cd ${{ matrix.build-dir || '.' }}
cmake ${{ matrix.build-src-dir || '.' }} ${{ matrix.cmake-args }}
env:
CC: ${{ matrix.compiler }}
CFLAGS: ${{ matrix.cflags }}
LDFLAGS: ${{ matrix.ldflags }}

- name: Compile source code
run: |
cd ${{ matrix.build-src-dir || '.' }}
cmake --build . --config ${{ matrix.build-config || 'Release' }}
- name: Prepare artifact
if: runner.os == 'Linux' || runner.os == 'macOS'
shell: bash
run: |
mkdir Release
mv libmodio* Release
- name: Upload artifact
uses: actions/upload-artifact@v1
with:
name: ${{ matrix.artifact-name }}
path: Release

docs:
name: Generate docs.zip

runs-on: ubuntu-latest

steps:
- name: Install mdBook
uses: peaceiris/actions-mdbook@v1

- name: Checkout
uses: actions/checkout@v1

- name: Checkout wiki
uses: actions/checkout@v1
with:
repository: modio/SDK.wiki
ref: master

- name: Build
run: |
mkdir -p book/src
cp ../SDK.wiki/*.md book/src/
rename.ul '::' '__' book/src/*
cd book
cat src/_Sidebar.md | ./linkfix.py summary > src/SUMMARY.md
mdbook build -d docs
zip -r ../docs.zip docs/*
- name: Upload
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_name: docs.zip
asset_path: docs.zip
asset_content_type: application/zip

sdk:
name: Generate mod.io-sdk.zip
needs: build

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v1

- name: Download Linux
uses: actions/download-artifact@v1
with:
name: x86_64-linux-gnu
path: artifacts/x86_64-linux-gnu

- name: Download Linux +static
uses: actions/download-artifact@v1
with:
name: x86_64-linux-gnu+static
path: artifacts/x86_64-linux-gnu+static

- name: Download Win32
uses: actions/download-artifact@v1
with:
name: i686-windows-msvc
path: artifacts/i686-windows-msvc

- name: Download Win32 +static
uses: actions/download-artifact@v1
with:
name: i686-windows-msvc+static
path: artifacts/i686-windows-msvc+static

- name: Download Win64
uses: actions/download-artifact@v1
with:
name: x86_64-windows-msvc
path: artifacts/x86_64-windows-msvc

- name: Download Win64 +static
uses: actions/download-artifact@v1
with:
name: x86_64-windows-msvc+static
path: artifacts/x86_64-windows-msvc+static

- name: Download macOS
uses: actions/download-artifact@v1
with:
name: x86_64-apple-darwin
path: artifacts/x86_64-apple-darwin

- name: Download macOS +static
uses: actions/download-artifact@v1
with:
name: x86_64-apple-darwin+static
path: artifacts/x86_64-apple-darwin+static

- name: Build
id: build
run: |
tag=$(git describe --tags --abbrev=0)
package="mod.io-sdk-$tag"
# linux
mkdir -p "$package"/{lib,static}/linux/x64
mv artifacts/x86_64-linux-gnu/libmodio.so "$package/lib/linux/x64"
mv artifacts/x86_64-linux-gnu+static/libmodio.a "$package/static/linux/x64"
# win32 & win64
mkdir -p "$package"/{bin,lib,static}/msvc/{x86,x64}
mv artifacts/i686-windows-msvc/modio.dll "$package/bin/msvc/x86"
mv artifacts/i686-windows-msvc/modio.lib "$package/lib/msvc/x86"
mv artifacts/i686-windows-msvc+static/modio.lib "$package/static/msvc/x86"
mv artifacts/x86_64-windows-msvc/modio.dll "$package/bin/msvc/x64"
mv artifacts/x86_64-windows-msvc/modio.lib "$package/lib/msvc/x64"
mv artifacts/x86_64-windows-msvc+static/modio.lib "$package/static/msvc/x64"
# macOS
mkdir -p "$package"/{lib,static}/macOS/x64
mv artifacts/x86_64-apple-darwin/libmodio.dylib "$package/lib/macOS/x64"
mv artifacts/x86_64-apple-darwin+static/libmodio.a "$package/static/macOS/x64"
mv additional_dependencies "$package"
mv include "$package"
mv LICENSE "$package/License.txt"
cp .github/workflows/readme.txt "$package/Readme.txt"
zip -r "$package.zip" "$package"/*
echo "::set-output name=asset_name::$package.zip"
echo "::set-output name=asset_path::$package.zip"
- name: Checksum
run: |
checksum=$(shasum -ba 256 ${{ steps.build.outputs.asset_path }} | cut -d ' ' -f 1)
echo "Checksum for ${{ steps.build.outputs.asset_name }}: $checksum"
echo -n $checksum > ${{ steps.build.outputs.asset_path }}.sha256
- name: Upload
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_name: ${{ steps.build.outputs.asset_name }}
asset_path: ${{ steps.build.outputs.asset_path }}
asset_content_type: application/zip

- name: Upload checksum
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_name: ${{ steps.build.outputs.asset_name }}.sha256
asset_path: ${{ steps.build.outputs.asset_path }}.sha256
asset_content_type: text/plain

0 comments on commit 291f1e5

Please sign in to comment.
You can’t perform that action at this time.