Skip to content

Commit

Permalink
Workflows refactor, added release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
DarkWanderer committed Jul 22, 2024
1 parent 1a23dad commit 94bd5db
Show file tree
Hide file tree
Showing 4 changed files with 175 additions and 76 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Nightly

on:
workflow_dispatch:
schedule:
- cron: "13 01 * * *"

permissions:
contents: write
actions: read

jobs:
build:
name: Build
uses: ./.github/workflows/reusable-build.yml
strategy:
fail-fast: false
matrix:
architecture: [x64, x86]
with:
architecture: ${{ matrix.architecture }}
upload: true

publish:
name: Package
needs: [build, build]
runs-on: windows-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4

- name: Re-arrange artifacts
shell: cmd
run: |
dir /S /B
move Orbiter-x64\Orbiter.zip Orbiter-x64.zip
move Orbiter-x86\Orbiter.zip Orbiter-x86.zip
dir /S /B
- name: "Create nightly release"
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ github.token }}"
automatic_release_tag: "latest"
prerelease: true
title: "Orbiter development build"
files: |
Orbiter-x86.zip
Orbiter-x64.zip
24 changes: 24 additions & 0 deletions .github/workflows/on-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: On Push

on:
push:
branches:
- main
paths-ignore: [ 'Doc/**', 'Flights/**', 'Html/**', 'Images/**', 'Localdoc/**', 'Scenarios/**', 'Textures/**', 'Textures2/**']
pull_request:
branches:
- main
paths-ignore: [ 'Doc/**', 'Flights/**', 'Html/**', 'Images/**', 'Localdoc/**', 'Scenarios/**', 'Textures/**', 'Textures2/**']

jobs:
build:
name: Push
strategy:
fail-fast: false
matrix:
architecture: [x64, x86]
os: [windows-2019, windows-2022] # Why do we need multiple Windows versions?
uses: ./.github/workflows/reusable-build.yml
with:
os: ${{ matrix.os }}
architecture: ${{ matrix.architecture }}
64 changes: 64 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Release

on:
workflow_dispatch:
inputs:
version:
required: true
type: string
default: 2024.1.0

run-name: Release ${{ inputs.version }}

permissions:
actions: read
contents: write

env:
artifact-name: Orbiter-${{ inputs.version }}.zip

jobs:
build:
name: Build
uses: ./.github/workflows/reusable-build.yml
strategy:
fail-fast: false
matrix:
architecture: [x64, x86]
with:
architecture: ${{ matrix.architecture }}
upload: true

package:
name: Package
needs: [build]
runs-on: ubuntu-latest
permissions:
actions: read
contents: write
steps:
- uses: actions/download-artifact@v4
with:
name: Orbiter-x86
path: Orbiter-x86

- uses: actions/download-artifact@v4
with:
name: Orbiter-x64
path: Orbiter-x64

- run: |
find .
mv Orbiter-x86/Orbiter.zip Orbiter-x86.zip
mv Orbiter-x64/Orbiter.zip Orbiter-x64.zip
- name: "Create nightly release"
uses: softprops/action-gh-release@v2
with:
body: https://orbiter.voron.software/downloads/Orbiter-${{ inputs.version }}.zip
tag_name: ${{ inputs.version }}
prerelease: false
name: Orbiter ${{ inputs.version }}
files: |
Orbiter-x86.zip
Orbiter-x64.zip
114 changes: 38 additions & 76 deletions .github/workflows/build.yml → .github/workflows/reusable-build.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,33 @@
name: Build

on:
push:
branches:
- main
paths-ignore: [ 'Doc/**', 'Flights/**', 'Html/**', 'Images/**', 'Localdoc/**', 'Scenarios/**', 'Textures/**', 'Textures2/**']
pull_request:
branches:
- main
paths-ignore: [ 'Doc/**', 'Flights/**', 'Html/**', 'Images/**', 'Localdoc/**', 'Scenarios/**', 'Textures/**', 'Textures2/**']
workflow_call:
inputs:
os:
default: windows-2019
type: string
architecture:
description: 'Build Architecture'
default: x86
type: string
upload:
description: Upload resulting artifact?
type: boolean
default: false

run-name: Build ${{ inputs.architecture }} on ${{ inputs.os }}

permissions:
contents: read

jobs:
build:
name: Build
runs-on: ${{ inputs.os }}

env:
DXSDK_DIR: "${{ github.workspace }}\\DXSDK"

strategy:
fail-fast: false
matrix:
architecture: [x64, x86]
os: [windows-2019, windows-2022]

runs-on: ${{ matrix.os }}

steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -37,7 +40,7 @@ jobs:
- name: Setup MSVC Console
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.architecture }}
arch: ${{ inputs.architecture }}

- name: Create directories
run: |
Expand All @@ -47,8 +50,8 @@ jobs:
- name: Cache irrKlang package
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/Extern/irrKlang/${{ matrix.architecture }}
key: irrKlang-${{ matrix.architecture }}
path: ${{ github.workspace }}/Extern/irrKlang/${{ inputs.architecture }}
key: irrKlang-${{ inputs.architecture }}

- name: Cache DirectX SDK
id: cache
Expand All @@ -68,16 +71,16 @@ jobs:
dir /S /B DXSDK
- name: Configure
run: cmake . --preset windows-${{ matrix.architecture }}-release -DORBITER_MAKE_DOC=OFF -DDXSDK_DIR:PATH="${{ github.workspace }}\\DXSDK"
run: cmake . --preset windows-${{ inputs.architecture }}-release -DORBITER_MAKE_DOC=OFF -DDXSDK_DIR:PATH="${{ github.workspace }}\\DXSDK"

- name: Build
run: cmake --build --preset windows-${{ matrix.architecture }}-release --jobs 2
run: cmake --build --preset windows-${{ inputs.architecture }}-release --jobs 2

- name: Test
run: ctest --preset windows-${{ matrix.architecture }}-release --jobs 2
run: ctest --preset windows-${{ inputs.architecture }}-release --parallel 2

- name: Install
working-directory: ${{ github.workspace }}/out/build/windows-${{ matrix.architecture }}-release
working-directory: ${{ github.workspace }}/out/build/windows-${{ inputs.architecture }}-release
run: cmake --install . --prefix ${{ github.workspace }}/out/install

- name: List exports
Expand All @@ -91,71 +94,30 @@ jobs:
del /Q exports_tmp*.txt
- name: Diff exports with Orbiter 2016
if: ${{ matrix.architecture == 'x86' }}
if: ${{ inputs.architecture == 'x86' }}
shell: cmd
continue-on-error: true
run: git diff -U0 --ignore-cr-at-eol --ignore-space-at-eol --no-index exports.2016.txt out/install/Orbiter/exports.txt

- name: Upload exports
if: ${{ matrix.os == 'windows-2019' }}
uses: actions/upload-artifact@v4
with:
name: exports-${{ matrix.architecture }}
path: ${{ github.workspace }}/out/install/Orbiter/exports.txt
retention-days: 1

- name: Pack
if: ${{ github.ref == 'refs/heads/main' }}
working-directory: ${{ github.workspace }}/out/install/Orbiter
shell: cmd
run: '7z a "${{ github.workspace }}/out/Orbiter.zip" .'

- name: Upload exports
if: inputs.upload
uses: actions/upload-artifact@v4
with:
name: exports-${{ inputs.architecture }}
path: ${{ github.workspace }}/out/install/Orbiter/exports.txt
retention-days: 1

- name: Upload Build Artifact
if: ${{ github.ref == 'refs/heads/main' && matrix.os == 'windows-2019' }}
uses: actions/upload-artifact@v4
if: inputs.upload
with:
name: Orbiter-${{ matrix.architecture }}
name: Orbiter-${{ inputs.architecture }}
# A file, directory or wildcard pattern that describes what to upload
path: ${{ github.workspace }}/out/Orbiter.zip
retention-days: 60

pre-release:
name: Publish pre-release

needs: build

runs-on: ubuntu-latest

if: ${{ github.ref == 'refs/heads/main' }}

steps:
- name: Create directories
run: mkdir out

- name: Checkout
uses: actions/checkout@v4

- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: ./out

- name: Re-arrange artifacts
run: |
mv ./Orbiter-x64/Orbiter.zip ./Orbiter-x64.zip
mv ./Orbiter-x86/Orbiter.zip ./Orbiter-x86.zip
rmdir Orbiter-x64
rmdir Orbiter-x86
ls -R
working-directory: ./out

- name: "Push pre-release tag and upload packages"
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest"
prerelease: true
title: "Orbiter development build"
files: |
./out/Orbiter-x86.zip
./out/Orbiter-x64.zip
retention-days: 1

0 comments on commit 94bd5db

Please sign in to comment.