Skip to content

Commit

Permalink
ci: transition to GitHub-Actions from Travis-CI (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
almoghamdani authored Dec 28, 2022
1 parent 6761e12 commit 4e1f8e8
Show file tree
Hide file tree
Showing 8 changed files with 1,300 additions and 701 deletions.
99 changes: 99 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: Build

on:
workflow_call:
inputs:
deploy:
description: Whether to build for deployment + Deploy prebuilt binaries
required: false
type: boolean
default: false

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

strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
arch: [x64, ia32, arm64, arm]
include:
- os: ubuntu-latest
arch: x64
apt-arch: amd64
- os: ubuntu-latest
arch: arm64
apt-arch: arm64
toolchain-arch: aarch64
- os: ubuntu-latest
arch: arm
apt-arch: armhf
toolchain-arch: arm
gnu-name: gnueabihf
exclude:
- os: windows-latest
arch: arm64
- os: windows-latest
arch: arm
- os: ubuntu-latest
arch: ia32
- os: macos-latest
arch: ia32
- os: macos-latest
arch: arm

name: ${{ matrix.os }}-${{ matrix.arch }}

env:
CC: "${{ matrix.toolchain-arch && format('{0}-linux-{1}-gcc', matrix.toolchain-arch, matrix.gnu-name || 'gnu') || '' }}"
CXX: "${{ matrix.toolchain-arch && format('{0}-linux-{1}-g++', matrix.toolchain-arch, matrix.gnu-name || 'gnu') || '' }}"

steps:
- name: Check-Out Code
uses: actions/checkout@v3
with:
submodules: true

- name: Setup CMake/Ninja
uses: lukka/get-cmake@latest

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: lts/*

- name: Install Cross-Build Toolchain
uses: awalsh128/cache-apt-pkgs-action@latest
if: ${{ runner.os == 'Linux' && matrix.arch != 'x64' }}
with:
packages: crossbuild-essential-${{ matrix.apt-arch }}
version: 1.0

- name: Prepare Machine For Cross-Build
if: ${{ runner.os == 'Linux' && matrix.arch != 'x64' }}
run: |
sudo dpkg --add-architecture ${{ matrix.apt-arch }}
sudo sed -i 's#http://azure.archive.ubuntu.com/ubuntu#[arch=${{ matrix.apt-arch }}] http://ports.ubuntu.com/ubuntu-ports#g' /etc/apt/sources.list
sudo apt-get update -yq
- name: Install External Dependencies
if: runner.os == 'Linux'
run: sudo apt-get install libasound2:${{ matrix.apt-arch }} libasound2-dev:${{ matrix.apt-arch }} libpulse-dev:${{ matrix.apt-arch }}

- name: Install Audify Dependencies
run: npm ci --ignore-scripts

- name: Build Audify
if: ${{ !inputs.deploy }}
run: npm run rebuild -- --arch ${{ matrix.arch }}

- name: Upload Audify Binaries
if: ${{ !inputs.deploy }}
uses: actions/upload-artifact@v3
with:
name: audify-${{ github.sha }}-release-${{ matrix.os }}-${{ matrix.arch }}
path: build/Release/

- name: Build + Deploy Audify Prebuilt Binaries
if: ${{ inputs.deploy }}
run: npm run build-binaries -- -- -- --arch ${{ matrix.arch }}
21 changes: 21 additions & 0 deletions .github/workflows/commit-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Commit Build

on:
pull_request:
push:
branches:
- master
paths:
- "src/**"
- "vendor/**"
- ".gitmodules"
- "CMake**"
- "**.js"
- "**.ts"
- "package-lock.json"
- "tsconfig.json"
- "!docs/**"

jobs:
commit-build:
uses: ./.github/workflows/build.yml
12 changes: 12 additions & 0 deletions .github/workflows/deploy-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Build

on:
push:
tags:
- "v*"

jobs:
deploy-build:
uses: ./.github/workflows/build.yml
with:
deploy: true
38 changes: 38 additions & 0 deletions .github/workflows/regenerate-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Re-Generate Docs

on:
push:
branches:
- master
paths:
- "README.md"
- "**.d.ts"

jobs:
regenerate-docs:
runs-on: ubuntu-latest

steps:
- name: Check-Out Code
uses: actions/checkout@v3
with:
submodules: true

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: lts/*

- name: Install Audify Dependencies
run: npm ci --ignore-scripts

- name: Re-Generate Docs
run: |
rm -rf ./docs
npm run docs
- name: Commit Docs
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "chore: regenerate docs"
file_pattern: "docs"
67 changes: 0 additions & 67 deletions .travis.yml

This file was deleted.

Loading

0 comments on commit 4e1f8e8

Please sign in to comment.