Cxbx-Reloaded/.github/workflows/CI.yml

82 lines
2.4 KiB
YAML

name: GitHub CI
on:
push:
paths-ignore:
- '.github/*'
- '.github/*_TEMPLATE/**'
- '*.bat'
- '*.yml'
- 'doc/**'
pull_request:
paths-ignore:
- '.github/*'
- '.github/*_TEMPLATE/**'
- '*.bat'
- '*.yml'
- 'doc/**'
jobs:
build-windows:
runs-on: ${{ matrix.os }}
env:
POWERSHELL_TELEMETRY_OPTOUT: 1
strategy:
fail-fast: false
matrix:
configuration: [Release, Debug]
vsver: [VS2019, VS2017]
include:
- vsver: VS2019
os: windows-latest
- vsver: VS2017
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: cmake -B build -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'
working-directory: build
run: cmake --install . --config ${{ matrix.configuration }} --prefix ../artifacts
- uses: actions/upload-artifact@v2
if: matrix.configuration == 'Release'
with:
name: CxbxReloaded-${{ matrix.configuration }}-${{ matrix.vsver }}
path: artifacts/bin
if-no-files-found: error
release:
if: |
github.event.action != 'pull_request' &&
github.ref == 'refs/heads/master' &&
github.repository == 'Cxbx-Reloaded/Cxbx-Reloaded'
needs: build-windows
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Download Artifacts
uses: actions/download-artifact@v2
with:
path: artifacts
- name: Re-zip Artifacts
id: git
run: |
for artifact in artifacts/*; do
7z a $artifact.zip "./$artifact/*"
if [[ $(stat -c %s $artifact.zip) -le 1000 ]]; then
echo "Error: Archive $artifact.zip too small!"
exit 1
fi
done
echo "::set-output name=tag_name::CI-$(git rev-parse --short HEAD)"
- name: Create Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release create ${{ steps.git.outputs.tag_name }} artifacts/*.zip -p --target $GITHUB_SHA --title '${{ steps.git.outputs.tag_name }}'