Skip to content

Create build.yml

Create build.yml #1

Workflow file for this run

name: Build
on:
push:
branches:
- main # メインブランチにプッシュされたときに実行
pull_request:
branches:
- main # メインブランチにプルリクエストが作成されたときに実行
jobs:
build-linux:
runs-on: ubuntu-latest # Linux環境で実行
steps:
- uses: actions/checkout@v2 # リポジトリをチェックアウト
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential cmake # 必要なパッケージをインストール
- name: Configure and build
run: |
mkdir build
cd build
cmake ..
cmake --build .
- name: Test
run: |
ctest # テストを実行(必要に応じて)
- name: Package binaries
run: |
cd build
zip -r my_project_binaries_linux.zip .
- name: Upload release artifacts
uses: actions/upload-artifact@v2
with:
name: microscript_binaries_linux
path: build/microscript_binaries_linux.zip
build-windows:
runs-on: windows-latest # Windows環境で実行
steps:
- uses: actions/checkout@v2 # リポジトリをチェックアウト
- name: Install dependencies
run: |
choco install -y cmake --installargs 'ADD_CMAKE_TO_PATH=System' # CMakeをインストール
- name: Configure and build
run: |
mkdir build
cd build
cmake ..
cmake --build .
- name: Test
run: |
ctest # テストを実行(必要に応じて)
- name: Package binaries
run: |
cd build
Compress-Archive -Path * -DestinationPath my_project_binaries_windows.zip
- name: Upload release artifacts
uses: actions/upload-artifact@v2
with:
name: microscript_binaries_windows
path: build/microscript_binaries_windows.zip
build-macos:
runs-on: macos-latest # macOS環境で実行
steps:
- uses: actions/checkout@v2 # リポジトリをチェックアウト
- name: Install dependencies
run: |
brew install cmake # CMakeをインストール
- name: Configure and build
run: |
mkdir build
cd build
cmake ..
cmake --build .
- name: Test
run: |
ctest # テストを実行(必要に応じて)
- name: Package binaries
run: |
cd build
zip -r my_project_binaries_macos.zip .
- name: Upload release artifacts
uses: actions/upload-artifact@v2
with:
name: microscript_binaries_macos
path: build/microscript_binaries_macos.zip