diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 633837d07..4f2b8fccd 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -5,56 +5,83 @@ on: push: branches: - master + workflow_call: + inputs: + build-mode: + required: true + type: string + default: 'releasedbg' + upload-build-for-next-job: + required: true + type: boolean + default: false jobs: build: strategy: matrix: - os: [ubuntu-22.04] - arch: [x64] - mode: [debug] + include: + - arch: amd64 + runner: ubuntu-latest + - arch: arm64 + runner: ubuntu-24.04-arm - runs-on: ${{ matrix.os }} + runs-on: ${{ matrix.runner }} if: "!contains(github.event.head_commit.message, 'ci skip')" steps: - - uses: actions/checkout@v4 - - - name: Checkout submodules - run: | - git submodule sync --recursive - git submodule update --init --force --recursive --depth=1 - - # Install dependencies - - name: Update apt repositories - run: sudo apt-get update - - # Install xmake - - name: Setup xmake - uses: xmake-io/github-action-setup-xmake@v1 - with: - xmake-version: '2.9.8' - - # Update xmake repository (in order to have the file that will be cached) - - name: Update xmake repository - run: xmake repo --update - - # Setup compilation mode and install project dependencies - # (continue-on-error + timeout is a temporary solution until sentry-native is fixed; shouldn't affect the building step) - - name: Configure xmake and install dependencies - continue-on-error: true - run: timeout 15m xmake config --arch=${{ matrix.arch }} --mode=${{ matrix.mode }} --yes - - # Build the server - - name: Build - run: xmake -y - - # Create install - #- name: Install - # run: xmake install -o packaged - - # Upload artifacts - #- uses: actions/upload-artifact@v2 - # with: - # name: ${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.mode }} - # path: packaged/bin/** + - uses: actions/checkout@v4 + with: + # We need full history in order to create a version string (BuildInfo.h) + fetch-depth: 0 + + - name: Checkout submodules + run: | + git submodule sync --recursive + git submodule update --init --force --recursive --depth=1 + + - name: Checkout master on tag push + if: github.ref_type == 'tag' + # Checkout only if the tag was pushed to master + run: '[ "$(git rev-parse HEAD)" = "$(git rev-parse origin/master)" ] && git checkout master' + + - name: Cache xmake dependencies + uses: actions/cache@v4 + with: + path: ~/.xmake/packages + key: ${{ matrix.runner }}-xmake-${{ hashFiles('**/xmake.lua') }} + + # Install xmake + - name: Setup xmake + uses: xmake-io/github-action-setup-xmake@v1 + with: + xmake-version: 2.9.8 + actions-cache-folder: '.xmake-cache' # This doesn't cache dependencies, only xmake itself + actions-cache-key: ${{ matrix.runner }} + + - name: Configure xmake and install dependencies + run: xmake config --mode=${{ inputs.build-mode }} --yes -vD + + # Build the server + - name: Build + run: | + xmake -y + echo "STR_BUILD_DIR=build/linux/${{ matrix.arch }}/${{ inputs.build-mode }}" >> $GITHUB_ENV + + # Create install + - name: Output distrib binaries via xmake + run: | + xmake install -o packaged + mkdir -p ${{ env.STR_BUILD_DIR }} + cp packaged/lib/libSTServer.so ${{ env.STR_BUILD_DIR }}/ + cp packaged/bin/crashpad_handler ${{ env.STR_BUILD_DIR }}/ + cp packaged/bin/SkyrimTogetherServer ${{ env.STR_BUILD_DIR }}/ + + # Upload artifacts + - name: Upload build files for the next job + if: ${{ inputs.upload-build-for-next-job }} + uses: actions/upload-artifact@v4 + with: + name: internal-job-files-linux-${{ matrix.arch }}-${{ inputs.build-mode }} + retention-days: 1 + path: ${{ env.STR_BUILD_DIR }} diff --git a/.github/workflows/windows-playable-build.yml b/.github/workflows/windows-playable-build.yml index 2749cd965..c0d176fc7 100644 --- a/.github/workflows/windows-playable-build.yml +++ b/.github/workflows/windows-playable-build.yml @@ -12,43 +12,86 @@ on: - 'v[0-9]+\.[0-9]+\.[0-9]+' jobs: - build-windows: + prepare: if: ${{ github.repository_owner == 'tiltedphoques' || github.event_name != 'schedule' }} # Disable cron runs in forks + runs-on: ubuntu-latest + outputs: + version: ${{ steps.version.outputs.version }} + steps: + - uses: actions/checkout@v6 + with: + # We need full history in order to create a version string (BuildInfo.h) + fetch-depth: 0 + + - name: Store version in output + id: version + run: echo "version=$(git describe --tags)" >> $GITHUB_OUTPUT + + build-linux: + needs: prepare + uses: ./.github/workflows/linux.yml + with: + build-mode: 'release' + upload-build-for-next-job: true + + build-windows: + needs: prepare uses: ./.github/workflows/windows.yml with: build-mode: 'release' upload-build-for-next-job: true - package-and-upload: - runs-on: windows-latest - needs: build-windows + artifact-upload: + runs-on: ubuntu-latest + needs: [prepare, build-windows, build-linux] + strategy: + matrix: + include: + - platform: windows-x64 + filename: SkyrimTogether-Windows-x64 + - platform: DebugSymbols-x64 + filename: SkyrimTogether-DebugSymbols-x64 + - platform: linux-arm64 + filename: SkyrimTogether-Linux-server-arm64 + - platform: linux-amd64 + filename: SkyrimTogether-Linux-server-amd64 + steps: - name: Download artifact from the previous job uses: actions/download-artifact@v5 with: - name: internal-job-files - - - name: Package build and organize directories - run: | - mkdir -p str-build/SkyrimTogetherReborn - mv build/windows/x64/release/* str-build/SkyrimTogetherReborn - cp -r GameFiles/Skyrim/* str-build/ + name: internal-job-files-${{ matrix.platform }}-release - - name: Remove unnecessary build files, keep .pdb + - name: Package into zip run: | - mkdir str-pdb - mv str-build/SkyrimTogetherReborn/SkyrimTogether.pdb, str-build/SkyrimTogetherReborn/SkyrimTogetherServer.pdb str-pdb - rm str-build/SkyrimTogetherReborn/*.pdb, str-build/SkyrimTogetherReborn/*.lib, str-build/SkyrimTogetherReborn/*.exp - rm str-build/SkyrimTogetherReborn/*Tests.exe + zip -r "${{ matrix.filename }}_(${{ needs.prepare.outputs.version }}).zip" . - - name: Upload playable build + - name: Re-upload package artifact uses: actions/upload-artifact@v4 with: - name: Skyrim Together Build (${{ needs.build-windows.outputs.str-version }}) - path: str-build/ + name: Skyrim Together Build ${{ matrix.platform }} (${{ needs.prepare.outputs.version }}) + path: ${{ matrix.filename }}_(${{ needs.prepare.outputs.version }}).zip - - name: Upload debug symbols - uses: actions/upload-artifact@v4 + release-upload: + if: github.ref_type == 'tag' + needs: [prepare, artifact-upload] + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Download all artifact + uses: actions/download-artifact@v5 with: - name: Debug Symbols (${{ needs.build-windows.outputs.str-version }}) - path: str-pdb/ + path: release-files + pattern: Skyrim Together* + merge-multiple: true + + - name: Create GitHub Release + run: | + gh release create ${{ needs.prepare.outputs.version }} \ + ./release-files/* \ + --title "Release ${{ needs.prepare.outputs.version }}" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 817b6732e..68b214f14 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -5,7 +5,6 @@ on: push: branches: - master - - prerel workflow_call: inputs: build-mode: @@ -16,10 +15,6 @@ on: required: true type: boolean default: false - outputs: - str-version: - description: "Skyrim Together version string" - value: ${{ jobs.build.outputs.version }} jobs: build: @@ -31,9 +26,6 @@ jobs: runs-on: ${{ matrix.os }} if: "!contains(github.event.head_commit.message, 'ci skip')" - outputs: - version: ${{ steps.output-version.outputs.version }} - steps: - uses: actions/checkout@v4 with: @@ -99,15 +91,33 @@ jobs: pnpm --prefix Code/skyrim_ui/ deploy:production cp -r Code/skyrim_ui/dist/UI ${{ env.STR_BUILD_DIR }} - - id: output-version - run: echo "version=$(git describe --tags)" >> $env:GITHUB_OUTPUT + - name: Package build and organize directories + shell: bash + run: | + mkdir -p str-build/SkyrimTogetherReborn str-pdb + mv "${{ env.STR_BUILD_DIR }}"/* str-build/SkyrimTogetherReborn/ + cp -r GameFiles/Skyrim/* str-build/ + + - name: Remove unnecessary build files, keep .pdb + shell: bash + run: | + mv str-build/SkyrimTogetherReborn/SkyrimTogether.pdb str-pdb/ 2>/dev/null || true + mv str-build/SkyrimTogetherReborn/SkyrimTogetherServer.pdb str-pdb/ 2>/dev/null || true + rm -f str-build/SkyrimTogetherReborn/*.pdb str-build/SkyrimTogetherReborn/*.lib str-build/SkyrimTogetherReborn/*.exp + rm -f str-build/SkyrimTogetherReborn/*Tests.exe + + - name: Upload Windows build artifact + if: ${{ inputs.upload-build-for-next-job }} + uses: actions/upload-artifact@v4 + with: + name: internal-job-files-windows-${{ matrix.arch }}-${{ inputs.build-mode }} + retention-days: 1 + path: str-build/ - - name: Upload build files for the next job + - name: Upload Windows debug symbols artifact if: ${{ inputs.upload-build-for-next-job }} uses: actions/upload-artifact@v4 with: - name: internal-job-files + name: internal-job-files-DebugSymbols-${{ matrix.arch }}-${{ inputs.build-mode }} retention-days: 1 - path: | - ${{ env.STR_BUILD_DIR }} - GameFiles/Skyrim/ + path: str-pdb/