diff --git a/.github/workflows/build-cmake-conan.yml b/.github/workflows/build-cmake-conan.yml index 5e8dad94..53650970 100644 --- a/.github/workflows/build-cmake-conan.yml +++ b/.github/workflows/build-cmake-conan.yml @@ -1,9 +1,12 @@ -name: re3 conan+cmake +name: re3 conan+cmake build + on: pull_request: push: + branches: [ main ] release: - types: published + types: [published] + jobs: build-cmake: strategy: @@ -13,105 +16,128 @@ jobs: platform: 'gl3' gl3_gfxlib: 'glfw' audio: 'openal' -# - os: 'windows-latest' -# platform: 'gl3' -# gl3_gfxlib: 'sdl2' -# audio: 'openal' + # - os: 'windows-latest' + # platform: 'gl3' + # gl3_gfxlib: 'sdl2' + # audio: 'openal' - os: 'windows-latest' platform: 'd3d9' audio: 'openal' -# - os: 'windows-latest' -# platform: 'd3d9' -# audio: 'miles' - - os: 'ubuntu-18.04' + # - os: 'windows-latest' + # platform: 'd3d9' + # audio: 'miles' + - os: 'ubuntu-22.04' # Updated from 18.04 (EOL) platform: 'gl3' gl3_gfxlib: 'glfw' audio: 'openal' -# - os: 'ubuntu-18.04' -# platform: 'gl3' -# gl3_gfxlib: 'sdl2' -# audio: 'openal' + # - os: 'ubuntu-22.04' + # platform: 'gl3' + # gl3_gfxlib: 'sdl2' + # audio: 'openal' - os: 'macos-latest' platform: 'gl3' gl3_gfxlib: 'glfw' audio: 'openal' -# - os: 'macos-latest' -# platform: 'gl3' -# gl3_gfxlib: 'sdl2' -# audio: 'openal' + # - os: 'macos-latest' + # platform: 'gl3' + # gl3_gfxlib: 'sdl2' + # audio: 'openal' runs-on: ${{ matrix.os }} continue-on-error: ${{ matrix.platform == 'ps2' || matrix.gl3_gfxlib == 'sdl2' || matrix.audio == 'miles' }} + steps: - - uses: actions/checkout@v2 + - name: Checkout code + uses: actions/checkout@v4 with: - submodules: true - - name: "Checkout Miles SDK Import Library project" - uses: actions/checkout@v2 + submodules: recursive + + - name: Checkout Miles SDK if: ${{ matrix.audio == 'miles' }} + uses: actions/checkout@v4 with: repository: 'withmorten/re3mss' path: 're3mss' - - uses: actions/setup-python@v2 + + - name: Set up Python + uses: actions/setup-python@v4 with: python-version: '3.x' - - name: "Use XCode 11 as default (conan-center-index does not provide XCode 12 binaries at the moment)" - if: startsWith(matrix.os, 'macos') + + - name: Set Xcode 11 (macOS only) + if: runner.os == 'macOS' run: | sudo xcode-select --switch /Applications/Xcode_11.7.app - - name: "Setup conan" + + - name: Configure Conan run: | python -m pip install conan conan config init conan config set log.print_run_commands=True conan config set general.revisions_enabled=1 - conan remote add bincrafters https://bincrafters.jfrog.io/artifactory/api/conan/public-conan -# conan remote add madebr_ps2dev https://api.bintray.com/conan/madebr/ps2dev - - name: "Add os=playstation2 + gcc.version=3.2 to .conan/settings.yml" + conan profile detect --force + + - name: Update Conan settings shell: python run: | import os, yaml settings_path = os.path.expanduser("~/.conan/settings.yml") - yml = yaml.safe_load(open(settings_path)) - yml["os"]["playstation2"] = None - yml["compiler"]["gcc"]["version"].append("3.2") - yml["compiler"]["gcc"]["version"].sort() - yaml.safe_dump(yml, open(settings_path, "w")) - - name: "Create host profile" + with open(settings_path) as f: + yml = yaml.safe_load(f) + yml.setdefault("os", {}).setdefault("playstation2", None) + if "3.2" not in yml.get("compiler", {}).get("gcc", {}).get("version", []): + yml.setdefault("compiler", {}).setdefault("gcc", {}).setdefault("version", []).append("3.2") + yml["compiler"]["gcc"]["version"].sort() + with open(settings_path, "w") as f: + yaml.safe_dump(yml, f) + + - name: Prepare host profile shell: bash run: | - if test "${{ matrix.platform }}" = "ps2"; then + if [ "${{ matrix.platform }}" = "ps2" ]; then cp vendor/librw/conan/playstation2 host_profile else - cp ~/.conan/profiles/default host_profile + conan profile detect --force > host_profile fi - - name: "Export Playstation 2 CMake toolchain conan recipe" + + - name: Export conan recipes run: | conan export vendor/librw/cmake/ps2/cmaketoolchain ps2dev-cmaketoolchain/master@ - - name: "Export librw conan recipe" - run: | conan export vendor/librw librw/master@ - - name: "Export Miles SDK conan recipe" - if: ${{ matrix.audio == 'miles' }} + if [ "${{ matrix.audio }}" = "miles" ]; then + conan export re3mss miles-sdk/master@ + fi + + - name: Install dependencies run: | - conan export re3mss miles-sdk/master@ - - name: "Download/build dependencies (conan install)" - run: | - conan install ${{ github.workspace }} re3/master@ -if build -o re3:audio=${{ matrix.audio }} -o librw:platform=${{ matrix.platform }} -o librw:gl3_gfxlib=${{ matrix.gl3_gfxlib || 'glfw' }} --build missing -pr:h ./host_profile -pr:b default -s re3:build_type=RelWithDebInfo -s librw:build_type=RelWithDebInfo + conan install . re3/master@ \ + -if build \ + -o re3:audio=${{ matrix.audio }} \ + -o librw:platform=${{ matrix.platform }} \ + -o librw:gl3_gfxlib=${{ matrix.gl3_gfxlib || 'glfw' }} \ + --build missing \ + -pr:h ./host_profile \ + -pr:b default \ + -s re3:build_type=RelWithDebInfo \ + -s librw:build_type=RelWithDebInfo env: CONAN_SYSREQUIRES_MODE: enabled - - name: "Build re3 (conan build)" + + - name: Build project run: | - conan build ${{ github.workspace }} -if build -bf build -pf package - - name: "Package re3 (conan package)" + conan build . -if build -bf build -pf package + + - name: Create package run: | - conan package ${{ github.workspace }} -if build -bf build -pf package - - name: "Create binary package (cpack)" + conan package . -if build -bf build -pf package + + - name: Generate distributable package working-directory: ./build run: | cpack -C RelWithDebInfo - - name: "Archive binary package (github artifacts)" - uses: actions/upload-artifact@v2 + + - name: Upload artifact + uses: actions/upload-artifact@v4 with: - name: "${{ matrix.os }}-${{ matrix.platform }}" + name: "re3_${{ matrix.os }}_${{ matrix.platform }}_${{ matrix.audio }}" path: build/*.zip if-no-files-found: error