Skip to content

Commit

Permalink
Create main.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
OseMine authored Oct 24, 2024
1 parent 2c4a415 commit 3c55e99
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
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: Install GCC
uses: shogo82148/actions-setup-gcc@v1.3.0
with:
version: 'latest'

- 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

0 comments on commit 3c55e99

Please sign in to comment.