|
1 | | -name: Cross-Compile TCC |
| 1 | +name: Build and Release TCC (mob branch) |
2 | 2 |
|
3 | 3 | on: |
4 | | - push: |
5 | | - branches: |
6 | | - - mob |
7 | | - pull_request: |
8 | | - branches: |
9 | | - - mob |
10 | 4 | workflow_dispatch: |
| 5 | + push: |
| 6 | + tags: |
| 7 | + - "v*.*.*" |
| 8 | + |
11 | 9 | permissions: |
12 | 10 | contents: write |
13 | 11 |
|
14 | 12 | jobs: |
15 | 13 | build: |
| 14 | + name: Compile TCC for multiple targets |
16 | 15 | runs-on: ubuntu-latest |
17 | 16 |
|
| 17 | + strategy: |
| 18 | + matrix: |
| 19 | + target: [linux-x86_64, windows-x86_64, linux-arm] |
| 20 | + |
18 | 21 | steps: |
19 | | - - name: Checkout TCC source code |
20 | | - uses: actions/checkout@v4 |
21 | | - with: |
22 | | - repository: Tiny-C-Compiler/mirror-repository |
23 | | - ref: mob |
| 22 | + - name: Download TCC source (mob branch) |
| 23 | + run: | |
| 24 | + wget -O tcc-mob.zip https://github.com/Tiny-C-Compiler/mirror-repository/archive/refs/heads/mob.zip |
| 25 | + unzip tcc-mob.zip |
| 26 | + mv mirror-repository-mob tcc |
| 27 | + cd tcc |
24 | 28 |
|
25 | 29 | - name: Install dependencies |
26 | 30 | run: | |
27 | 31 | sudo apt-get update |
28 | | - sudo apt-get install -y mingw-w64 gcc-mingw-w64 make autoconf automake |
| 32 | + sudo apt-get install -y build-essential mingw-w64 gcc-arm-linux-gnueabi |
29 | 33 |
|
30 | | - - name: Debug environment |
| 34 | + - name: Configure and Build |
31 | 35 | run: | |
32 | | - echo "PATH: $PATH" |
33 | | - echo "GCC Version: $(gcc --version)" |
34 | | - echo "MinGW-w64 Version: $(x86_64-w64-mingw32-gcc --version)" |
| 36 | + cd tcc |
| 37 | + case "${{ matrix.target }}" in |
| 38 | + linux-x86_64) |
| 39 | + ./configure --prefix=/usr |
| 40 | + make -j$(nproc) |
| 41 | + mv tcc ../tcc-linux-x86_64 |
| 42 | + ;; |
| 43 | + windows-x86_64) |
| 44 | + ./configure --cc=x86_64-w64-mingw32-gcc --prefix=/usr |
| 45 | + make -j$(nproc) |
| 46 | + mv tcc.exe ../tcc-windows-x86_64.exe |
| 47 | + ;; |
| 48 | + linux-arm) |
| 49 | + ./configure --cc=arm-linux-gnueabi-gcc --prefix=/usr |
| 50 | + make -j$(nproc) |
| 51 | + mv tcc ../tcc-linux-arm |
| 52 | + ;; |
| 53 | + esac |
35 | 54 |
|
36 | | - - name: Compile for Linux |
37 | | - run: | |
38 | | - ./configure |
39 | | - make -j$(nproc) |
40 | | - strip tcc |
41 | | - mv tcc tcc-linux |
| 55 | + - name: Upload artifacts |
| 56 | + uses: actions/upload-artifact@v4 |
| 57 | + with: |
| 58 | + name: tcc-${{ matrix.target }} |
| 59 | + path: tcc-* |
42 | 60 |
|
43 | | - - name: Compile for Windows (cross-compile) |
44 | | - run: | |
45 | | - ./configure --cross-prefix=x86_64-w64-mingw32- |
46 | | - make -j$(nproc) |
47 | | - x86_64-w64-mingw32-strip tcc.exe |
48 | | - mv tcc.exe tcc-windows.exe |
| 61 | + release: |
| 62 | + name: Create GitHub Release |
| 63 | + runs-on: ubuntu-latest |
| 64 | + needs: build |
49 | 65 |
|
50 | | - - name: Create release artifacts |
51 | | - run: | |
52 | | - mkdir release |
53 | | - mv tcc-linux release/tcc-linux |
54 | | - mv tcc-windows.exe release/tcc-windows.exe |
55 | | - tar -czvf tcc-latest-linux.tar.gz -C release tcc-linux |
56 | | - zip -r tcc-latest-windows.zip release/tcc-windows.exe |
| 66 | + steps: |
| 67 | + - name: Download artifacts |
| 68 | + uses: actions/download-artifact@v4 |
| 69 | + with: |
| 70 | + path: artifacts |
57 | 71 |
|
58 | | - - name: Upload release to GitHub |
| 72 | + - name: Create a release |
59 | 73 | uses: softprops/action-gh-release@v2 |
60 | 74 | with: |
61 | | - tag_name: latest |
62 | | - files: | |
63 | | - tcc-latest-linux.tar.gz |
64 | | - tcc-latest-windows.zip |
65 | | - repository: Tiny-C-Compiler/mirror-repository |
66 | | - env: |
67 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 75 | + files: artifacts/**/* |
| 76 | + token: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments