Skip to content

Commit bfae6ad

Browse files
committed
Testing for multiplatform
1 parent 41c9f67 commit bfae6ad

File tree

1 file changed

+40
-112
lines changed

1 file changed

+40
-112
lines changed
Lines changed: 40 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -1,136 +1,64 @@
11
#Testing
22

3-
name: CMake on multiple platforms
3+
name: CMake Multi-Platform
44

55
on:
6-
workflow_dispatch:
7-
pull_request:
8-
paths:
9-
- 'inflection/**'
10-
- '.github/workflows/**'
11-
- '!data/**'
12-
- '!documents/**'
13-
- '!fst/**'
146
push:
15-
branches:
16-
- main
17-
paths:
18-
- 'inflection/**'
19-
- '.github/workflows/**'
20-
21-
env:
22-
ICU_MAJOR: '77'
23-
ICU_MINOR: '1'
7+
branches: [ ghrotenPr167 ]
8+
pull_request:
249

2510
jobs:
26-
cache-icu:
27-
runs-on: ubuntu-latest
28-
steps:
29-
- uses: actions/cache/restore@v4
30-
id: cache
31-
with:
32-
path: ~/icu
33-
key: ${{ runner.os }}-icu-${ICU_MAJOR}-${ICU_MINOR}
34-
- name: Download and install icu
35-
if: steps.cache.outputs.cache-hit != 'true'
36-
run: |
37-
wget https://github.com/unicode-org/icu/releases/download/release-${ICU_MAJOR}-${ICU_MINOR}/icu4c-${ICU_MAJOR}_${ICU_MINOR}-Ubuntu22.04-x64.tgz
38-
export ICU=~/icu/
39-
mkdir -p $ICU
40-
echo "ICU directory is $ICU"
41-
cp icu4c-${ICU_MAJOR}_${ICU_MINOR}-Ubuntu22.04-x64.tgz $ICU
42-
pushd $ICU
43-
tar xvfz *.tgz
44-
rm *.tgz
45-
- uses: actions/cache/save@v4
46-
with:
47-
path: ~/icu
48-
key: ${{ runner.os }}-icu-${ICU_MAJOR}-${ICU_MINOR}
49-
5011
build:
51-
needs: cache-icu
5212
runs-on: ${{ matrix.os }}
5313
strategy:
54-
fail-fast: false
5514
matrix:
56-
os: [ubuntu-latest, macos-latest]
57-
build_type: [Release]
58-
c_compiler: [clang]
59-
include:
60-
- os: ubuntu-latest
61-
c_compiler: clang
62-
cpp_compiler: clang++
63-
- os: macos-latest
64-
c_compiler: clang
65-
cpp_compiler: clang++
15+
os: [ubuntu-22.04, macos-14]
16+
compiler: [clang]
17+
env:
18+
ICU_VERSION: "77_1"
6619

6720
steps:
68-
- uses: actions/checkout@v4
69-
70-
- name: Create Git LFS file list
71-
run: git lfs ls-files -l |cut -d' ' -f1 |sort >.git/lfs-hashes.txt
72-
73-
- name: Restore Git LFS object cache
74-
uses: actions/cache@v4
75-
id: lfscache
21+
- name: Checkout
22+
uses: actions/checkout@v4
7623
with:
77-
path: inflection/resources/org/unicode/inflection/dictionary
78-
key: ${{ runner.os }}-lfsdata-v1-${{ hashFiles('.git/lfs-hashes.txt') }}
79-
restore-keys: |
80-
${{ runner.os }}-lfsdata-v1-
81-
${{ runner.os }}-lfsdata
82-
83-
- name: Fetch any needed Git LFS objects and prune extraneous ones
84-
if: steps.lfscache.outputs.cache-hit != 'true'
85-
run: git lfs fetch --prune
24+
submodules: recursive
25+
lfs: true
8626

87-
- name: Check out Git LFS content
88-
if: steps.lfscache.outputs.cache-hit != 'true'
89-
run: git lfs checkout
90-
91-
- name: Check LFS restored files
92-
run: ls -l inflection/resources/org/unicode/inflection/dictionary/*
93-
94-
- name: Set reusable strings
95-
id: strings
96-
shell: bash
27+
- name: Set up Git LFS
9728
run: |
98-
echo "project-root-dir=${{ github.workspace }}/inflection" >> "$GITHUB_OUTPUT"
99-
echo "build-output-dir=${{ github.workspace }}/inflection/build" >> "$GITHUB_OUTPUT"
100-
echo "inflection-test-data-dir=${{ github.workspace }}/inflection/resources/org/unicode/inflection/dictionary" >> "$GITHUB_OUTPUT"
101-
102-
- uses: actions/cache/restore@v4
103-
id: cache
104-
with:
105-
path: ~/icu
106-
key: ${{ runner.os }}-icu-${ICU_MAJOR}-${ICU_MINOR}
29+
git lfs install
30+
git lfs pull
10731
108-
- name: Install ICU (Ubuntu/macos)
32+
- name: Set up ICU on Ubuntu
33+
if: runner.os == 'Linux'
10934
run: |
110-
if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
111-
echo "ICU_ROOT=$HOME/icu/icu/usr/local" >> $GITHUB_ENV
112-
elif [[ "${{ matrix.os }}" == "macos-latest" ]]; then
113-
brew list icu4c || brew install icu4c
114-
echo "ICU_ROOT=$(brew --prefix icu4c)" >> $GITHUB_ENV
115-
fi
35+
mkdir -p $HOME/icu
36+
cd $HOME/icu
37+
wget https://github.com/unicode-org/icu/releases/download/release-${ICU_VERSION//_/-}/icu4c-${ICU_VERSION}-Ubuntu22.04-x64.tgz
38+
tar -xzf icu4c-${ICU_VERSION}-Ubuntu22.04-x64.tgz
39+
echo "ICU_ROOT=$HOME/icu" >> $GITHUB_ENV
40+
echo "LD_LIBRARY_PATH=$HOME/icu/lib" >> $GITHUB_ENV
41+
42+
- name: Set up ICU on macOS
43+
if: runner.os == 'macOS'
44+
run: |
45+
brew install icu4c@77
46+
echo "ICU_ROOT=$(brew --prefix icu4c@77)" >> $GITHUB_ENV
47+
echo "DYLD_LIBRARY_PATH=$(brew --prefix icu4c@77)/lib" >> $GITHUB_ENV
11648
117-
- name: Configure CMake
118-
run: >
119-
cmake -B ${{ steps.strings.outputs.build-output-dir }}
120-
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
121-
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
122-
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
123-
-DINFLECTION_TEST_DATA_DIR=${{ steps.strings.outputs.inflection-test-data-dir }}
124-
-S ${{ steps.strings.outputs.project-root-dir }}
49+
- name: Create Build Directory
50+
run: mkdir build
12551

126-
- name: Get number of CPU cores
127-
uses: SimenB/github-actions-cpu-cores@v2
128-
id: cpu-cores
52+
- name: Configure CMake
53+
working-directory: build
54+
run: |
55+
cmake .. -DCMAKE_BUILD_TYPE=Release -DICU_ROOT=${{ env.ICU_ROOT }}
12956
13057
- name: Build
131-
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} -j ${{ steps.cpu-cores.outputs.count }}
58+
working-directory: build
59+
run: cmake --build . --config Release --parallel
13260

133-
- name: Test
134-
working-directory: ${{ steps.strings.outputs.build-output-dir }}
135-
run: cmake --build . -t check -j ${{ steps.cpu-cores.outputs.count }}
61+
- name: Run Tests
62+
working-directory: build
63+
run: ctest --output-on-failure
13664

0 commit comments

Comments
 (0)