Avoid duplicate pull request, push builds #13
Workflow file for this run
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: CI | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
build: | |
strategy: | |
matrix: | |
os: [ubuntu-22.04, macos-12, macos-14, windows-2022] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install ninja | |
shell: bash | |
run: | | |
if [[ "${{ runner.os }}" == "macOS" ]]; then | |
brew install ninja | |
elif [[ "${{ runner.os }}" == "Linux" ]]; then | |
sudo apt-get -y update | |
sudo apt-get -y install ninja-build | |
fi | |
- name: Build | |
if: matrix.os != 'windows-2022' | |
run: | | |
cmake -Bbuild -S. -GNinja | |
ninja -Cbuild | |
- name: Build | |
if: matrix.os == 'windows-2022' | |
shell: cmd | |
run: | | |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" | |
cmake -Bbuild -S. -GNinja | |
ninja -Cbuild | |
- name: Test | |
run: | | |
cd build/castxml-prefix/src/castxml-build | |
ctest --output-on-failure | |
- name: Create archive for Windows | |
if: matrix.os == 'windows-2022' | |
shell: cmd | |
run: | | |
cd build | |
7z a castxml-${{ matrix.os }}.zip castxml | |
move castxml-${{ matrix.os }}.zip .. | |
- name: Create archive for macOS and Ubuntu | |
if: matrix.os != 'windows-2022' | |
shell: bash | |
run: | | |
cd build | |
tar cvf castxml-${{ matrix.os }}.tar castxml | |
gzip -9 castxml-${{ matrix.os }}.tar | |
mv castxml-${{ matrix.os }}.tar.gz .. | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.os }}-archive | |
path: ./castxml-${{ matrix.os }}.* |