Skip to content

Commit

Permalink
Github actions stuff part 2
Browse files Browse the repository at this point in the history
  • Loading branch information
M-logique committed Sep 8, 2024
1 parent 4b8f0c5 commit 439e823
Showing 1 changed file with 32 additions and 20 deletions.
52 changes: 32 additions & 20 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 "your-email@example.com"
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 "your-email@example.com"
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 }}

0 comments on commit 439e823

Please sign in to comment.