Skip to content

Commit

Permalink
Make workflows reusable
Browse files Browse the repository at this point in the history
  • Loading branch information
SamirDroubi committed Mar 9, 2024
1 parent 365205a commit 5f6e614
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 67 deletions.
70 changes: 3 additions & 67 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,70 +6,6 @@ on:
pull_request:

jobs:
testing:
strategy:
matrix:
runner: [ macos-14, ubuntu-latest ]
include:
- runner: ubuntu-latest
CC: gcc
CXX: g++
PRESET: avx2
- runner: macos-14
CC: clang # This will be system AppleClang
CXX: clang++ # This will be system AppleClang
PRESET: apple-silicon

env:
CC: ${{matrix.CC}}
CXX: ${{matrix.CXX}}
BUILD_TYPE: Release
CTEST_OUTPUT_ON_FAILURE: 1
runs-on: ${{matrix.runner}}
steps:
- name: Checkout Exo main sources
uses: actions/checkout@v4
with:
repository: exo-lang/exo
submodules: recursive
path: exo-repo

- name: Setup Python environment
uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'pip'

- name: Install Python dependencies
run: |
python -m pip install -U pip wheel build
- name: Install Exo
run: python -m build ${{github.workspace}}/exo-repo ; python -m pip install ${{github.workspace}}/exo-repo/dist/*.whl

- name: Get latest CMake and ninja
uses: lukka/get-cmake@latest

- name: Install Google benchmark
run: git clone https://github.com/google/benchmark; cmake -S benchmark -B benchmark/build -DCMAKE_BUILD_TYPE=Release -DBENCHMARK_ENABLE_TESTING=NO ; cmake --build benchmark/build; cmake --install benchmark/build --prefix ~/.local

- name: Checkout BLAS repo
uses: actions/checkout@v4
with:
submodules: recursive
path: BLAS-repo

- name: Configure CMake
env:
CMAKE_PREFIX_PATH: ${{github.workspace}}/benchmark/build
run: cmake ${{github.workspace}}/BLAS-repo -B ${{github.workspace}}/BLAS-repo/build/${{matrix.PRESET}} -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} --preset ${{matrix.PRESET}}

- name: Build
run: cmake --build ${{github.workspace}}/BLAS-repo/build/${{matrix.PRESET}} --config ${{env.BUILD_TYPE}}

- name: Test Codegen
run: ctest --test-dir ${{github.workspace}}/BLAS-repo/build/${{matrix.PRESET}} -C ${{env.BUILD_TYPE}} -R codegen_verbose
if: ${{matrix.runner == 'ubuntu-latest'}}

- name: Test Correctness
run: ctest --test-dir ${{github.workspace}}/BLAS-repo/build/${{matrix.PRESET}} -C ${{env.BUILD_TYPE}} -R correctness
uses: ./.github/workflows/test_ExoBLAS.yml
with:
exo-commit: main
77 changes: 77 additions & 0 deletions .github/workflows/test_ExoBLAS.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
on:
workflow_call:
inputs:
exo-commit:
required: true
type: string

jobs:
test_ExoBLAS:
strategy:
matrix:
runner: [ macos-14, ubuntu-latest ]
include:
- runner: ubuntu-latest
CC: gcc
CXX: g++
PRESET: avx2
- runner: macos-14
CC: clang # This will be system AppleClang
CXX: clang++ # This will be system AppleClang
PRESET: apple-silicon

env:
CC: ${{matrix.CC}}
CXX: ${{matrix.CXX}}
BUILD_TYPE: Release
CTEST_OUTPUT_ON_FAILURE: 1
runs-on: ${{matrix.runner}}
steps:
- name: Checkout Exo main sources
uses: actions/checkout@v4
with:
repository: exo-lang/exo@${{ inputs.exo-commit }}
submodules: recursive
path: exo-repo

- name: Setup Python environment
uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'pip'

- name: Install Python dependencies
run: python -m pip install -U pip wheel build

- name: Install Exo
run: python -m build ${{github.workspace}}/exo-repo ; python -m pip install ${{github.workspace}}/exo-repo/dist/*.whl

- name: Get latest CMake and ninja
uses: lukka/get-cmake@latest

- name: Install Google benchmark
run: git clone https://github.com/google/benchmark; cmake -S benchmark -B benchmark/build -DCMAKE_BUILD_TYPE=Release -DBENCHMARK_ENABLE_TESTING=NO ; cmake --build benchmark/build; cmake --install benchmark/build --prefix ~/.local

- name: Checkout ExoBLAS repo
uses: actions/checkout@v4
with:
submodules: recursive
path: ExoBLAS

- name: Install ExoBLAS requirements
run: python -m pip install -Ur ${{github.workspace}}/ExoBLAS/requirements.txt

- name: Configure CMake
env:
CMAKE_PREFIX_PATH: ${{github.workspace}}/benchmark/build
run: cmake ${{github.workspace}}/ExoBLAS -B ${{github.workspace}}/ExoBLAS/build/${{matrix.PRESET}} -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} --preset ${{matrix.PRESET}}

- name: Build
run: cmake --build ${{github.workspace}}/ExoBLAS/build/${{matrix.PRESET}} --config ${{env.BUILD_TYPE}}

- name: Test Codegen
run: ctest --test-dir ${{github.workspace}}/ExoBLAS/build/${{matrix.PRESET}} -C ${{env.BUILD_TYPE}} -R codegen_verbose
if: ${{matrix.runner == 'ubuntu-latest'}}

- name: Test Correctness
run: ctest --test-dir ${{github.workspace}}/ExoBLAS/build/${{matrix.PRESET}} -C ${{env.BUILD_TYPE}} -R correctness

0 comments on commit 5f6e614

Please sign in to comment.