raylib/.github/workflows/linux.yml

112 lines
3.6 KiB
YAML
Raw Normal View History

2020-08-17 22:03:58 +03:00
name: Linux
on:
workflow_dispatch:
2020-08-19 18:22:15 +03:00
push:
paths:
- 'src/**'
- 'examples/**'
- '.github/workflows/linux.yml'
2020-08-19 18:22:15 +03:00
pull_request:
paths:
- 'src/**'
- 'examples/**'
- '.github/workflows/linux.yml'
2020-08-19 18:22:15 +03:00
release:
types: [published]
permissions:
contents: read
jobs:
build:
permissions:
contents: write # for actions/upload-release-asset to upload release asset
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 1
matrix:
bits: [32, 64]
include:
- bits: 32
2020-08-20 19:31:16 +03:00
ARCH: "i386"
2020-08-18 16:24:20 +03:00
ARCH_NAME: "i386"
2020-08-20 19:11:44 +03:00
COMPILER_PATH: "/user/bin"
- bits: 64
2020-08-20 18:45:28 +03:00
ARCH: "x86_64"
2020-08-20 19:11:44 +03:00
ARCH_NAME: "amd64"
COMPILER_PATH: "/user/bin"
env:
2020-08-21 14:16:32 +03:00
RELEASE_NAME: raylib-dev_linux_${{ matrix.ARCH_NAME }}
steps:
- name: Checkout code
uses: actions/checkout@master
2020-08-21 14:16:32 +03:00
- name: Setup Release Version
run: |
2020-12-25 04:04:18 +03:00
echo "RELEASE_NAME=raylib-${{ github.event.release.tag_name }}_linux_${{ matrix.ARCH_NAME }}" >> $GITHUB_ENV
2020-08-21 14:16:32 +03:00
shell: bash
if: github.event_name == 'release' && github.event.action == 'published'
- name: Setup Environment
run: |
2020-08-20 19:50:23 +03:00
sudo apt-get update -qq
2020-08-20 20:05:17 +03:00
sudo apt-get install gcc-multilib
2020-08-20 19:50:23 +03:00
sudo apt-get install -y --no-install-recommends libglfw3 libglfw3-dev libx11-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev libxext-dev libxfixes-dev
mkdir build
cd build
2020-08-18 14:20:48 +03:00
mkdir ${{ env.RELEASE_NAME }}
cd ${{ env.RELEASE_NAME }}
mkdir include
mkdir lib
2020-08-18 14:20:48 +03:00
cd ../../../raylib
2020-08-20 19:37:38 +03:00
# ${{ matrix.ARCH }}-linux-gnu-gcc -v
2021-12-29 21:01:20 +03:00
# TODO: Support 32bit (i386) static/shared library building
2020-08-20 20:30:05 +03:00
- name: Build Library
run: |
cd src
2021-12-29 21:05:23 +03:00
make PLATFORM=PLATFORM_DESKTOP CC=gcc RAYLIB_LIBTYPE=STATIC RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" CUSTOM_CFLAGS="-m32" -B
2020-08-20 20:30:05 +03:00
# make PLATFORM=PLATFORM_DESKTOP CC=gcc RAYLIB_LIBTYPE=SHARED RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" -B
cd ..
if: matrix.bits == 32
2020-08-20 20:13:59 +03:00
- name: Build Library
2020-08-20 00:16:18 +03:00
run: |
cd src
2021-09-22 01:56:58 +03:00
make PLATFORM=PLATFORM_DESKTOP CC=gcc RAYLIB_LIBTYPE=STATIC RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" -B
2020-08-20 20:21:51 +03:00
make PLATFORM=PLATFORM_DESKTOP CC=gcc RAYLIB_LIBTYPE=SHARED RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" -B
2020-08-20 00:16:18 +03:00
cd ..
2020-08-20 20:30:05 +03:00
if: matrix.bits == 64
2020-08-17 22:05:42 +03:00
- name: Generate Artifacts
run: |
2020-08-18 14:20:48 +03:00
cp -v ./src/raylib.h ./build/${{ env.RELEASE_NAME }}/include
2021-11-04 22:08:25 +03:00
cp -v ./src/raymath.h ./build/${{ env.RELEASE_NAME }}/include
cp -v ./src/rlgl.h ./build/${{ env.RELEASE_NAME }}/include
cp -v ./CHANGELOG ./build/${{ env.RELEASE_NAME }}/CHANGELOG
2021-02-09 17:53:56 +03:00
cp -v ./README.md ./build/${{ env.RELEASE_NAME }}/README.md
cp -v ./LICENSE ./build/${{ env.RELEASE_NAME }}/LICENSE
2020-08-18 14:20:48 +03:00
cd build
2020-08-18 16:21:42 +03:00
tar -czvf ${{ env.RELEASE_NAME }}.tar.gz ${{ env.RELEASE_NAME }}
2020-08-17 22:05:42 +03:00
- name: Upload Artifacts
2022-11-28 23:03:21 +03:00
uses: actions/upload-artifact@v3
with:
2020-08-18 14:20:48 +03:00
name: ${{ env.RELEASE_NAME }}.tar.gz
2020-08-18 15:03:05 +03:00
path: ./build/${{ env.RELEASE_NAME }}.tar.gz
2020-08-19 18:22:15 +03:00
- name: Upload Artifact to Release
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
2020-08-19 19:47:58 +03:00
asset_path: ./build/${{ env.RELEASE_NAME }}.tar.gz
asset_name: ${{ env.RELEASE_NAME }}.tar.gz
asset_content_type: application/gzip
2020-08-19 18:22:15 +03:00
if: github.event_name == 'release' && github.event.action == 'published'