[CI] Extend python-app.yml to run pytests also on Mac/OSX. #27
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ############################################################################## | |
# This workflow will install required s/w components on Linux and Mac/OSX. | |
# Run through different `make` targets to build-and-test test-code and | |
# unit-tests, sample programs that invoke the LOC-encoding schemes. | |
# ############################################################################## | |
name: LineOfCode-Build and Test | |
#! ----------------------------------------------------------------------------- | |
# Ref: For running jobs on Linux & Mac/OSX with one workflow. | |
# https://stackoverflow.com/questions/57946173/github-actions-run-step-on-specific-os | |
#! ----------------------------------------------------------------------------- | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
build_type: [release, debug] | |
steps: | |
- uses: actions/checkout@v3 | |
#! We need to install python3 as 'genloc' target invokes the Python generator | |
#! script, which will need to run python3. | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.10" | |
#! - name: configure | |
#! run: ./configure | |
#! Ensure that standalone target still works on its own | |
- name: genloc | |
run: BUILD_MODE=${{ matrix.build_type }} make genloc | |
- name: clean | |
run: BUILD_MODE=${{ matrix.build_type }} make clean | |
- name: make-all-verbose | |
run: BUILD_MODE=${{ matrix.build_type }} CC=gcc LD=g++ BUILD_VERBOSE=1 make | |
#! Execute testing targets; Run py-test and LOC-enabled sample programs | |
- name: make-tests | |
run: | | |
make clean | |
BUILD_MODE=${{ matrix.build_type }} CC=gcc LD=g++ make run-tests | |
#! Execute testing targets; Run py-test and LOC-enabled sample programs | |
- name: test-make-with-external-cflags | |
run: | | |
make clean | |
BUILD_MODE=${{ matrix.build_type }} CC=gcc LD=g++ CFLAGS='-DLOC_FILE_INDEX=LOC_$(subst .,_,$(subst -,_,$(notdir $<)))' make -f Makefile.ext-CFLAGS run-tests | |
#! Same as above, but just feed the CFLAGS emitted by Py-generator. | |
- name: test-make-with-cflags-emitted-by-python-generator | |
run: | | |
make clean | |
BUILD_MODE=${{ matrix.build_type }} CC=gcc LD=g++ CFLAGS=$(./loc/gen_loc_files.py --src-root-dir ./test-code/single-file-cc-program --gen-cflags-brief) make -f Makefile.ext-CFLAGS run-tests | |
#! - name: Run check | |
#! run: make check | |
#! - name: Run distcheck | |
#! run: make distcheck |