Pole #1
+53
-66
@@ -4,8 +4,6 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- "**"
|
- "**"
|
||||||
tags-ignore:
|
|
||||||
- "**"
|
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
@@ -19,7 +17,9 @@ jobs:
|
|||||||
os: ubuntu-latest
|
os: ubuntu-latest
|
||||||
- identifier: windows
|
- identifier: windows
|
||||||
os: ubuntu-latest
|
os: ubuntu-latest
|
||||||
|
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout project
|
- name: Checkout project
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -27,26 +27,19 @@ jobs:
|
|||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: '3.10'
|
python-version: "3.10"
|
||||||
|
|
||||||
- name: (Windows) Install MinGW
|
- name: (Windows) Install MinGW
|
||||||
if: ${{ startsWith(matrix.identifier, 'windows') }}
|
if: matrix.identifier == 'windows'
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update -y -qq
|
sudo apt-get update -y -qq
|
||||||
sudo apt-get install -y mingw-w64
|
sudo apt-get install -y mingw-w64
|
||||||
sudo update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix
|
sudo update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix
|
||||||
sudo update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix
|
sudo update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix
|
||||||
|
|
||||||
- name: (Windows) Prepare cross compilation
|
|
||||||
if: ${{ startsWith(matrix.identifier, 'windows') }}
|
|
||||||
shell: sh
|
|
||||||
run: |
|
|
||||||
echo "OS=Windows_NT" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: (Linux) Install dependencies
|
- name: (Linux) Install dependencies
|
||||||
if: ${{ startsWith(matrix.identifier, 'linux') }}
|
if: matrix.identifier == 'linux'
|
||||||
run: |
|
run: |
|
||||||
sudo add-apt-repository -y "deb http://archive.ubuntu.com/ubuntu `lsb_release -sc` main universe restricted multiverse"
|
|
||||||
sudo apt-get update -y -qq
|
sudo apt-get update -y -qq
|
||||||
sudo apt-get install -y libsdl2-dev libglew-dev
|
sudo apt-get install -y libsdl2-dev libglew-dev
|
||||||
|
|
||||||
@@ -54,76 +47,70 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
if [[ "${{ matrix.identifier }}" == "windows" ]]; then
|
if [[ "${{ matrix.identifier }}" == "windows" ]]; then
|
||||||
make lib -j $(nproc 2>/dev/null || sysctl -n hw.ncpu) \
|
make lib -j $(nproc 2>/dev/null || sysctl -n hw.ncpu) \
|
||||||
CC=x86_64-w64-mingw32-gcc \
|
CC=x86_64-w64-mingw32-gcc \
|
||||||
CXX=x86_64-w64-mingw32-g++
|
CXX=x86_64-w64-mingw32-g++
|
||||||
else
|
else
|
||||||
make lib -j $(nproc 2>/dev/null || sysctl -n hw.ncpu)
|
make lib -j $(nproc 2>/dev/null || sysctl -n hw.ncpu)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: (Linux) Build test executable
|
- name: Build test executable (Linux only)
|
||||||
if: ${{ startsWith(matrix.identifier, 'linux') }}
|
if: matrix.identifier == 'linux'
|
||||||
run: |
|
run: make test -j$(nproc)
|
||||||
make test -j`nproc`
|
|
||||||
|
|
||||||
- name: Upload build
|
- name: Prepare artifacts
|
||||||
uses: actions/upload-artifact@v3
|
run: |
|
||||||
|
mkdir -p artifacts/${{ matrix.identifier }}
|
||||||
|
cp -r dist artifacts/${{ matrix.identifier }}/
|
||||||
|
cp README.md artifacts/${{ matrix.identifier }}/
|
||||||
|
|
||||||
|
- name: Upload build artifacts
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: libsm64_${{ matrix.identifier }}
|
name: libsm64_${{ matrix.identifier }}
|
||||||
path: |
|
path: artifacts/${{ matrix.identifier }}
|
||||||
./README.md
|
|
||||||
./dist
|
|
||||||
./run-test
|
|
||||||
|
|
||||||
Release:
|
Release:
|
||||||
name: Snapshot Release
|
name: Snapshot Release
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: Build
|
needs: Build
|
||||||
|
|
||||||
|
# IMPORTANT: prevents running on tag pushes
|
||||||
|
if: github.ref_type == 'branch'
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Download artifacts
|
- name: Download artifacts
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
path: artifacts
|
||||||
|
|
||||||
- name: Create release
|
- name: Create Release
|
||||||
id: create_release
|
id: release
|
||||||
shell: bash
|
uses: gitea/actions/gitea-release-action@v1
|
||||||
run: |
|
with:
|
||||||
RESPONSE=$(curl -s -X POST \
|
api_key: ${{ secrets.GITEA_TOKEN }}
|
||||||
-H "Authorization: token ${{ secrets.LIBSM64_TOKEN }}" \
|
owner: NepuShiro
|
||||||
-H "Content-Type: application/json" \
|
repo: libsm64
|
||||||
"https://git.nepu.men/api/v1/repos/NepuShiro/libsm64/releases" \
|
tag_name: build-${{ github.sha }}
|
||||||
-d '{
|
release_name: Snapshot Build ${{ github.sha }}
|
||||||
"tag_name": "latest",
|
prerelease: true
|
||||||
"name": "Snapshot Build",
|
|
||||||
"prerelease": true
|
|
||||||
}')
|
|
||||||
|
|
||||||
echo "$RESPONSE"
|
|
||||||
|
|
||||||
RELEASE_ID=$(echo "$RESPONSE" | grep -o '"id":[0-9]*' | head -n 1 | grep -o '[0-9]*')
|
|
||||||
echo "release_id=$RELEASE_ID" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: Upload Linux artifact
|
- name: Upload Linux artifact
|
||||||
shell: bash
|
uses: actions/upload-release-asset@v1
|
||||||
run: |
|
with:
|
||||||
curl -X POST \
|
upload_url: ${{ steps.release.outputs.upload_url }}
|
||||||
-H "Authorization: token ${{ secrets.LIBSM64_TOKEN }}" \
|
asset_path: artifacts/libsm64_linux.zip
|
||||||
-F "attachment=@libsm64_linux/run-test" \
|
asset_name: libsm64_linux.zip
|
||||||
"https://git.nepu.men/api/v1/repos/NepuShiro/libsm64/releases/${{ steps.create_release.outputs.release_id }}/assets?name=run-test-linux"
|
asset_content_type: application/zip
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||||
|
|
||||||
- name: Upload Windows artifact
|
- name: Upload Windows artifact
|
||||||
shell: bash
|
uses: actions/upload-release-asset@v1
|
||||||
run: |
|
with:
|
||||||
tar -czf windows.tar.gz libsm64_windows
|
upload_url: ${{ steps.release.outputs.upload_url }}
|
||||||
curl -X POST \
|
asset_path: artifacts/libsm64_windows.zip
|
||||||
-H "Authorization: token ${{ secrets.LIBSM64_TOKEN }}" \
|
asset_name: libsm64_windows.zip
|
||||||
-F "attachment=@windows.tar.gz" \
|
asset_content_type: application/zip
|
||||||
"https://git.nepu.men/api/v1/repos/NepuShiro/libsm64/releases/${{ steps.create_release.outputs.release_id }}/assets?name=libsm64-windows.tar.gz"
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||||
- name: Upload README
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
curl -X POST \
|
|
||||||
-H "Authorization: token ${{ secrets.LIBSM64_TOKEN }}" \
|
|
||||||
-F "attachment=@README.md" \
|
|
||||||
"https://git.nepu.men/api/v1/repos/NepuShiro/libsm64/releases/${{ steps.create_release.outputs.release_id }}/assets?name=README.md"
|
|
||||||
Reference in New Issue
Block a user