Merge pull request #56 from OWASP/dotnetfinalization #235
Workflow file for this run
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 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/* |