diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml new file mode 100644 index 000000000..ac7d109a9 --- /dev/null +++ b/.github/workflows/CI.yml @@ -0,0 +1,119 @@ +name: GitHub CI + +on: + push: + paths-ignore: + - '.github/CONTRIBUTING.md' + - '.github/FUNDING.md' + - '.github/ISSUE_TEMPLATE/*' + - 'doc/*' + - 'doc/*/*' + - '.appveyor.yml' + - '.azure-pipelines.yml' + - '.travis.yml' + - 'gen-msvc-project.bat' + - 'setup.bat' + pull_request: + paths-ignore: + - '.github/CONTRIBUTING.md' + - '.github/FUNDING.md' + - '.github/ISSUE_TEMPLATE/*' + - 'doc/*' + - 'doc/*/*' + - '.appveyor.yml' + - '.azure-pipelines.yml' + - '.travis.yml' + - 'gen-msvc-project.bat' + - 'setup.bat' + +jobs: + build-windows: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + configuration: [Release, Debug] + vsver: [VS2019, VS2017] + include: + - vsver: VS2019 + os: windows-latest + - vsver: VS2017 # TODO: Remove VS2017 once WINE supports VS2019 runtimes; + os: windows-2016 # https://github.com/actions/virtual-environments/issues/68#issuecomment-602652021 + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + - name: Generate cmake files + run: | + mkdir build && cd build + cmake .. -A Win32 + - name: Build + working-directory: build + run: cmake --build . --config ${{ matrix.configuration }} -j $env:NUMBER_OF_PROCESSORS + - name: Prepare artifacts + if: matrix.configuration == 'Release' + run: | + robocopy . artifacts COPYING README.md /r:0 /w:0 + robocopy build\bin\${{ matrix.configuration }} artifacts ` + Cxbx.exe glew32.dll subhook.dll SDL2.dll ` + cxbxr-debugger.exe capstone.dll cs_x86.dll /r:0 /w:0 + If ($LastExitCode -le 7) { $LastExitCode = 0 } + - uses: actions/upload-artifact@v1 + if: matrix.configuration == 'Release' + with: + name: CxbxReloaded-${{ matrix.configuration }}-${{ matrix.vsver }} + path: artifacts + + release: + if: | # TODO: Remove develop once rebased + github.event.action != 'pull_request' && + (github.ref == 'refs/heads/develop' || + github.ref == 'refs/heads/master') && + github.repository == 'Cxbx-Reloaded/Cxbx-Reloaded' + needs: build-windows + env: + artifact_1: CxbxReloaded-Release-VS2019 + artifact_2: CxbxReloaded-Release-VS2017 + runs-on: windows-latest + steps: + - uses: actions/checkout@v2 + - name: Download artifacts (1) + uses: actions/download-artifact@v1 + with: + name: ${{ env.artifact_1 }} + - name: Download artifacts (2) + uses: actions/download-artifact@v1 + with: + name: ${{ env.artifact_2 }} + - name: Prepare artifacts for release + run: | # download-artifact doesn't download a zip, so rezip it + echo "::set-env name=short_commit_sha::$(git rev-parse --short HEAD)" + 7z a -mx1 "$env:artifact_1.zip" ".\$env:artifact_1\*" + 7z a -mx1 "$env:artifact_2.zip" ".\$env:artifact_2\*" + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: CI-${{ env.short_commit_sha }} + release_name: CI-${{ env.short_commit_sha }} + prerelease: true + - name: Upload Release Asset (1) + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ${{ env.artifact_1 }}.zip + asset_name: ${{ env.artifact_1 }}.zip + asset_content_type: application/zip + - name: Upload Release Asset (2) + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ${{ env.artifact_2 }}.zip + asset_name: ${{ env.artifact_2 }}.zip + asset_content_type: application/zip diff --git a/README.md b/README.md index c3437f411..7d5f9be16 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ # Cxbx-Reloaded - Original Xbox Emulator [![License: GPL v2](https://img.shields.io/badge/License-GPL%20v2-blue.svg)](https://img.shields.io/badge/License-GPL%20v2-blue.svg) +[![GitHub Actions](https://github.com/Cxbx-Reloaded/Cxbx-Reloaded/workflows/CI/badge.svg)](https://github.com/Cxbx-Reloaded/Cxbx-Reloaded/actions) [![AppVeyor](https://ci.appveyor.com/api/projects/status/iao43irxl3umbp33?svg=true)](https://ci.appveyor.com/project/SoullessSentinel/cxbx-reloaded) [![Azure](https://Cxbx-Reloaded.visualstudio.com/Cxbx-Reloaded/_apis/build/status/Cxbx-Reloaded.Cxbx-Reloaded?branchName=develop)](https://Cxbx-Reloaded.visualstudio.com/Cxbx-Reloaded/_build/latest?definitionId=7&branchName=develop) [![Travis](https://travis-ci.org/Cxbx-Reloaded/Cxbx-Reloaded.svg?branch=develop)](https://travis-ci.org/Cxbx-Reloaded/Cxbx-Reloaded)