|
1 | | -name: Cross-Compile TinyCC |
| 1 | +name: Cross-Compile TCC for Windows & Linux |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | push: |
5 | 5 | branches: |
6 | | - - main # Change to the branch you want to trigger on |
| 6 | + - mob |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - mob |
| 10 | + workflow_dispatch: |
7 | 11 |
|
8 | 12 | jobs: |
9 | 13 | build: |
10 | 14 | runs-on: ubuntu-latest |
11 | | - strategy: |
12 | | - matrix: |
13 | | - target: [linux, windows] |
14 | | - |
| 15 | + |
15 | 16 | steps: |
16 | | - - name: Checkout Source |
| 17 | + - name: Checkout source code |
17 | 18 | uses: actions/checkout@v4 |
18 | | - |
19 | | - - name: Install Dependencies |
| 19 | + with: |
| 20 | + repository: Tiny-C-Compiler/mirror-repository |
| 21 | + ref: mob |
| 22 | + fetch-depth: 0 |
| 23 | + |
| 24 | + - name: Install dependencies |
20 | 25 | run: | |
| 26 | + echo "Installing dependencies..." |
21 | 27 | sudo apt update |
22 | | - sudo apt install -y mingw-w64 build-essential |
| 28 | + sudo apt install -y mingw-w64 build-essential make autoconf |
| 29 | +
|
| 30 | + - name: Debug: Verify installed compilers |
| 31 | + run: | |
| 32 | + echo "GCC version:" |
| 33 | + gcc --version |
| 34 | + echo "MinGW-w64 version:" |
| 35 | + x86_64-w64-mingw32-gcc --version |
| 36 | +
|
| 37 | + - name: Extract version info |
| 38 | + run: | |
| 39 | + echo "Extracting version info..." |
| 40 | + TCC_VERSION=$(head -n 1 VERSION) |
| 41 | + echo "TCC Version: $TCC_VERSION" |
| 42 | + echo "TCC_VERSION=$TCC_VERSION" >> $GITHUB_ENV |
23 | 43 |
|
24 | | - - name: Build for Linux |
25 | | - if: matrix.target == 'linux' |
| 44 | + - name: Compile for Linux |
26 | 45 | run: | |
| 46 | + echo "Compiling for Linux..." |
27 | 47 | ./configure |
28 | 48 | make -j$(nproc) |
29 | | - tar -czvf tinycc-linux.tar.gz tcc |
| 49 | + strip tcc |
| 50 | + mv tcc tcc-linux |
30 | 51 |
|
31 | | - - name: Build for Windows |
32 | | - if: matrix.target == 'windows' |
| 52 | + - name: Compile for Windows (Cross-Compile) |
33 | 53 | run: | |
| 54 | + echo "Compiling for Windows..." |
34 | 55 | ./configure --cross-prefix=x86_64-w64-mingw32- |
35 | 56 | make -j$(nproc) |
36 | | - zip -r tinycc-windows.zip tcc.exe |
| 57 | + strip tcc.exe |
| 58 | + mv tcc.exe tcc-windows.exe |
37 | 59 |
|
38 | | - - name: Upload Artifacts |
39 | | - uses: actions/upload-artifact@v4 |
40 | | - with: |
41 | | - name: tinycc-${{ matrix.target }} |
42 | | - path: tinycc-*.* |
43 | | - |
44 | | - release: |
45 | | - needs: build |
46 | | - runs-on: ubuntu-latest |
| 60 | + - name: Debug: List built binaries |
| 61 | + run: ls -lh tcc-linux tcc-windows.exe |
47 | 62 |
|
48 | | - steps: |
49 | | - - name: Download Artifacts |
50 | | - uses: actions/download-artifact@v4 |
51 | | - with: |
52 | | - path: artifacts |
| 63 | + - name: Create Release Assets |
| 64 | + run: | |
| 65 | + mkdir release |
| 66 | + mv tcc-linux release/tcc-linux |
| 67 | + mv tcc-windows.exe release/tcc-windows.exe |
| 68 | + tar -czvf tcc-linux.tar.gz -C release tcc-linux |
| 69 | + zip -r tcc-windows.zip release/tcc-windows.exe |
| 70 | + ls -lh tcc-linux.tar.gz tcc-windows.zip |
53 | 71 |
|
54 | | - - name: Create GitHub Release |
| 72 | + - name: Upload to GitHub Releases |
55 | 73 | uses: softprops/action-gh-release@v2 |
56 | 74 | with: |
| 75 | + token: ${{ secrets.GITHUB_TOKEN }} |
57 | 76 | tag_name: latest |
58 | 77 | repository: Tiny-C-Compiler/mirror-repository |
59 | | - files: artifacts/tinycc-*/tinycc-* |
60 | | - token: ${{ secrets.GITHUB_TOKEN }} |
61 | | - prerelease: true |
| 78 | + name: "Latest TinyCC Build" |
| 79 | + body: "Automated build for TinyCC (Linux & Windows)." |
62 | 80 | draft: false |
| 81 | + prerelease: false |
| 82 | + files: | |
| 83 | + tcc-linux.tar.gz |
| 84 | + tcc-windows.zip |
0 commit comments