Skip to content

Commit

Permalink
ci: run header-only tests (#2169)
Browse files Browse the repository at this point in the history
* chore: move files

* chore: update header paths

* ci: split and rename workflows

fix: include path

* ci: add test workflow

* ci: rename workflows

* ci: temprorarily disable path selector

* ci: rename workflows

* ci: add names to workflows

* ci: try using python3 as shell

ci: use python3

* fix: missing include

* ci: fix execution

ci: log files

chore: debug

chore

chore

* ci: re-enable path scope

* docs: fix path to header-only includes

Use generated path, not /header-only

* ci: use single line

* ci: test no path selector again
  • Loading branch information
agoose77 authored Jan 30, 2023
1 parent a420bc2 commit f0a1bdf
Show file tree
Hide file tree
Showing 17 changed files with 85 additions and 23 deletions.
1 change: 1 addition & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ env:
jobs:
coverage:
runs-on: ubuntu-20.04
name: Run Codecov

env:
PIP_ONLY_BINARY: cmake
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ env:

jobs:
awkward-cpp-wasm:
name: Build C++ WASM
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -62,6 +63,7 @@ jobs:

awkward-cpp-x86-64:
runs-on: ubuntu-22.04
name: Build C++ x86
steps:
- uses: actions/checkout@v3
with:
Expand Down Expand Up @@ -111,6 +113,7 @@ jobs:

awkward:
runs-on: ubuntu-22.04
name: Build Python
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -132,6 +135,7 @@ jobs:
build-docs:
runs-on: ubuntu-22.04
needs: [awkward-cpp-wasm, awkward-cpp-x86-64, awkward]
name: Build Docs
defaults:
run:
# Ensure conda env is activated
Expand Down Expand Up @@ -235,6 +239,7 @@ jobs:
branch-preview:
runs-on: ubuntu-22.04
needs: [build-docs]
name: Deploy Branch Preview
# We can only deploy for PRs on host repo
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository }}
permissions:
Expand Down Expand Up @@ -267,6 +272,7 @@ jobs:
needs: [ build-docs ]
# We can only deploy for PRs on host repo
if: github.event_name == 'push' || github.event_name == 'release'
name: Deploy
permissions:
id-token: write
contents: read
Expand Down
44 changes: 44 additions & 0 deletions .github/workflows/header-only-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Header-only Tests

on:
pull_request:
# paths:
# - 'header-only'

workflow_dispatch:


concurrency:
group: header-only-test-${{ github.head_ref }}
cancel-in-progress: true

jobs:
test:
name: "Run Tests"
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v3
with:
submodules: true

- name: Run CMake
run: |
cmake -B build -S header-only/tests -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=bin -DCMAKE_BUILD_TYPE=Release
cmake --build build/
- name: Run tests
run: |
import os
import pathlib
import subprocess
for path in pathlib.Path("build/bin").glob("test_*"):
if path.is_file():
print(f"Running {path.name}", flush=True)
print("::group::Test output", flush=True)
subprocess.run([path], check=True)
print("::endgroup::", flush=True)
shell: python3 {0}
25 changes: 25 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Lint

on:
pull_request:
workflow_dispatch:


concurrency:
group: lint-${{ github.head_ref }}
cancel-in-progress: true

jobs:
pylint:
name: "Run PyLint"
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
submodules: true

- name: Run PyLint
run: |
echo "::add-matcher::$GITHUB_WORKSPACE/.github/matchers/pylint.json"
pipx run nox -s pylint
Original file line number Diff line number Diff line change
@@ -1,33 +1,18 @@
name: Tests
name: Packaging Tests

on:
pull_request:
workflow_dispatch:


concurrency:
group: wheels-${{ github.head_ref }}
group: packaging-test-${{ github.head_ref }}
cancel-in-progress: true

env:
SOURCE_DATE_EPOCH: "1668811211"

jobs:
pylint:
name: "PyLint"
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
submodules: true

- name: Run PyLint
run: |
echo "::add-matcher::$GITHUB_WORKSPACE/.github/matchers/pylint.json"
pipx run nox -s pylint
make_sdists:
name: "Make SDists"
runs-on: ubuntu-latest
Expand Down Expand Up @@ -56,7 +41,7 @@ jobs:
build_wheels:
name: "Wheel: ${{ matrix.os }}"
name: "Make Wheel: ${{ matrix.os }}"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build Test
name: Tests

on:
pull_request:
Expand All @@ -19,7 +19,7 @@ on:
workflow_dispatch:

concurrency:
group: 'build-test-${{ github.head_ref || github.run_id }}'
group: 'test-${{ github.head_ref || github.run_id }}'
cancel-in-progress: true

env:
Expand Down
2 changes: 1 addition & 1 deletion dev/copy-cpp-headers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import shutil

root_path = pathlib.Path(__file__).absolute().parents[1]
source_path = root_path / "header-only"
source_path = root_path / "header-only" / "include"
dest_paths = (
root_path / "awkward-cpp" / "header-only",
root_path / "src" / "awkward" / "_connect" / "header-only",
Expand Down
2 changes: 1 addition & 1 deletion docs/user-guide/how-to-use-header-only-layoutbuilder.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ How to use the header-only LayoutBuilder in C++
:tags: [hide-cell]
// Make Awkward headers available in this notebook
#pragma cling add_include_path("../../header-only")
#pragma cling add_include_path("../../src/awkward/_connect/header-only")
```

What is header-only Layout Builder?
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <algorithm>
#include <tuple>
#include <string>
#include <functional>

namespace awkward {

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ set(CMAKE_VISIBILITY_INLINES_HIDDEN ON)

# C++ dependencies (header-only): GrowableBuffer
add_library(awkward-parent INTERFACE)
target_include_directories(awkward-parent INTERFACE ../header-only)
target_include_directories(awkward-parent INTERFACE ../include)
target_compile_features(awkward-parent INTERFACE cxx_std_11)

macro(addtest name filename)
Expand Down

0 comments on commit f0a1bdf

Please sign in to comment.