Fix #108 #194
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Funcheck - A tool for checking functions calls return protections | |
# Copyright (C) 2023 Theo Matis | |
# | |
# This program is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or | |
# (at your option) any later version. | |
# | |
# This program is distributed in the hope that it will be useful, | |
# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
# GNU General Public License for more details. | |
# | |
# You should have received a copy of the GNU General Public License | |
# along with this program. If not, see <https://www.gnu.org/licenses/>. | |
# | |
name: Build & test | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
release: | |
types: [published] | |
# compile library keep the output | |
# compile host and keep the output | |
# run the tests using the host and library | |
# do it in separate jobs so that we can see the output of each | |
# keep it in cache | |
jobs: | |
build-libfuncheck: | |
name: Build libfuncheck | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Make lib | |
run: make -C library | |
- name: Upload libfuncheck.so | |
uses: actions/upload-artifact@v3 | |
with: | |
name: libfuncheck.so | |
path: library/libfuncheck.so | |
build-funcheck: | |
name: Build funcheck | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Make host | |
run: make -C host | |
- name: Upload funcheck | |
uses: actions/upload-artifact@v3 | |
with: | |
name: funcheck | |
path: host/funcheck | |
test: | |
name: Run tests | |
runs-on: ubuntu-latest | |
needs: [build-libfuncheck, build-funcheck] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get libfuncheck.so | |
uses: actions/download-artifact@v3 | |
with: | |
name: libfuncheck.so | |
path: library | |
- name: Get funcheck | |
uses: actions/download-artifact@v3 | |
with: | |
name: funcheck | |
path: host | |
- name: enable execution | |
run: chmod +x host/funcheck | |
- name: Setup node 19.7 | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '19.7' | |
- name: install llvm | |
run: sudo apt-get install llvm | |
- name: Install yarn | |
run: npm install -g yarn | |
- name: Install dependencies | |
uses: borales/actions-yarn@v4 | |
with: | |
cmd: install | |
dir: 'e2e' | |
- name: Run tests | |
uses: borales/actions-yarn@v4 | |
with: | |
cmd: test | |
dir: 'e2e' | |
release: | |
name: Publish artifacts | |
runs-on: ubuntu-latest | |
needs: [test] | |
if: github.event_name == 'release' | |
# content write and read are needed for the changelog | |
permissions: | |
contents: write | |
pull-requests: read | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get libfuncheck.so | |
uses: actions/download-artifact@v3 | |
with: | |
name: libfuncheck.so | |
path: library | |
- name: Get funcheck | |
uses: actions/download-artifact@v3 | |
with: | |
name: funcheck | |
path: host | |
- name: upload libfuncheck.so | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: library/libfuncheck.so | |
asset_name: libfuncheck.so | |
tag: ${{ github.ref }} | |
overwrite: true | |
- name: upload funcheck | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: host/funcheck | |
asset_name: funcheck | |
tag: ${{ github.ref }} | |
overwrite: true |