This repository has been archived by the owner on Jan 2, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
32 additions
and
20 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,55 +3,67 @@ name: Go Build for Windows and Linux | |
on: | ||
push: | ||
branches: | ||
- main | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
build-windows: | ||
runs-on: windows-latest | ||
runs-on: windows-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.21' | ||
go-version: '1.21' | ||
|
||
- name: Build Go shared library (.dll) | ||
run: | | ||
cd go_spammer | ||
go build -o ../shared/spammer.dll -buildmode=c-shared main.go | ||
cd go_spammer | ||
go build -o spammer.dll -buildmode=c-shared main.go | ||
mkdir -p ../shared | ||
mv spammer.dll ../shared/spammer.dll | ||
- name: Upload DLL artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: spammer-dll | ||
path: ./shared/spammer.dll | ||
- name: Commit and push changes | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "GitHub Actions" | ||
git add ../shared/spammer.dll | ||
git commit -m "Add built spammer.dll for Windows" | ||
git push | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
build-linux: | ||
runs-on: ubuntu-latest | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.21' | ||
go-version: '1.21' | ||
|
||
- name: Install GCC | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y build-essential # نصب GCC و ابزارهای ضروری برای بیلد | ||
sudo apt-get install -y build-essential | ||
- name: Build Go shared library (.so) | ||
run: | | ||
cd go_spammer # به پوشهی go_spammer بروید | ||
go build -o ../shared/spammer.so -buildmode=c-shared main.go # بیلد کتابخانه بهصورت shared برای لینوکس | ||
cd go_spammer | ||
go build -o spammer.so -buildmode=c-shared main.go | ||
mkdir -p ../shared | ||
mv spammer.so ../shared/spammer.so | ||
- name: Upload SO artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: spammer-so | ||
path: ./shared/spammer.so | ||
- name: Commit and push changes | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "GitHub Actions" | ||
git add ../shared/spammer.so | ||
git commit -m "Add built spammer.so for Linux" | ||
git push | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |