Skip to content

Commit

Permalink
build and release on tag or mainline
Browse files Browse the repository at this point in the history
  • Loading branch information
airtonix committed Dec 27, 2022
1 parent fab3e22 commit 5f7e200
Show file tree
Hide file tree
Showing 9 changed files with 384 additions and 54 deletions.
31 changes: 31 additions & 0 deletions .github/actions/compile-unix/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
name: Compile Unix Library

description: |
Prepare and compile unix builds
inputs:
compiler:
required: true
description: Compiler to use

runs:
using: composite
steps:

- name: Prepare
env:
CC: ${{ inputs.compiler }}
shell: bash
run: |
cc --version
git clone https://github.com/Conni2461/examiner
cd examiner
make && sudo make install
- name: Build
env:
CC: ${{ inputs.compiler }}
LD_LIBRARY_PATH: /usr/lib:/usr/local/lib
shell: bash
run: make
22 changes: 22 additions & 0 deletions .github/actions/compile-windows/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: Compile windows library

description: |
Prepare and compile a windows build
runs:

using: composite

steps:
- uses: lukka/get-cmake@latest

- name: Build
# powershell 7 is part of the 2019 toolset:
# https://github.com/actions/runner-images/blob/win19/20221214.4/images/win/Windows2019-Readme.md
shell: pwsh
run: |
cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release
cmake --build build --config Release
cmake --install build --prefix build
51 changes: 51 additions & 0 deletions .github/actions/nvim-unix-test/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
name: Test Unix Library

description: |
Run some neovim tests
inputs:
os:
required: true
description: OS being tested
url:
required: true
description: OS being tested

runs:
using: composite
steps:

- name: create cache key
shell: bash
run: date +%F > todays-date

- name: Restore cache for today's nightly.
uses: actions/cache@v2
with:
path: _neovim
key: ${{ inputs.os }}-${{ hashFiles('todays-date') }}

- name: Prepare
shell: bash
run: |
test -d _neovim || {
mkdir -p _neovim
curl -sL ${{ inputs.url }} | tar xzf - --strip-components=1 -C "${PWD}/_neovim"
}
mkdir -p ~/.local/share/nvim/site/pack/vendor/start
git clone --depth 1 https://github.com/nvim-lua/plenary.nvim ~/.local/share/nvim/site/pack/vendor/start/plenary.nvim
ln -s $(pwd) ~/.local/share/nvim/site/pack/vendor/start
- name: Build
shell: bash
run: make

- name: Tests
shell: bash
run: |
export PATH="${PWD}/_neovim/bin:${PATH}"
export VIM="${PWD}/_neovim/share/nvim/runtime"
nvim --version
make ntest
44 changes: 44 additions & 0 deletions .github/actions/prepare-artifacts/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
name: Prepare artifacts

description: |
Downloads all prior artifacts into a directory.
each artifact will be in its own directory named after the
job that uploaded it.
outputs:
staging_area:
description: Area in which artifacts from prior jobs are collated
value: ${{ steps.directories.outputs.staging_area }}

runs:
using: composite
steps:

- name: Prepare Staging Area
shell: bash
id: directories
run: |
echo "staging_area=$(mktemp -d)" >> $GITHUB_OUTPUT
echo "artifacts=$(mktemp -d)" >> $GITHUB_OUTPUT
- name: Download artifact
uses: actions/download-artifact@v2
with:
path: ${{ steps.directories.outputs.artifacts }}

- name: Prepare Release
env:
STAGING: ${{ steps.directories.outputs.staging_area }}
ARTIFACTS: ${{ steps.directories.outputs.artifacts }}
shell: bash
run: |
for file in ${ARTIFACTS}/**/*; do
FILENAME=$(basename $file)
PLATFORM=$(basename $(dirname $file))
cp $file "${STAGING}/${PLATFORM}-${FILENAME}"
done
ls -al ${STAGING}/*
86 changes: 86 additions & 0 deletions .github/actions/release-binaries/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
---
name: Create binary release

description: |
Takes artifacts in a source directory and creates a release
inputs:

source:
required: true
description: source directory

is_development_release:
description: Is this a dev release?
default: 'true'

is_production_release:
description: Is this a prod release?
default: 'false'

development_title:
description: Title of the release when it is a development release
required: true

development_tag:
description: Name of the tag when it is a development release
required: true

production_title:
description: Title of the release when it is a production release
required: true

production_tag:
description: Name of the tag when it is a production release
required: true

runs:
using: composite

steps:

# Development Release
#
# If workflow runs because commits are pushd to the mainline
# branch, then it's assumed to be a development release.
#
# There's only ever one "development" release, whatever is the latest
# changes to `main`.
#
# For version release, see below "Production Release"
#
- uses: ncipollo/release-action@v1
name: Release Development
if: ${{ inputs.is_development_release == 'true' }}
with:
name: ${{ inputs.development_title }}
tag: ${{ inputs.development_tag }}
omitBody: true
omitBodyDuringUpdate: false
allowUpdates: true
makeLatest: false
prerelease: true
removeArtifacts: true
replacesArtifacts: true
artifacts: ${{ inputs.source }}/*
commit: ${{ github.sha }}


# Production Release
#
# If the workflow runs because a tag was pushed, then this is considered
# a production release.
#
- uses: ncipollo/release-action@v1
name: Release Tag
if: ${{ inputs.is_production_release == 'true' }}
with:
name: ${{ inputs.production_title }}
tag: ${{ inputs.production_tag }}
omitBody: true
allowUpdates: true
makeLatest: true
removeArtifacts: true
replacesArtifacts: true
artifacts: ${{ inputs.source }}/*
commit: ${{ github.sha }}
26 changes: 26 additions & 0 deletions .github/actions/test-unix/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
name: Test unix library

description: |
Compile and test a unix build
inputs:
compiler:
required: true
description: Compiler to use


runs:
using: composite
steps:
- uses: ./.github/actions/compile-unix
with:
compiler: ${{ inputs.compiler }}

- name: Tests
env:
CC: ${{ inputs.compiler }}
LD_LIBRARY_PATH: /usr/lib:/usr/local/lib
shell: bash
run: make test

71 changes: 20 additions & 51 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@ name: CI

on: [push, pull_request]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true


jobs:
gcc:
name: c build and tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
Expand All @@ -17,42 +21,23 @@ jobs:
compiler: gcc
- os: macos-10.15
compiler: clang

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Prepare
env:
CC: ${{ matrix.compiler }}
run: |
cc --version
git clone https://github.com/Conni2461/examiner
cd examiner
make && sudo make install
- name: Build
env:
CC: ${{ matrix.compiler }}
LD_LIBRARY_PATH: /usr/lib:/usr/local/lib
run: make
- name: Tests
env:
CC: ${{ matrix.compiler }}
LD_LIBRARY_PATH: /usr/lib:/usr/local/lib
run: make test
- uses: actions/checkout@v3
- uses: ./.github/actions/test-unix
with:
compiler: ${{ matrix.compiler }}

windows:
name: windows
runs-on: windows-2019
steps:
- uses: actions/checkout@v2
- uses: lukka/get-cmake@latest
- name: Build
run: |
cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release
cmake --build build --config Release
cmake --install build --prefix build
- uses: actions/checkout@v3
- uses: ./.github/actions/compile-windows

nvim-tests:
name: nvim-tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, macos-10.15]
Expand All @@ -61,28 +46,12 @@ jobs:
url: https://github.com/neovim/neovim/releases/download/nightly/nvim-linux64.tar.gz
- os: macos-10.15
url: https://github.com/neovim/neovim/releases/download/nightly/nvim-macos.tar.gz

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- run: date +%F > todays-date
- name: Restore cache for today's nightly.
uses: actions/cache@v2
- uses: actions/checkout@v3
- uses: ./.github/actions/nvim-unix-test
with:
path: _neovim
key: ${{ matrix.os }}-${{ hashFiles('todays-date') }}
- name: Prepare
run: |
test -d _neovim || {
mkdir -p _neovim
curl -sL ${{ matrix.url }} | tar xzf - --strip-components=1 -C "${PWD}/_neovim"
}
mkdir -p ~/.local/share/nvim/site/pack/vendor/start
git clone --depth 1 https://github.com/nvim-lua/plenary.nvim ~/.local/share/nvim/site/pack/vendor/start/plenary.nvim
ln -s $(pwd) ~/.local/share/nvim/site/pack/vendor/start
- name: Build
run: make
- name: Tests
run: |
export PATH="${PWD}/_neovim/bin:${PATH}"
export VIM="${PWD}/_neovim/share/nvim/runtime"
nvim --version
make ntest
os: ${{ matrix.os }}
url: ${{ matrix.url }}

Loading

0 comments on commit 5f7e200

Please sign in to comment.