Skip to content

Commit

Permalink
Merge pull request #8 from nawaz1991/7-feature-github-action-workflow…
Browse files Browse the repository at this point in the history
…s-need-to-update

Updated github actions, added cmake prests
  • Loading branch information
nawaz1991 authored Dec 5, 2023
2 parents 4f7791f + 94f118f commit a01dc9a
Show file tree
Hide file tree
Showing 23 changed files with 436 additions and 1,142 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/common-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Common build and test steps
on:
workflow_call:
inputs:
os:
required: true
type: string

jobs:
build-and-test:
runs-on: ${{ inputs.os }}
steps:
- name: Set EXT variable
shell: bash
run: |
if [[ "${{ runner.os }}" == "Windows" ]]; then
echo "EXT=.exe" >> $GITHUB_ENV
else
echo "EXT=" >> $GITHUB_ENV
fi
- name: Checkout cpp-oasvalidator
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0

- uses: lukka/get-cmake@latest

- name: Run CMake Ninja build all release preset including example, unittests, perftests
uses: lukka/run-cmake@v10
id: runcmake
with:
workflowPreset: 'build-example-and-run-unittests'

- name: Run Example
run: ./build/release/example/oasvalidator-example${{ env.EXT }}

- name: Run Unit Tests
run: ./build/release/test/unittest/oasvalidator-unittests${{ env.EXT }}

- name: Run Performance Tests
run: ./build/release/test/perftest/oasvalidator-perftests${{ env.EXT }}
82 changes: 82 additions & 0 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Deploy docs and code coverage
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build-and-deploy-docs-and-codecov:
runs-on: ubuntu-latest

steps:
- name: Checkout cpp-oasvalidator
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: Set up latest Oracle JDK 21
uses: oracle-actions/setup-java@v1
with:
website: oracle.com
release: 21

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install doxygen graphviz plantuml lcov -y
- name: Install python dependencies
run: |
pip3 install gcovr sphinx breathe exhale furo sphinx-plantuml
- uses: lukka/get-cmake@latest

- name: Configure code coverage code coverage and docs
uses: lukka/run-cmake@v10
with:
configurePreset: 'debug'

- name: Build performance tests in release mode
uses: lukka/run-cmake@v10
with:
configurePreset: 'release'
buildPreset: 'perftests-build'

- name: Run performance tests
run: build/release/test/perftest/oasvalidator-perftests --benchmark_format=json > build/debug/docs/benchmark.json

- name: Convert benchmark.json to benchmark.rst
run: python .github/workflows/convert_json_to_rst.py build/debug/docs/benchmark.json build/debug/docs/benchmark.rst

- name: Build docs and code coverage
uses: lukka/run-cmake@v10
with:
workflowPreset: 'build-docs-and-codecov'

- name: Copy code coverage to docs
run: cp -r build/debug/covhtml-oasvalidator build/debug/docs/html

- name: Deploy docs
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.MY_PAT }}
publish_dir: build/debug/docs/html

- name: Generate Coverage Report
if: github.ref == 'refs/heads/main'
run: |
lcov --capture --directory . --output-file coverage.info
lcov --remove coverage.info '/usr/*' --output-file coverage.info
lcov --list coverage.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
8 changes: 8 additions & 0 deletions .github/workflows/linux-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: Ubuntu build and test
on: [push, workflow_dispatch]

jobs:
linux-build-and-test:
uses: ./.github/workflows/common-build.yml
with:
os: ubuntu-latest
93 changes: 0 additions & 93 deletions .github/workflows/linux_build.yml

This file was deleted.

8 changes: 8 additions & 0 deletions .github/workflows/mac-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: Mac build and test
on: [push, workflow_dispatch]

jobs:
macos-build-and-test:
uses: ./.github/workflows/common-build.yml
with:
os: macos-latest
90 changes: 0 additions & 90 deletions .github/workflows/mac_build.yml

This file was deleted.

Loading

0 comments on commit a01dc9a

Please sign in to comment.