Skip to content

Commit

Permalink
[github_actions] enabled actions for all supported platforms.
Browse files Browse the repository at this point in the history
[commandline.c|fileio.c] added support for recent version of GCC and
clang that available at the msys2.
  • Loading branch information
TheVice committed Mar 10, 2024
1 parent dc9bfc7 commit 110957c
Show file tree
Hide file tree
Showing 3 changed files with 116 additions and 0 deletions.
112 changes: 112 additions & 0 deletions .github/workflows/make.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: make

on:
pull_request:
branches: [ dev ]
push:

jobs:
make-test-macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4

- name: clangtest
run: make clangtest

- name: test
run: make test

- name: sanitize
run: make sanitize

- name: max13test
run: make max13test

make-test-ubuntu:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup environment
run: |
sudo apt-get update -qq
sudo apt-get install -qq clang
sudo apt-get install -qq g++-multilib
sudo apt-get install -qq gcc-multilib
sudo apt-get install -qq valgrind
sudo apt-get install -qq make
sudo apt-get install -qq gcc-arm-linux-gnueabi
- name: clangtest
run: make clangtest

- name: armtest
run: make armtest

- name: gpptest
run: make gpptest

- name: test
run: make test

- name: sanitize
run: make sanitize

- name: max13test
run: make max13test

make-test-windows:
runs-on: windows-latest
strategy:
fail-fast: false # 'false' means Don't stop matrix workflows even if some matrix failed.
matrix:
include: [
{ compiler: gcc, cpp_compiler: g++, msystem: MINGW64 },
{ compiler: clang, cpp_compiler: clang++, msystem: MINGW64 },
]
defaults:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v4
- uses: msys2/setup-msys2@cc11e9188b693c2b100158c3322424c4cc1dadea # tag=v2.22.0
with:
msystem: ${{ matrix.msystem }}
install: make diffutils
update: true

# Based on https://ariya.io/2020/07/on-github-actions-with-msys2
- name: install mingw gcc x86_64
if: ${{ (matrix.compiler == 'gcc') }}
run: pacman --noconfirm -S mingw-w64-x86_64-gcc

- name: install mingw clang x86_64
if: ${{ (matrix.compiler == 'clang') }}
run: pacman --noconfirm -S mingw-w64-x86_64-clang

- name: clangtest
if: ${{ (matrix.compiler == 'clang') }}
run: |
export CC=${{ matrix.compiler }}
export CXX=${{ matrix.cpp_compiler }}
make clangtest
- name: gpptest
if: ${{ (matrix.compiler == 'gcc') }}
run: |
export CC=${{ matrix.compiler }}
export CXX=${{ matrix.cpp_compiler }}
make gpptest
- name: test
run: |
export CC=${{ matrix.compiler }}
export CXX=${{ matrix.cpp_compiler }}
make test
- name: max13test
run: |
export CC=${{ matrix.compiler }}
export CXX=${{ matrix.cpp_compiler }}
make max13test
2 changes: 2 additions & 0 deletions programs/commandline.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,10 @@
# include <fcntl.h> /* _O_BINARY */
# include <io.h> /* _setmode, _isatty */
# ifdef __MINGW32__
# if ((!defined(__clang__)) && __GNUC__ < 9) || (defined(__clang__) && __clang_major__ < 10)
int _fileno(FILE *stream); /* MINGW somehow forgets to include this windows declaration into <stdio.h> */
# endif
# endif
# define SET_BINARY_MODE(file) _setmode(_fileno(file), _O_BINARY)
# define IS_CONSOLE(stdStream) _isatty(_fileno(stdStream))
#else
Expand Down
2 changes: 2 additions & 0 deletions programs/fileio.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,10 @@
# include <fcntl.h> // _O_BINARY
# include <io.h> // _setmode, _isatty
# ifdef __MINGW32__
# if ((!defined(__clang__)) && __GNUC__ < 9) || (defined(__clang__) && __clang_major__ < 10)
int _fileno(FILE *stream); // MINGW somehow forgets to include this windows declaration into <stdio.h>
# endif
# endif
# define SET_BINARY_MODE(file) { int unused = _setmode(_fileno(file), _O_BINARY); (void)unused; }
# define IS_CONSOLE(stdStream) _isatty(_fileno(stdStream))
#else
Expand Down

0 comments on commit 110957c

Please sign in to comment.