Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Release Packages Automatically #252

Merged
merged 1 commit into from
May 19, 2024
Merged

Conversation

eXpl0it3r
Copy link
Member

@eXpl0it3r eXpl0it3r commented May 19, 2024

This is another step in automating releases. This prepares packages as we've been releasing as pre-built binaries for Windows and macOS. For Linux it's still advised to use official packages or build from source due to glibc and other compatibility issues.

For macOS was unable build for older macOS SDK version as we used to. With Apple not providing any reasonable support in this area and them heavily pushing users to new OS versions, I don't necessarily see this in our responsibility.

In case anyone wants to try. I got stuck on the compiler not finding the <ostream> header 🤷

    macos:
        name: macOS
        runs-on: macos-14

        steps:
            - name: Cache macOS SDK 10.15
              id: macosx-10-15-sdk
              uses: actions/cache@v4
              with:
                  path: ${{ github.workspace }}/MacOSX10.15.sdk
                  key: macosx-10-15-sdk

            - name: Download macOS SDK 10.15
              if: steps.macosx-10-15-sdk.outputs.cache-hit != 'true'
              run: |
                curl -Lo MacOSX10.15.sdk.tar.xz https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX10.15.sdk.tar.xz
                tar -xvf MacOSX10.15.sdk.tar.xz

            - name: Install macOS SDK 10.15
              run: |
                  sudo mv MacOSX10.15.sdk /Applications/Xcode_15.0.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/

            - name: Checkout SFML
              uses: actions/checkout@v4
              with:
                  repository: SFML/SFML
                  ref: 2.6.1
                  path: SFML

            - name: Checkout CSFML
              uses: actions/checkout@v4
              with:
                  path: CSFML

            - name: Build SFML x64
              run: |
                  cmake -S SFML -B SFML-build-x64 -G "Unix Makefiles" \
                        -DCMAKE_C_COMPILER="/usr/bin/clang" \
                        -DCMAKE_CXX_COMPILER="/usr/bin/clang++" \
                        -DCMAKE_C_FLAGS="-stdlib=libc++" \
                        -DCMAKE_CXX_FLAGS="-stdlib=libc++" \
                        -DBUILD_SHARED_LIBS=TRUE \
                        -DCMAKE_BUILD_TYPE=Release \
                        -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/SFML-x64/Library/Frameworks \
                        -DCMAKE_OSX_ARCHITECTURES=x86_64 \
                        -DCMAKE_OSX_SYSROOT=/Applications/Xcode_15.0.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/ \
                        -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 \
                        -DSFML_BUILD_FRAMEWORKS=TRUE \
                        -DCMAKE_VERBOSE_MAKEFILE=ON
                  cmake --build SFML-build-x64 --config Release --target install

            - name: Build CSFML x64
              run: |
                  cmake -S CSFML -B CSFML-build-x64 -G "Unix Makefiles" \
                        -DCMAKE_C_COMPILER="/usr/bin/clang" \
                        -DCMAKE_CXX_COMPILER="/usr/bin/clang++" \
                        -DCMAKE_C_FLAGS="-stdlib=libc++" \
                        -DCMAKE_CXX_FLAGS="-stdlib=libc++" \
                        -DBUILD_SHARED_LIBS=TRUE \
                        -DSTATIC_STD_LIBS=FALSE \
                        -DCSFML_LINK_SFML_STATICALLY=FALSE \
                        -DCMAKE_BUILD_TYPE=Release \
                        -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/CSFML-x64 \
                        -DCMAKE_OSX_ARCHITECTURES=x86_64 \
                        -DCMAKE_OSX_SYSROOT=/Applications/Xcode_15.0.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/ \
                        -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 \
                        -DSFML_DIR=${{ github.workspace }}/SFML-x64/Library/Frameworks/SFML.framework/Resources/CMake \
                        -DCMAKE_VERBOSE_MAKEFILE=ON
                  cmake --build CSFML-build-x64 --config Release --target install

            - name: Create x64 Archive
              run: |
                  mkdir CSFML-macOS-clang-64-bit
                  cp -R CSFML-x64/include CSFML-macOS-clang-64-bit
                  cp -R CSFML-x64/lib CSFML-macOS-clang-64-bit
                  cp CSFML-x64/share/CSFML/* CSFML-macOS-clang-64-bit
                  tar -zcvf CSFML-macOS-clang-64-bit.tar.gz CSFML-macOS-clang-64-bit

            - name: Upload Artifact x64
              uses: actions/upload-artifact@v4
              with:
                  name: CSFML-macOS-clang-64-bit
                  path: CSFML-macOS-clang-64-bit.tar.gz

@eXpl0it3r eXpl0it3r changed the base branch from master to 2.6.x May 19, 2024 17:50
@eXpl0it3r
Copy link
Member Author

Failures are due to me first targeting master 😅

@eXpl0it3r eXpl0it3r merged commit 586fb28 into 2.6.x May 19, 2024
18 of 36 checks passed
@eXpl0it3r eXpl0it3r deleted the feature/release-builds branch May 19, 2024 20:52
Comment on lines +4 to +5
push:
branches:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: We use 2 space indentations for GitHub Actions YAML code

Comment on lines +210 to +214
cmake -S SFML -B SFML-build -G "Unix Makefiles" \
-DCMAKE_C_COMPILER="/usr/bin/clang" \
-DCMAKE_CXX_COMPILER="/usr/bin/clang++" \
-DCMAKE_C_FLAGS="-stdlib=libc++" \
-DCMAKE_CXX_FLAGS="-stdlib=libc++" \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These choices for generator, compiler, and standard library are already the defaults on macOS so we can omit these arguments if we want.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm I did get different results when I was playing with SDKs for the standard library and compiler, but I guess it's not needed for the standard case

.github/workflows/release.yml Show resolved Hide resolved
@eXpl0it3r eXpl0it3r added this to the 2.6.1 milestone Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants