Skip to content

Commit

Permalink
Setup GitHub Actions
Browse files Browse the repository at this point in the history
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
  • Loading branch information
jviotti committed Feb 13, 2024
1 parent aeaaf14 commit e457c6a
Show file tree
Hide file tree
Showing 3 changed files with 138 additions and 0 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: IncludeJS

on:
push:

jobs:
test:
strategy:
fail-fast: false
matrix:
platform:
- os: macos-latest
cc: clang
cxx: clang++
type: static
- os: macos-latest
cc: clang
cxx: clang++
type: shared

# TODO: Build with sanitizers

runs-on: ${{ matrix.platform.os }}
env:
CC: ${{ matrix.platform.cc }}
CXX: ${{ matrix.platform.cxx }}
steps:
- uses: actions/checkout@v4
- name: Install dependencies (macOS)
if: runner.os == 'macos'
run: brew bundle
env:
HOMEBREW_NO_ANALYTICS: 1
HOMEBREW_NO_AUTO_UPDATE: 1
- run: cmake --version
- name: Configure IncludeJS (static)
if: matrix.platform.type == 'static'
run: >
cmake -S . -B ./build
-DCMAKE_BUILD_TYPE:STRING=Release
-DINCLUDEJS_TESTS:BOOL=ON
-DINCLUDEJS_DOCS:BOOL=OFF
-DBUILD_SHARED_LIBS:BOOL=OFF
-DCMAKE_COMPILE_WARNING_AS_ERROR:BOOL=ON
${{ matrix.platform.options }}
- name: Configure IncludeJS (shared)
if: matrix.platform.type == 'shared'
run: >
cmake -S . -B ./build
-DCMAKE_BUILD_TYPE:STRING=Release
-DINCLUDEJS_TESTS:BOOL=ON
-DINCLUDEJS_DOCS:BOOL=OFF
-DBUILD_SHARED_LIBS:BOOL=ON
-DCMAKE_COMPILE_WARNING_AS_ERROR:BOOL=ON
${{ matrix.platform.options }}
- run: cmake --build ./build --config Release --target clang_format_test
- run: cmake --build ./build --config Release --parallel 4
- run: >
cmake --install ./build --prefix ./build/dist --config Release --verbose
--component sourcemeta_includejs
- run: >
cmake --install ./build --prefix ./build/dist --config Release --verbose
--component sourcemeta_includejs_dev
# Not every CTest version supports the --test-dir option. If such option
# is not recognized, `ctest` will successfully exit finding no tests.
# Better to be sure and `cd` all the time here.
- run: cd ./build && ctest --build-config Release --output-on-failure --parallel
env:
# See https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html
UBSAN_OPTIONS: print_stacktrace=1
25 changes: 25 additions & 0 deletions .github/workflows/website-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: website
on:
push:
branches-ignore:
- main

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

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- run: sudo apt update
- run: sudo apt install -y doxygen
- run: >
cmake -S . -B ./build
-DCMAKE_BUILD_TYPE:STRING=Release
-DINCLUDEJS_ENGINE:BOOL=OFF
-DINCLUDEJS_TESTS:BOOL=OFF
-DINCLUDEJS_DOCS:BOOL=ON
- run: cmake --build ./build --config Release --target doxygen
42 changes: 42 additions & 0 deletions .github/workflows/website-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: website
on:
push:
branches: [ "main" ]
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

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

jobs:
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- run: sudo apt update
- run: sudo apt install -y doxygen
- run: >
cmake -S . -B ./build
-DCMAKE_BUILD_TYPE:STRING=Release
-DINCLUDEJS_ENGINE:BOOL=OFF
-DINCLUDEJS_TESTS:BOOL=OFF
-DINCLUDEJS_DOCS:BOOL=ON
- run: cmake --build ./build --config Release --target doxygen
- name: Setup Pages
uses: actions/configure-pages@v1
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: ./build/website
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2

0 comments on commit e457c6a

Please sign in to comment.