Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
sksat committed Jan 25, 2023
0 parents commit 3dc4d63
Show file tree
Hide file tree
Showing 5 changed files with 394 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/actionlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: actionlint

on:
pull_request:
paths:
- '.github/workflows/**'

jobs:
actionlint:
name: actionlint with reviewdog
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: actionlint
uses: reviewdog/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-pr-review
39 changes: 39 additions & 0 deletions .github/workflows/c2a-build-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Test c2a-build workflow

permissions:
id-token: write
contents: read

on:
push:
branches:
- main
pull_request:
paths:
- '.github/workflows/c2a-build*.yml'

jobs:
test_c2a_build:
name: test c2a-build
uses: ./.github/workflows/c2a-build.yml
with:
c2a_repo: ut-issl/c2a-core
c2a_dir: Examples/minimum_user
c2a_custom_setup: |
cd $GITHUB_WORKSPACE
ls -l
cd ./repo
pwd
ls -l
if [ $RUNNER_OS = 'Windows' ]; then
cmd "/C setup.bat"
else
./setup.sh
fi
cmake_generator_linux32: Ninja
cmake_generator_win32: Ninja
cmake_flags_linux32: -DUSE_SCI_COM_WINGS=OFF
sils_mockup: true
build_as_cxx: true
reviewdog_default_reporter: github-check
reviewdog_default_filter: added
293 changes: 293 additions & 0 deletions .github/workflows/c2a-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,293 @@
name: Build

on:
workflow_call:
inputs:
c2a_repo:
type: string
default: ${{ github.repository }}
c2a_dir:
type: string
default: '.'
c2a_custom_setup:
type: string
default: ''
sils_mockup:
type: boolean
default: true
build_as_cxx:
type: boolean
default: true
cmake_generator_linux32:
type: string
default: 'Unix Makefiles'
cmake_generator_win32:
type: string
default: 'Visual Studio 17 2022'
cmake_flags:
type: string
default: ''
# job specific CMake flags
cmake_flags_linux32:
type: string
default: ''
cmake_flags_linux32_cxx:
type: string
default: ''
cmake_flags_win32:
type: string
default: ''
cmake_flags_win32_cxx:
type: string
default: ''
# reviewdog
reviewdog_default_reporter:
type: string
default: github-pr-review
reviewdog_default_filter:
type: string
default: added

defaults:
run:
working-directory: ./c2a_user

jobs:
build_linux32:
name: Build for linux32
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
compiler: [gcc, clang]
warning: [Werror, Wextra]
exclude:
- compiler: gcc
warning: Werror

steps:
- uses: actions/checkout@v3
if: inputs.c2a_dir == '.'
with:
path: ./c2a_user
repository: ${{ inputs.c2a_repo }}
submodules: 'recursive'
- uses: actions/checkout@v3
if: inputs.c2a_dir != '.'
with:
path: ./repo
repository: ${{ inputs.c2a_repo }}
submodules: 'recursive'
- name: Link C2A user dir to ./c2a_user
working-directory: .
if: inputs.c2a_dir != '.'
run: ln -s ./repo/${{ inputs.c2a_dir }} ./c2a_user

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y ninja-build libc6-dev-i386
- name: Check setup script exist
id: check_setup
continue-on-error: true
shell: bash
run: test -f setup.sh

- name: Setup
if: steps.check_setup.outcome == 'success'
run: ./setup.sh

- name: Custom Setup
if: inputs.c2a_custom_setup != ''
shell: bash
run: ${{ inputs.c2a_custom_setup }}

- name: CMake
env:
CC: ${{ matrix.compiler }}
run: |
cmake -B ./build \
-G "${{ inputs.cmake_generator_linux32 }}" \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DADD_WEXTRA_FLAGS=${{ contains(matrix.warning, 'Wextra') }} \
-DADD_WERROR_FLAGS=${{ contains(matrix.warning, 'Werror') }} \
${{ (inputs.sils_mockup && '-DUSE_SILS_MOCKUP=ON') || '' }} \
${{ inputs.cmake_flags }} ${{ inputs.cmake_flags_linux32 }}
- name: reviewdog with clang-tidy -${{ matrix.warning }}
if: matrix.compiler == 'clang'
uses: arkedge/[email protected]
with:
tool_name: clang-tidy -${{ matrix.warning }}
reporter: ${{ (!contains(matrix.warning, 'Wextra') && inputs.reviewdog_default_reporter ) || 'github-check' }}
filter_mode: ${{ (!contains(matrix.warning, 'Wextra') && inputs.reviewdog_default_filter ) || 'nofilter' }}
workdir: ./c2a_user/build

- name: Build
run: cmake --build ./build

- name: Run executable by SILS mockup
if: inputs.sils_mockup
run: |
ls -lh ./build/C2A
timeout 3 ./build/C2A || exit 0
build_linux32_cxx:
if: inputs.build_as_cxx
name: Build as C++ for linux32
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
if: inputs.c2a_dir == '.'
with:
path: ./c2a_user
repository: ${{ inputs.c2a_repo }}
submodules: 'recursive'
- uses: actions/checkout@v3
if: inputs.c2a_dir != '.'
with:
path: ./repo
repository: ${{ inputs.c2a_repo }}
submodules: 'recursive'
- name: Link C2A user dir to ./c2a_user
working-directory: .
if: inputs.c2a_dir != '.'
run: ln -s ./repo/${{ inputs.c2a_dir }} ./c2a_user

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y ninja-build libc6-dev-i386 g++-multilib
- name: Check setup script exist
id: check_setup
continue-on-error: true
shell: bash
run: test -f setup.sh

- name: Setup
if: steps.check_setup.outcome == 'success'
run: ./setup.sh

- name: Custom Setup
if: inputs.c2a_custom_setup != ''
shell: bash
run: ${{ inputs.c2a_custom_setup }}

- name: CMake
env:
CC: clang
CXX: clang++
# ignore windows.h
run: |
cmake -B ./build \
-G "${{ inputs.cmake_generator_linux32 }}" \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DBUILD_C2A_AS_CXX=ON \
-DUSE_SCI_COM_WINGS=OFF \
${{ inputs.cmake_flags }} ${{ inputs.cmake_flags_linux32_cxx }}
- name: Build
run: cmake --build ./build

build_win32:
name: Build for Win32 by MSVC
runs-on: windows-latest

steps:
- uses: actions/checkout@v3
if: inputs.c2a_dir == '.'
with:
path: ./c2a_user
repository: ${{ inputs.c2a_repo }}
submodules: 'recursive'
- uses: actions/checkout@v3
if: inputs.c2a_dir != '.'
with:
path: ./repo
repository: ${{ inputs.c2a_repo }}
submodules: 'recursive'
- name: Link C2A user dir to ./c2a_user
working-directory: .
if: inputs.c2a_dir != '.'
shell: cmd
run: mklink /j /d ".\\c2a_user" ".\\repo\\${{ inputs.c2a_dir }}"

- name: Check setup script exist
id: check_setup
continue-on-error: true
shell: bash
run: test -f setup.bat

- name: Setup
if: steps.check_setup.outcome == 'success'
shell: cmd
run: ./setup.bat

- name: Custom Setup
if: inputs.c2a_custom_setup != ''
shell: bash
run: ${{ inputs.c2a_custom_setup }}

- name: CMake
shell: bash
run: |
cmake -B ./build \
-G "${{ inputs.cmake_generator_win32 }}" \
${{ inputs.cmake_flags }} ${{ inputs.cmake_flags_win32 }}
- name: Build
run: cmake --build ./build

build_win32_cxx:
if: inputs.build_as_cxx
name: Build as C++ for Win32 by MSVC++
runs-on: windows-latest

steps:
- uses: actions/checkout@v3
if: inputs.c2a_dir == '.'
with:
path: ./c2a_user
repository: ${{ inputs.c2a_repo }}
submodules: 'recursive'
- uses: actions/checkout@v3
if: inputs.c2a_dir != '.'
with:
path: ./repo
repository: ${{ inputs.c2a_repo }}
submodules: 'recursive'
- name: Link C2A user dir to ./c2a_user
working-directory: .
if: inputs.c2a_dir != '.'
shell: cmd
run: mklink /j /d ".\\c2a_user" ".\\repo\\${{ inputs.c2a_dir }}"

- name: Check setup script exist
id: check_setup
continue-on-error: true
shell: bash
run: test -f setup.bat

- name: Setup
if: steps.check_setup.outcome == 'success'
shell: cmd
run: ./setup.bat

- name: Custom Setup
if: inputs.c2a_custom_setup != ''
shell: bash
run: ${{ inputs.c2a_custom_setup }}

- name: CMake
shell: bash
run: |
cmake -B ./build \
-G "${{ inputs.cmake_generator_win32 }}" \
-DBUILD_C2A_AS_CXX=ON \
${{ inputs.cmake_flags }} ${{ inputs.cmake_flags_win32_cxx }}
- name: Build
run: cmake --build ./build
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 ArkEdge Space Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# workflows-c2a

Common GitHub Actions workflows for [C2A](https://github.com/ut-issl/c2a-core).

## Example Usage

- [c2a-build](./.github/workflows/c2a-build.yml)
This workflow build C2A on some environments (C, C++, Linux, Windows) and show warnings by [action-clang-tidy](https://github.com/arkedge/action-clang-tidy/).
```yml
name: Build C2A

on:
push:
branches:
- main
- develop
pull_request:

jobs:
build_c2a:
uses: arkedge/workflows-c2a/.github/workflows/[email protected]
```

0 comments on commit 3dc4d63

Please sign in to comment.