Merge pull request #4444 from joncampbell123/dependabot/github_action… #2097
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: macOS builds | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
permissions: | |
contents: read | |
jobs: | |
macOS_CI_build: | |
permissions: | |
actions: write # for styfle/cancel-workflow-action to cancel/stop running workflows | |
contents: read # for actions/checkout to fetch code | |
if: github.event_name == 'push' || github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' | |
runs-on: macos-12 | |
steps: | |
- name: Cancel previous runs | |
uses: styfle/[email protected] | |
with: | |
access_token: ${{ github.token }} | |
- uses: actions/checkout@v4 | |
- name: Install libraries | |
run: | | |
brew install autoconf automake nasm glfw glew sdl_net sdl2 coreutils | |
mkdir -p package/dosbox-x | |
mkdir -p package/dosbox-x-sdl2 | |
cd vs/sdlnet && ./build-dosbox.sh | |
- name: Update build info | |
run: | | |
echo "timestamp=`git show -s --format=%at | xargs -I# gdate -d @# +%Y%m%d%H%M%S`" >> $GITHUB_ENV | |
export shortsha=`echo ${GITHUB_SHA} | cut -c1-7` | |
export copyrightyear=`git show -s --format=%at | xargs -I# gdate -d @# +'%Y'` | |
export updatestr=`git show -s --format=%at | xargs -I# gdate -d @# +'%b %d, %Y %I:%M:%S%P'` | |
echo '/* auto generated */' > include/build_timestamp.h | |
echo "#define UPDATED_STR \"${updatestr}\"" >> include/build_timestamp.h | |
echo "#define GIT_COMMIT_HASH \"${shortsha}\"" >> include/build_timestamp.h | |
echo "#define COPYRIGHT_END_YEAR \"${copyrightyear}\"" >> include/build_timestamp.h | |
cat include/build_timestamp.h | |
- name: Build macOS SDL1 | |
run: | | |
top=`pwd` | |
./build-macos | |
strip $top/src/dosbox-x | |
make dosbox-x.app | |
mv dosbox-x.app $top/package/dosbox-x | |
- name: Build macOS SDL2 | |
run: | | |
top=`pwd` | |
./build-macos-sdl2 | |
strip $top/src/dosbox-x | |
make dosbox-x.app | |
mv dosbox-x.app $top/package/dosbox-x-sdl2 | |
- name: Unit testing | |
run: | | |
top=`pwd` | |
chmod +x $top/package/dosbox-x/dosbox-x.app/Contents/MacOS/dosbox-x $top/package/dosbox-x-sdl2/dosbox-x.app/Contents/MacOS/dosbox-x | |
$top/package/dosbox-x/dosbox-x.app/Contents/MacOS/dosbox-x -tests | |
$top/package/dosbox-x-sdl2/dosbox-x.app/Contents/MacOS/dosbox-x -tests | |
- name: Package build | |
run: | | |
top=`pwd` | |
cp $top/CHANGELOG $top/package/dosbox-x/CHANGELOG.txt | |
cp $top/COPYING $top/package/dosbox-x/COPYING.txt | |
cp $top/contrib/macos/readme.txt $top/package/dosbox-x/README.txt | |
cp $top/CHANGELOG $top/package/dosbox-x-sdl2/CHANGELOG.txt | |
cp $top/COPYING $top/package/dosbox-x-sdl2/COPYING.txt | |
cp $top/contrib/macos/readme.txt $top/package/dosbox-x-sdl2/README.txt | |
cd $top/package/ | |
zip -r -9 $top/dosbox-x-macosx-x86_64-${{ env.timestamp }}.zip * | |
cd $top | |
- name: Upload preview package | |
uses: actions/[email protected] | |
with: | |
name: dosbox-x-macosx-x86_64-${{ env.timestamp }} | |
path: ${{ github.workspace }}/package/ | |
- name: Upload release package | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: dosbox-x-macosx-x86_64-${{ env.timestamp }}.zip |