Commit 0244bceb

0244bcebe851Merged

Yasuhiro Matsumoto <[email protected]> · 7 months ago · 1 file · +1 added

Description

ci: add GitHub Actions workflow for build and test

Run the build and feature tests on Linux (gcc/clang), macOS (clang), and Windows (MinGW64/gcc) on every push and PR to master.

Details

Commit
0244bcebe851
Parent
43bb35fe5d04

.github/workflows/ci.ymladdedView file

1+name: CI
2+
3+on:
4+ push:
5+ branches: [master]
6+ pull_request:
7+ branches: [master]
8+
9+jobs:
10+ posix:
11+ name: ${{ matrix.os }} / ${{ matrix.cc }}
12+ runs-on: ${{ matrix.os }}
13+ strategy:
14+ fail-fast: false
15+ matrix:
16+ include:
17+ - os: ubuntu-latest
18+ cc: gcc
19+ - os: ubuntu-latest
20+ cc: clang
21+ - os: macos-latest
22+ cc: clang
23+ env:
24+ CC: ${{ matrix.cc }}
25+ steps:
26+ - uses: actions/checkout@v4
27+
28+ - name: Set up Ruby
29+ uses: ruby/setup-ruby@v1
30+ with:
31+ ruby-version: "3.3"
32+
33+ - name: Install prism gem (codegen bootstrap step 2 needs it)
34+ run: gem install prism -v 1.9.0
35+
36+ - name: Expose GNU coreutils on PATH (macOS)
37+ if: runner.os == 'macOS'
38+ run: echo "/opt/homebrew/opt/coreutils/libexec/gnubin" >> "$GITHUB_PATH"
39+
40+ - name: Fetch libprism sources
41+ run: make deps
42+
43+ - name: Build (parse + regexp + bootstrap)
44+ run: make -j$(getconf _NPROCESSORS_ONLN) all
45+
46+ - name: Run tests
47+ run: make test
48+
49+ windows-mingw:
50+ name: windows-mingw
51+ runs-on: windows-latest
52+ defaults:
53+ run:
54+ shell: msys2 {0}
55+ env:
56+ CC: gcc
57+ steps:
58+ - uses: actions/checkout@v4
59+
60+ - name: Set up MSYS2 (MINGW64)
61+ uses: msys2/setup-msys2@v2
62+ with:
63+ msystem: MINGW64
64+ update: false
65+ install: >-
66+ base-devel
67+ mingw-w64-x86_64-toolchain
68+ mingw-w64-x86_64-ruby
69+ make
70+ diffutils
71+ curl
72+ tar
73+
74+ - name: Show toolchain
75+ run: |
76+ uname -a
77+ gcc --version
78+ ruby --version
79+ make --version | head -1
80+
81+ - name: Install prism gem (codegen bootstrap step 2 needs it)
82+ run: gem install prism -v 1.9.0
83+
84+ - name: Fetch libprism sources
85+ run: make deps
86+
87+ - name: Build (parse + regexp + bootstrap)
88+ run: make -j$(nproc) all
89+
90+ - name: Run tests
91+ run: make test