-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #72 from moiSentineL/library
library file names based on os + multiplatform build
- Loading branch information
Showing
3 changed files
with
87 additions
and
22 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 |
---|---|---|
@@ -1,28 +1,85 @@ | ||
name: publish | ||
name: Multi-Platform Build and Publish | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
deploy: | ||
build: | ||
name: Build on ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
include: | ||
- os: ubuntu-latest | ||
output: flomo/session_id.so | ||
- os: macos-latest | ||
output: flomo/session_id.dylib | ||
- os: windows-latest | ||
output: flomo/session_id.dll | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.12.3" | ||
|
||
- name: Set up GCC | ||
uses: egor-tensin/setup-gcc@v1 | ||
if: runner.os != 'Windows' | ||
|
||
- name: Set up MSVC | ||
uses: microsoft/[email protected] | ||
if: runner.os == 'Windows' | ||
|
||
- name: Compile (Unix) | ||
if: runner.os != 'Windows' | ||
run: gcc -fPIC -shared -o ${{ matrix.output }} flomo/session_id.c | ||
|
||
- name: Compile (Windows) | ||
if: runner.os == 'Windows' | ||
run: cl.exe /LD /Fe${{ matrix.output }} flomo/session_id.c | ||
|
||
- name: Upload artifact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: ${{ runner.os }}-library | ||
path: ${{ matrix.output }} | ||
|
||
publish: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.12.3" | ||
- name: Install GCC | ||
uses: egor-tensin/[email protected] | ||
|
||
- name: Download all artifacts | ||
uses: actions/download-artifact@v2 | ||
with: | ||
path: ./artifacts | ||
|
||
- name: Move artifacts to correct locations | ||
run: | | ||
mkdir -p flomo | ||
mv artifacts/Linux-library/session_id.so flomo/ | ||
mv artifacts/macOS-library/session_id.dylib flomo/ | ||
mv artifacts/Windows-library/session_id.dll flomo/ | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install setuptools wheel twine | ||
- name: Build and Publish | ||
env: | ||
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} | ||
run: | | ||
gcc -fPIC -shared -o flomo/session_id.so flomo/session_id.c | ||
python setup.py sdist bdist_wheel | ||
twine upload dist/* |
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
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