Skip to content

[CI/CD] Update and fix actions, add macOS arm64 build #58

[CI/CD] Update and fix actions, add macOS arm64 build

[CI/CD] Update and fix actions, add macOS arm64 build #58

Workflow file for this run

name: build
on:
# Run on pushes to tags, the "master" branch, and PR's
push:
branches:
- master
paths-ignore:
- '**.md'
- '*.txt'
- '.gitignore'
pull_request:
paths-ignore:
- '**.md'
- '*.txt'
- '.gitignore'
workflow_dispatch:
jobs:
windows:
name: ${{ matrix.build_type }} Windows ${{ matrix.arch }}
runs-on: windows-2019
strategy:
matrix:
build_type: [Release]
arch: [ x86 ]
include:
- arch: x86
platform: Win32
pkg_suffix: x86
steps:
- uses: actions/checkout@v4
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v2
- name: Create Build Environment
run: cmake -E make_directory ${{runner.workspace}}/build
- name: Configure CMake
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake $GITHUB_WORKSPACE -A ${{ matrix.platform }} -T v141_xp
- name: Build
working-directory: ${{runner.workspace}}/build
shell: bash
run: cmake --build . --config ${{ matrix.build_type }}
- name: Install
working-directory: ${{runner.workspace}}/build
shell: bash
run: cmake --install . --config ${{ matrix.build_type }}
- name: Update readme
working-directory: ${{runner.workspace}}/jaMME/build/mme
shell: bash
run: |
sed -i "s/Date: .*..*..*/Date: $(date +"%d.%m.%Y")/" readme.txt
sed -i "s/Revision: .*/Revision: "$(git rev-parse --short HEAD)"/" readme.txt
- name: Create binary archive
working-directory: ${{runner.workspace}}/jaMME/build
shell: bash
run: |
rm start_jaMME.command
rm start_jaMME.sh
- uses: actions/upload-artifact@v4
with:
name: jamme-windows-${{ matrix.arch }}
path: ${{runner.workspace}}/jaMME/build/
if-no-files-found: error
ubuntu:
name: ${{ matrix.config }} Ubuntu ${{ matrix.arch }}
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
arch: [x86, x86_64]
cc: [gcc]
cxx: [g++]
include:
- config: Release
rule: install
- arch: x86
use_sdl: true
- arch: x86_64
use_sdl: true
steps:
- uses: actions/checkout@v4
- name: Create Build Environment
run: |
if [ ${{ matrix.arch }} == "x86" ]; then
sudo dpkg --add-architecture i386
sudo apt-get -qq update
sudo apt-get -y install aptitude
sudo apt-get -y install --allow-downgrades libpcre2-8-0=10.34-7 gcc-multilib g++-multilib ninja-build libjpeg-dev:i386 libpng-dev:i386 libcurl4-openssl-dev:i386 libmad0-dev:i386
sudo aptitude -y install libglib2.0-dev:i386 libsdl2-dev:i386
else
sudo apt-get -qq update
sudo apt-get install libjpeg-dev libpng-dev zlib1g-dev libsdl2-dev libmad0-dev
fi
cmake -E make_directory ${{runner.workspace}}/build
- name: Configure CMake
shell: bash
working-directory: ${{runner.workspace}}/build
run: |
if [ ${{ matrix.arch }} == "x86" ]; then
cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DBuildAIO=OFF -DBuildCurl=OFF -DCMAKE_INSTALL_PREFIX=${{runner.workspace}}/install -DCMAKE_TOOLCHAIN_FILE=CMakeModules/Toolchains/linux-i686.cmake
else
cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DBuildAIO=OFF -DBuildCurl=OFF -DCMAKE_INSTALL_PREFIX=${{runner.workspace}}/install
fi
- name: Build
working-directory: ${{runner.workspace}}/build
shell: bash
run: cmake --build .
- name: Install
working-directory: ${{runner.workspace}}/build
shell: bash
run: cmake --install .
- name: Update readme
working-directory: ${{runner.workspace}}/jaMME/build/mme
shell: bash
run: |
sed -i "s/Date: .*..*..*/Date: $(date +"%d.%m.%Y")/" readme.txt
sed -i "s/Revision: .*/Revision: "$(git rev-parse --short HEAD)"/" readme.txt
- name: Create binary archive
working-directory: ${{runner.workspace}}/jaMME/build
shell: bash
run: |
chmod +x jamme
chmod +x start_jaMME.sh
rm start_jaMME.command
rm start_jaMME.cmd
tar -cvf jamme-linux-${{ matrix.arch }}.tar ./*
- uses: actions/upload-artifact@v4
if: matrix.cc == 'gcc' && matrix.config == 'Release'
with:
name: jamme-linux-${{ matrix.arch }}
path: ${{runner.workspace}}/jaMME/build/jamme-linux-${{ matrix.arch }}.tar
if-no-files-found: error
macos:
name: ${{ matrix.config }} macOS ${{ matrix.arch }}
runs-on: macos-13
strategy:
fail-fast: false
matrix:
arch: [x86_64]
cc: [clang]
cxx: [clang++]
include:
- config: Release
rule: install
steps:
- uses: actions/checkout@v4
- name: Create Build Environment
run: |
brew install zlib libjpeg sdl2
cmake -E make_directory ${{runner.workspace}}/build
- name: Configure CMake
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${{runner.workspace}}/install
- name: Build
working-directory: ${{runner.workspace}}/build
shell: bash
run: cmake --build .
- name: Install
working-directory: ${{runner.workspace}}/build
shell: bash
run: cmake --install .
- name: Update readme
working-directory: ${{runner.workspace}}/jaMME/build/mme
shell: bash
run: |
sed -i.bak "s/Date: .*..*..*/Date: $(date +"%d.%m.%Y")/" readme.txt
sed -i.bak "s/Revision: .*/Revision: "$(git rev-parse --short HEAD)"/" readme.txt
rm readme.txt.bak
- name: Create binary archive
working-directory: ${{runner.workspace}}/jaMME/build
shell: bash
run: |
chmod +x jamme.app/Contents/MacOS/jamme
chmod +x start_jaMME.command
rm start_jaMME.cmd
rm start_jaMME.sh
tar -cvf jamme-macos-${{ matrix.arch }}.tar ./*
- uses: actions/upload-artifact@v4
if: matrix.cc == 'clang' && matrix.config == 'Release'
with:
name: jamme-macos-${{ matrix.arch }}
path: ${{runner.workspace}}/jaMME/build/jamme-macos-${{ matrix.arch }}.tar
if-no-files-found: error
create-release:
if: github.ref == 'refs/heads/master' && github.event_name == 'push' || github.event_name == 'workflow_dispatch'
needs: [windows, ubuntu, macos]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Download Artifacts
uses: actions/download-artifact@v4
- name: Display structure of downloaded files
run: ls -R
- name: Create binary archives
run: |
7z a -r jamme-linux-x86.zip ./jamme-linux-x86/*
7z a -r jamme-linux-x86_64.zip ./jamme-linux-x86_64/*
7z a -r jamme-windows-x86.zip ./jamme-windows-x86/*
7z a -r jamme-macos-x86_64.zip ./jamme-macos-x86_64/*
- name: Create latest build
uses: crowbarmaster/GH-Automatic-Releases@latest
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
automatic_release_tag: "latest"
prerelease: false
title: Latest Build
files: |
*.zip