Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add action to upload built patch files #325

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 39 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,50 +6,80 @@ on:

env:
BUILD_TYPE: Release
WORKING_DIRECTORY: ${{ github.workspace }}/build
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure we need that var. It is not a working dir in every step so its name may be confusing. Maybe it should be BUILD_DIR?
But from docs I also see that they don't prefix it with ${{github.workspace}} so it is pretty much BUILD_DIR: ./build. With such a simple value I'm not convinced it actually brings much value.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I introduced this global variable as this path is used in multiple places. This is only for consistency and to not repeat.

I agree that the name is not the best. Do you want me to revert this change or only change the variable's name?


jobs:
build-mingw:
runs-on: ubuntu-24.04

steps:

- name: Install packages
run: |
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install --no-install-recommends g++-mingw-w64-i686-posix ninja-build wine32 wine
shell: bash
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why set shell everywhere? On Linux it is Bash by default

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, I'll remove it from build-mingw.

What about Windows? Do I keep it as an explicit value, as Git provides a Bash shell within Windows-based runners?


- uses: actions/checkout@v4

- name: Set Current Git Commit Head SHA
run: echo "GIT_CURRENT_COMMIT_HEAD_SHA=$(git rev-parse --short=10 HEAD)" >> $GITHUB_ENV
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--short by default uses 8 characters, that's probably enough?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. In fact, I will remove this flag as it is optional.

shell: bash

- name: Create Build Environment
run: cmake -E make_directory ${{github.workspace}}/build
run: cmake -E make_directory ${{ env.WORKING_DIRECTORY }}
shell: bash

- name: Configure CMake
working-directory: ${{github.workspace}}/build
working-directory: ${{ env.WORKING_DIRECTORY }}
run: cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_TOOLCHAIN_FILE=../cmake/mingw-ubuntu.cmake
shell: bash

- name: Print nproc
run: nproc
shell: bash

- name: Build
working-directory: ${{github.workspace}}/build
working-directory: ${{ env.WORKING_DIRECTORY }}
run: cmake --build . -j $(nproc)
shell: bash

- name: Upload Patch Files
uses: actions/upload-artifact@v4
with:
compression-level: 9
if-no-files-found: error
name: dashfaction-${{ env.GIT_CURRENT_COMMIT_HEAD_SHA }}-mingw
path: ${{ env.WORKING_DIRECTORY }}/bin

build-msvc:
runs-on: windows-latest

steps:
- uses: actions/checkout@v4

- name: Set Current Git Commit Head SHA
run: echo "GIT_CURRENT_COMMIT_HEAD_SHA=$(git rev-parse --short=10 HEAD)" >> $GITHUB_ENV
shell: bash

- name: Create Build Environment
run: cmake -E make_directory ${{github.workspace}}/build
run: cmake -E make_directory ${{ env.WORKING_DIRECTORY }}
shell: bash

- name: Configure CMake
shell: cmd
working-directory: ${{github.workspace}}/build
working-directory: ${{ env.WORKING_DIRECTORY }}
run: cmake .. -A Win32
shell: bash

- name: Build
shell: cmd
working-directory: ${{github.workspace}}/build
working-directory: ${{ env.WORKING_DIRECTORY }}
run: cmake --build . --config %BUILD_TYPE% -j 4
shell: bash

- name: Upload Patch Files
uses: actions/upload-artifact@v4
with:
compression-level: 9
if-no-files-found: error
name: dashfaction-${{ env.GIT_CURRENT_COMMIT_HEAD_SHA }}-msvc
path: ${{ env.WORKING_DIRECTORY }}/bin