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

Add Github Action to test recipes #42

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
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
94 changes: 94 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
on:
push:
branches:
- master
pull_request:
workflow_dispatch:
inputs:
recipes:
description: "Which recipes to build, takes precedent"
all:
description: "Build all recipes"
type: boolean
default: false

permissions:
contents: read

name: Cook recipes

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

name: ${{ matrix.os }} build

env:
CC: clang
CXX: clang++
OBJC: clang
OBJCXX: clang++

strategy:
matrix:
os: [ 'macos-11' ]

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # default is 1
ref: "${{ github.ref }}"

- name: Find changed recipes
id: find
shell: bash
run: |
ref="${{ github.ref_name == 'master' && 'HEAD~1' || 'origin/master' }}"
if [ "${{ inputs.all }}" = true ]; then
files=`ls -d recipes/*`
else
files=`git diff --name-only $ref`
fi

recipes=$(echo $files |
tr ' ' '\n' |
grep 'recipes/[^\.]*$' |
sed 's|recipes/\(.*\)|\1|g' |
tr '\n' ' ')

echo $recipes
if [ ! -z "$recipes" ]; then
echo "recipes=$recipes">> $GITHUB_OUTPUT
fi

- name: Create Makefile
run: Rscript scripts/mkmk.R

- name: Remove local stuff
run: |
sudo mkdir /usr/local/.disabled
sudo mv /usr/local/* /usr/local/.disabled/

- name: Build tools
run: |
make -C build pkgconfig

- name: Stubs
run: |
sudo mkdir -p /usr/local/lib/pkgconfig
sudo cp stubs/pkgconfig-darwin/*.pc /usr/local/lib/pkgconfig/

- name: Build R dependencies
if: success() && (inputs.recipes || steps.find.outputs.recipes)
run: make -C build ${{ inputs.recipes || steps.find.outputs.recipes }}

- name: Collect
if: success() && (inputs.recipes || steps.find.outputs.recipes)
run: mkdir deploy && cp -p build/*-darwin*.tar.gz deploy/

- name: Upload
if: success() && (inputs.recipes || steps.find.outputs.recipes)
uses: actions/upload-artifact@master
with:
name: recipes-build
path: deploy