ci: Improvements

Make into one yml, rename to CI;
 if conditions and search filtering make multiple ymls unneeded.
Build all branches.
Ignore unrelated files.
Build with VS2019 and VS2017.
Set fail-fast to false.
Add Debug configuration, and reorder configurations to be consistent.
Don't use master version of actions.
Fetch submodules with new addition to checkout action.
Build in the build directory.
Use -j to potentially speed up building.
Use default shell/robocopy for artifact preparation.
Add SDL2 to artifacts.
Add artifacts for PRs.
Only do artifacts for Release.
Change artifact path to artifacts. (the trailing slash isn't needed)
Change artifact name.
Add release creation job:
 This creates a release with VS2019 and VS2017 builds using a CI-shortcommithash tag;
 For example, CI-31d4ea3
 This job is only ran for commits (push) to master, not pull requests, other branches, or forks.

Add badge to README
This commit is contained in:
Margen67 2020-03-19 00:43:18 -07:00 committed by Margen67
parent 43a1d0182d
commit 78e51a7f01
4 changed files with 116 additions and 55 deletions

115
.github/workflows/CI.yml vendored Normal file
View File

@ -0,0 +1,115 @@
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: # TODO: Remove develop once rebased
if: github.event.action != 'pull_request' && github.ref == 'refs/heads/develop' || '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
7z a -mx1 $env:artifact-1.zip .\$env:artifact-1\*
7z a -mx1 $env:artifact-2.zip .\$env:artifact-2\*
echo "::set-env name=short_commit_sha::$(git rev-parse --short HEAD)"
- 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

View File

@ -1,34 +0,0 @@
name: Release Artifacts
on:
push:
branches: develop
jobs:
windows:
name: Windows
runs-on: windows-latest
strategy:
matrix:
configuration: [Release]
steps:
- uses: actions/checkout@master
- name: Generate cmake files
run: |
git submodule update --init --recursive --force
mkdir build && cd build
cmake .. -G "Visual Studio 16 2019" -A Win32
- name: Build
run: cmake --build build/ --config ${{ matrix.configuration }}
- name: Organize artifact files
shell: bash
run: |
mkdir dist
cp {COPYING,README.md} dist/
cd build/bin/${{ matrix.configuration }}
[ "${{ matrix.configuration }}" = "Debug" ] && sdl="SDL2d.dll" || sdl=SDL2.dll; cp {Cxbx.exe,glew32.dll,subhook.dll,$sdl} ../../../dist/
cp {cxbxr-debugger.exe,capstone.dll,cs_x86.dll} ../../../dist/
- uses: actions/upload-artifact@master
with:
name: CXBX-R-${{ matrix.configuration }}-${{ github.sha }}
path: dist/

View File

@ -1,21 +0,0 @@
name: Verify PR Builds
on: pull_request
jobs:
windows:
name: Windows
runs-on: windows-latest
strategy:
matrix:
configuration: [Debug, Release]
steps:
- uses: actions/checkout@master
- name: Generate cmake files
run: |
git submodule update --init --recursive --force
mkdir build && cd build
cmake .. -G "Visual Studio 16 2019" -A Win32
- name: Build
run: cmake --build build/ --config ${{ matrix.configuration }}

View File

@ -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)