CI: Run new CI on pull requests #38
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
name: Build (New) | ||
on: | ||
push: | ||
branches: [ '*' ] | ||
pull_request: | ||
branches: [ '*' ] | ||
types: [ opened, synchronize, reopened ] | ||
permissions: | ||
contents: write | ||
jobs: | ||
build: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
program: | ||
- ares | ||
config: | ||
- RelWithDebInfo | ||
platform: | ||
- name: windows-x64 | ||
os: windows-latest | ||
compiler: clang++ | ||
shell: 'msys2 {0}' | ||
msystem: clang64 | ||
install: mingw-w64-clang-x86_64-clang | ||
target-cmake-preset: windows-ci-mingw-native | ||
- name: windows-x64-gcc | ||
os: windows-latest | ||
compiler: g++ | ||
shell: 'msys2 {0}' | ||
msystem: mingw64 | ||
install: mingw-w64-x86_64-toolchain | ||
target-cmake-preset: windows-ci-mingw-native | ||
- name: windows-clang-cl-x64 | ||
os: windows-latest | ||
windres: rc | ||
shell: bash | ||
target-cmake-preset: windows-ci-cl-native | ||
- name: windows-clang-cl-arm64 | ||
os: windows-latest | ||
windres: rc | ||
shell: bash | ||
target-cmake-preset: windows-ci-cl-cross | ||
native-cmake-preset: windows-ci-cl-native | ||
- name: windows-msvc-x64 | ||
os: windows-latest | ||
windres: rc | ||
shell: bash | ||
target-cmake-preset: windows-ci-msvc-native | ||
- name: windows-msvc-arm64 | ||
os: windows-latest | ||
windres: rc | ||
shell: bash | ||
target-cmake-preset: windows-ci-msvc-cross | ||
native-cmake-preset: windows-ci-msvc-native | ||
- name: macos-universal | ||
os: macos-15 | ||
compiler: clang++ | ||
shell: sh | ||
install: cmake ccache xcbeautify | ||
target-cmake-preset: macos-ci-universal | ||
- name: ubuntu | ||
os: ubuntu-latest | ||
compiler: g++ | ||
shell: bash | ||
install: cmake ccache ninja-build libsdl2-dev libgtk-3-dev libao-dev libopenal-dev | ||
target-cmake-preset: ubuntu-ci | ||
name: ${{ matrix.program }}-${{ matrix.platform.name }} | ||
runs-on: ${{ matrix.platform.os }} | ||
defaults: | ||
run: | ||
shell: ${{ matrix.platform.shell }} | ||
steps: | ||
- name: Install MSYS2 Dependencies | ||
if: matrix.platform.shell == 'msys2 {0}' | ||
uses: msys2/setup-msys2@v2 | ||
with: | ||
msystem: ${{ matrix.platform.msystem }} | ||
install: make git cmake ccache ninja ${{ matrix.platform.install }} | ||
- name: "macOS: Import Certificate" | ||
if: runner.os == 'macOS' | ||
uses: apple-actions/import-codesign-certs@v3 | ||
permissions: | ||
contents: write | ||
continue-on-error: ${{ github.repository != 'ares-emulator/ares' }} | ||
with: | ||
p12-file-base64: ${{ secrets.MACOS_CERTIFICATE_DATA }} | ||
p12-password: ${{ secrets.MACOS_CERTIFICATE_PASSPHRASE }} | ||
- name: Checkout source code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-tags: true | ||
fetch-depth: 0 | ||
- name: Install Linux Dependencies | ||
if: runner.os == 'Linux' | ||
run: | | ||
sudo apt-get update -y -qq | ||
sudo apt-get install ${{ matrix.platform.install }} | ||
- name: Install macOS Dependencies | ||
if: runner.os == 'macOS' | ||
run: | | ||
brew install ${{ matrix.platform.install }} | ||
- name: "Build: Linux" | ||
if: runner.os == 'Linux' | ||
run: .github/scripts/build_ubuntu.sh | ||
env: | ||
TARGET_PRESET: ${{ matrix.platform.target-cmake-preset }} | ||
- name: "Build: Windows" | ||
if: runner.os != 'macOS' && runner.os != 'Linux' | ||
run: .github/scripts/build_windows.sh | ||
env: | ||
CROSS_COMPILE: ${{ matrix.platform.native-cmake-preset != '' }} | ||
NATIVE_PRESET: ${{ matrix.platform.native-cmake-preset }} | ||
TARGET_PRESET: ${{ matrix.platform.target-cmake-preset }} | ||
- name: "Build: macOS" | ||
if: runner.os == 'macOS' | ||
run: .github/scripts/build_macos.sh | ||
env: | ||
TARGET_PRESET: ${{ matrix.platform.target-cmake-preset }} | ||
MACOS_CERTIFICATE_NAME: ${{ secrets.MACOS_CERTIFICATE_NAME }} | ||
MACOS_NOTARIZATION_TEAMID: ${{ secrets.MACOS_NOTARIZATION_TEAMID }} | ||
MACOS_KEYCHAIN_NAME: ares-macos-keychain | ||
MACOS_KEYCHAIN_PASSWORD: ${{ secrets.MACOS_KEYCHAIN_PASSWORD }} | ||
- name: "Windows: sign" | ||
if: runner.os == 'Windows' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) | ||
uses: DanaBear/code-sign-action@98c79121b376beab8d6a9484f445089db4461bca | ||
with: | ||
certificate: '${{ secrets.WIN_CERTIFICATE }}' | ||
password: '${{ secrets.WIN_PASSWORD }}' | ||
certificatesha1: '${{ secrets.WIN_CERTHASH }}' | ||
certificatename: '${{ secrets.WIN_CERTNAME }}' | ||
folder: 'build/desktop-ui/rundir/' | ||
timestampUrl: 'http://timestamp.digicert.com' | ||
- name: "macOS: notarize" | ||
if: runner.os == 'macOS' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) | ||
continue-on-error: ${{ github.repository != 'ares-emulator/ares' }} | ||
run: | | ||
ditto -c -k --keepParent ${{ github.workspace }}/build/desktop-ui/RelWithDebInfo/ares.app /tmp/ares.zip | ||
xcrun notarytool submit /tmp/ares.zip --apple-id "$MACOS_NOTARIZATION_USERNAME" --password "$MACOS_NOTARIZATION_PASSWORD" --team-id "$MACOS_NOTARIZATION_TEAMID" --wait | ||
xcrun stapler staple ${{ github.workspace }}/build/desktop-ui/RelWithDebInfo/ares.app | ||
env: | ||
MACOS_NOTARIZATION_USERNAME: ${{ secrets.MACOS_NOTARIZATION_USERNAME }} | ||
MACOS_NOTARIZATION_PASSWORD: ${{ secrets.MACOS_NOTARIZATION_PASSWORD }} | ||
MACOS_NOTARIZATION_TEAMID: ${{ secrets.MACOS_NOTARIZATION_TEAMID }} | ||
- name: Upload Build (Windows) | ||
if: runner.os != 'macOS' && runner.os != 'Linux' | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ matrix.program }}-${{ matrix.platform.name }} | ||
path: build/desktop-ui/rundir/* | ||
- name: Upload Build (macOS) | ||
if: runner.os == 'macOS' | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ matrix.program }}-${{ matrix.platform.name }} | ||
path: build/desktop-ui/RelWithDebInfo/ | ||
- name: Upload Debug Symbols (Windows) | ||
if: runner.os != 'macOS' && runner.os != 'Linux' | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ matrix.program }}-${{ matrix.platform.name }}-PDBs | ||
path: build/PDBs/* | ||
- name: Upload Debug Symbols (macOS) | ||
if: runner.os == 'macOS' | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ matrix.program }}-${{ matrix.platform.name }}-dSYMs | ||
path: build/dSYMs/* | ||
release: | ||
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') | ||
runs-on: ubuntu-latest | ||
needs: | ||
- build | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
path: 'src' | ||
- name: Download Artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
path: 'bin' | ||
- name: Package Artifacts | ||
run: src/.github/scripts/package_artifacts.sh | ||
- name: Check Release Tag ☑️ | ||
id: check | ||
run: | | ||
if [[ ${GITHUB_REF_NAME} == master ]]; | ||
then | ||
echo "tag=nightly" >> $GITHUB_OUTPUT | ||
now=$(date +'%Y-%m-%d') | ||
versionName="nightly ${now}" | ||
echo "versionName=${versionName}" >> $GITHUB_OUTPUT | ||
else | ||
echo "tag=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT | ||
echo "versionName=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT | ||
fi | ||
- name: Create Release 🛫 | ||
id: create_release | ||
uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191 | ||
with: | ||
draft: ${{ github.ref != 'refs/heads/master' }} | ||
tag_name: ${{ steps.check.outputs.tag }} | ||
name: ares ${{ steps.check.outputs.versionName }} | ||
files: | | ||
${{ github.workspace }}/ares-macos-universal.zip | ||
${{ github.workspace }}/ares-macos-universal-dSYMs.zip | ||
${{ github.workspace }}/ares-windows-x64.zip | ||
${{ github.workspace }}/ares-windows-x64-PDBs.zip | ||
${{ github.workspace }}/ares-windows-clang-cl-x64.zip | ||
${{ github.workspace }}/ares-windows-clang-cl-x64-PDBs.zip | ||
${{ github.workspace }}/ares-windows-clang-cl-arm64.zip | ||
${{ github.workspace }}/ares-windows-clang-cl-arm64-PDBs.zip |