Update and rename main to main.yml #3
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
name: Compile Python to C | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Install Cython | |
run: pip install cython | |
- name: Check GCC version | |
run: gcc --version | |
- name: Convert Python to C with Cython | |
run: | | |
for file in *.py; do | |
cython --embed "$file" -o "${file%.py}.c" | |
done | |
- name: Compile C files with GCC | |
run: | | |
for file in *.c; do | |
gcc "$file" -o "${file%.c}" $(python3-config --cflags --ldflags) | |
done |