Skip to content

Make on multiple platforms #27

Make on multiple platforms

Make on multiple platforms #27

name: Make on multiple platforms
on:
pull_request:
branches: [ "main" ]
workflow_dispatch:
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
build_type: [Release]
c_compiler: [gcc]
output_name: [CalcGenus, CalcGenus.exe]
include:
- os: ubuntu-latest
output_name: CalcGenus
- os: windows-latest
output_name: CalcGenus.exe
exclude:
- os: windows-latest
output_name: CalcGenus
- os: ubuntu-latest
output_name: CalcGenus.exe
steps:
- uses: actions/checkout@v4
- name: Set reusable strings
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
- name: Create build directory
run: mkdir -p ${{ steps.strings.outputs.build-output-dir }}
- name: Install compiler
id: install_cc
uses: rlalik/setup-cpp-compiler@master
with:
compiler: ${{ matrix.c_compiler }}
- name: Build
working-directory: ./CalcGenus
run: make all CC=${{ matrix.c_compiler }} CPPC=${{ matrix.cpp_compiler }} BTYPE=${{ matrix.build_type }} BDIR=${{ steps.strings.outputs.build-output-dir }}
- name: release
uses: actions/create-release@v1
id: create_release
with:
draft: false
prerelease: false
release_name: Build ${{ github.run_number }} ${{ matrix.os }} ${{ matrix.build_type }}
tag_name: v${{ github.run_number }}-${{ matrix.os }}-${{ matrix.build_type }}
body: |
Changes in this Release
- Build ${{ github.run_number }}
- Commit: ${{ github.sha }}
- Commit message: ${{ github.event.head_commit.message }}
env:
GITHUB_TOKEN: ${{ github.token }}
- name: upload linux artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ steps.strings.outputs.build-output-dir }}/${{ matrix.output_name }}
asset_name: CalcGenus-${{ matrix.os }}-${{ matrix.build_type }}
asset_content_type: application/octet-stream