-
-
Notifications
You must be signed in to change notification settings - Fork 5
131 lines (128 loc) · 4.92 KB
/
compile_c.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: "Compile C"
on:
workflow_dispatch:
push:
paths:
- "c/**"
- ".github/**"
pull_request:
permissions:
contents: read
jobs:
build-darwin:
name: MacOS(Intel&ARM)
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: compile C binary for macOS
run: |
mkdir target
echo "Compiling C for Intel Macos-X"
(cd c && make CFLAGS+='-target x86_64-apple-macos12' OUT='../target/wrongsecrets-c')
(cd c/advanced && make CFLAGS+='-target x86_64-apple-macos12' OUT='../../target/wrongsecrets-advanced-c')
echo "Compiling C for ARM Macos-X"
(cd c && make CFLAGS+='-target arm64-apple-macos12' OUT='../target/wrongsecrets-c-arm')
(cd c/advanced && make CFLAGS+='-target arm64-apple-macos12' OUT='../../target/wrongsecrets-advanced-c-arm')
- name: Uploading C executables
uses: actions/upload-artifact@v4
with:
name: executable-C-MacOS
path: target/*
build-linux:
name: Linux(X86-64)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Compile C binary for Linux(x64)
run: |
mkdir target
echo "Compiling C for Linux-x64"
gcc c/main.c -o target/wrongsecrets-c-linux
gcc c/advanced/advanced.c -o target/wrongsecrets-advanced-c-linux
- name: Uploading C executables
uses: actions/upload-artifact@v4
with:
name: executable-C-linux-x64
path: target/*
build-linux-arm:
name: Linux(ARM64)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Compile C binary for Linux(ARM)
run: |
mkdir target
echo "Prepare env"
git clone --depth 1 https://github.com/dockcross/dockcross.git
cd dockcross
docker run --rm dockcross/linux-arm64-lts > ./dockcross-linux-arm64-lts
chmod +x ./dockcross-linux-arm64-lts && mv ./dockcross-linux-arm64-lts .. && cd ..
echo "Compiling C for Linux-arm"
./dockcross-linux-arm64-lts bash -c '$CC c/main.c -o target/wrongsecrets-c-linux-arm'
./dockcross-linux-arm64-lts bash -c '$CC c/advanced/advanced.c -o target/wrongsecrets-advanced-c-linux-arm'
- name: Uploading executables
uses: actions/upload-artifact@v4
with:
name: executable-C-linux-ARM
path: target/*
build-windows:
name: Windows(x86-64)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Compile C binary for Windows
run: |
mkdir target
echo "Prepare env"
git clone --depth 1 https://github.com/dockcross/dockcross.git
cd dockcross
docker run --rm dockcross/windows-static-x64 > ./dockcross-windows-static-x64
chmod +x ./dockcross-windows-static-x64 && mv ./dockcross-windows-static-x64 .. && cd ..
echo "Compiling C for Windows"
./dockcross-windows-static-x64 bash -c '$CC c/main.c -o target/wrongsecrets-c-windows'
./dockcross-windows-static-x64 bash -c '$CC c/advanced/advanced.c -o target/wrongsecrets-advanced-c-windows'
- name: Uploading executables
uses: actions/upload-artifact@v4
with:
name: executable-C-Windows
path: target/*
build-musl-arm:
name: Musl(ARM)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Compile C binary for Musl(ARM)
run: |
mkdir target
echo "Prepare env"
git clone --depth 1 https://github.com/dockcross/dockcross.git
cd dockcross
docker run --rm dockcross/linux-arm64-musl > ./dockcross-linux-arm64-musl
chmod +x ./dockcross-linux-arm64-musl && mv ./dockcross-linux-arm64-musl .. && cd ..
echo "Compiling C for Arm Musl"
./dockcross-linux-arm64-musl bash -c '$CC c/main.c -o target/wrongsecrets-c-linux-musl-arm'
./dockcross-linux-arm64-musl bash -c '$CC c/advanced/advanced.c -o target/wrongsecrets-advanced-c-linux-musl-arm'
- name: Uploading executables
uses: actions/upload-artifact@v4
with:
name: executable-C-Musl-ARM
path: target/*
build-musl-x64:
name: Musl(X86-64)
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Compile C binary for Musl(x64)
run: |
mkdir target
echo "Prepare env"
brew install FiloSottile/musl-cross/musl-cross
ln -s /usr/local/opt/musl-cross/bin/x86_64-linux-musl-gcc /usr/local/bin/musl-gcc
echo "Compiling C for X64 Musl"
x86_64-linux-musl-gcc c/main.c -o target/wrongsecrets-c-linux-musl
x86_64-linux-musl-gcc c/advanced/advanced.c -o target/wrongsecrets-advanced-c-linux-musl
- name: Uploading executables
uses: actions/upload-artifact@v4
with:
name: executable-C-Musl-x64
path: target/*