Testing that the Gem Loads #20
Workflow file for this run
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
# I have no idea what I'm doing | |
name: Build Gem | |
on: | |
push: | |
branches: ['dev', 'build-gem'] | |
tags: ['*'] | |
paths-ignore: ['*.md', '*.json', '*.png'] | |
pull_request: | |
branches: ['dev', 'build-gem'] | |
paths-ignore: ['*.md', '*.json', '*.png'] | |
jobs: | |
build-windows: | |
name: Windows - Build | |
runs-on: windows-latest | |
steps: | |
- uses: benjlevesque/[email protected] | |
id: short-sha | |
with: | |
length: 7 | |
- uses: msys2/setup-msys2@v2 | |
with: | |
msystem: ucrt64 | |
install: >- | |
base-devel | |
git | |
ruby | |
vim | |
mingw-w64-ucrt-x86_64-cmake | |
mingw-w64-ucrt-x86_64-meson | |
mingw-w64-ucrt-x86_64-autotools | |
mingw-w64-ucrt-x86_64-gcc | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
windows/build-mingw64 | |
windows/downloads | |
key: win-gem-${{ hashFiles('windows/Makefile') }} | |
- name: Build all dependencies | |
shell: msys2 {0} | |
run: | | |
cd windows | |
make | |
- name: Build Ruby gem | |
shell: msys2 {0} | |
run: | | |
source windows/vars.sh | |
meson build -Dbuild_gem=true | |
cd build | |
ninja install | |
strip ./mkxpz.so | |
cd .. | |
gem build mkxp-z.gemspec | |
- name: Install sonar-scanner and build-wrapper | |
uses: SonarSource/sonarcloud-github-c-cpp@v2 | |
- name: Run sonar-scanner | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: | | |
sonar-scanner --define sonar.cfamily.compile-commands=build/compile_commands.json --define sonar.projectKey=fcorso2016_mkxp-z_gem_windows | |
- name: Prepare archive | |
shell: msys2 {0} | |
run: | | |
mkdir build/artifact | |
cd build/artifact | |
cp /ucrt64/bin/zlib1.dll . | |
cp ../../mkxp-z-*.gem . | |
cp ../../mkxp.json . | |
cp -r ../../scripts . | |
cp -r ../../tests . | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: mkxp-z.windows.${{github.event_name == 'pull_request' && format('PR{0}', github.event.number) || github.ref_name}}-${{steps.short-sha.outputs.sha}} | |
path: | | |
build/artifact/*.dll | |
build/artifact/*.gem | |
build/artifact/mkxp.json | |
build/artifact/scripts/ | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: mkxp-z.windows.tests.${{github.event_name == 'pull_request' && format('PR{0}', github.event.number) || github.ref_name}}-${{steps.short-sha.outputs.sha}} | |
tests/ | |
Rakefile | |
test-windows: | |
name: Windows - Test | |
runs-on: windows-latest | |
needs: build-windows | |
steps: | |
- uses: benjlevesque/[email protected] | |
id: short-sha | |
with: | |
length: 7 | |
- name: Install Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: '3.1' | |
- name: Download Built Gem | |
uses: actions/download-artifact@3 | |
with: | |
name: mkxp-z.windows.${{github.event_name == 'pull_request' && format('PR{0}', github.event.number) || github.ref_name}}-${{steps.short-sha.outputs.sha}} | |
- name: Download Tests | |
uses: actions/download-artifact@3 | |
with: | |
name: mkxp-z.windows.tests.${{github.event_name == 'pull_request' && format('PR{0}', github.event.number) || github.ref_name}}-${{steps.short-sha.outputs.sha}} | |
- name: Install Gem | |
run: | | |
cd build/artifact | |
$gem_file = @(gci mkxp-z-*.gem)[0] | |
gem install ${gem_file} | |
echo "${pwd}" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
- name: Test Gem | |
run: | | |
cd ../.. | |
rake | |
build-linux: | |
name: Ubuntu 22.04 - Build | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: benjlevesque/[email protected] | |
id: short-sha | |
with: | |
length: 7 | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
linux/build-x86_64 | |
linux/downloads | |
key: lin-gem-${{ hashFiles('linux/Makefile') }} | |
- name: Install apt dependencies | |
run: | | |
sudo apt update | |
sudo apt install git build-essential cmake meson autoconf automake libtool pkg-config ruby bison zlib1g-dev libbz2-dev xorg-dev libgl1-mesa-dev libasound2-dev libpulse-dev -y | |
- name: Build everything else | |
env: | |
CMAKE_EXTRA_ARGS: -DCMAKE_POSITION_INDEPENDENT_CODE=ON | |
EXTRA_CONFIG_OPTIONS: --with-pic | |
run: | | |
cd linux | |
make | |
- name: Build Ruby gem | |
run: | | |
source linux/vars.sh | |
meson build --bindir=. --prefix=$GITHUB_WORKSPACE/build/local -Dbuild_gem=true | |
cd build | |
ninja | |
ninja install | |
cd .. | |
gem build mkxp-z.gemspec | |
- name: Install sonar-scanner and build-wrapper | |
uses: SonarSource/sonarcloud-github-c-cpp@v2 | |
- name: Run sonar-scanner | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: | | |
sonar-scanner --define sonar.cfamily.compile-commands=build/compile_commands.json --define sonar.projectKey=fcorso2016_mkxp-z_gem_linux | |
- name: Prepare archive | |
run: | | |
cd build/local | |
cp ../../mkxp-z-*.gem . | |
cp ../../mkxp.json . | |
cp -r ../../scripts . | |
cd .. | |
zip -r local.zip local | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: mkxp-z.linux.${{github.event_name == 'pull_request' && format('PR{0}', github.event.number) || github.ref_name}}-${{steps.short-sha.outputs.sha}} | |
path: build/local.zip |