Skip to content

fix: main.cpp

fix: main.cpp #5

Workflow file for this run

name: C++ CI/CD
permissions:
contents: write
issues: write
pull-requests: write
on:
push:
branches: [ "main" ]
tags:
- 'v*'
pull_request:
branches: [ "main" ]
jobs:
build:
name: Build on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
include:
- os: windows-latest
exe_name: minidb.exe
artifact_name: minidb-windows
- os: ubuntu-latest
exe_name: minidb
artifact_name: minidb-linux
- os: macos-latest
exe_name: minidb
artifact_name: minidb-macos
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install dependencies (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y build-essential cmake
- name: Install dependencies (macOS)
if: matrix.os == 'macos-latest'
run: |
brew install cmake
- name: Configure CMake
run: |
mkdir build
cd build
cmake ..
- name: Build
working-directory: ./build
run: |
cmake --build . --config Release
- name: Run tests
working-directory: ./build
run: |
ctest -C Release --output-on-failure
- name: Prepare Release Asset
shell: bash
run: |
mkdir -p release-asset
if [ "${{ matrix.os }}" = "windows-latest" ]; then
cp build/Release/${{ matrix.exe_name }} release-asset/
else
cp build/${{ matrix.exe_name }} release-asset/
fi
cd release-asset
if [ "${{ matrix.os }}" = "windows-latest" ]; then
7z a -tzip minidb-windows.zip ${{ matrix.exe_name }}
else
tar czf ${{ matrix.artifact_name }}.tar.gz ${{ matrix.exe_name }}
fi
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.artifact_name }}
path: |
release-asset/*.zip
release-asset/*.tar.gz
release:
needs: build
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
path: artifacts
- name: Display structure of downloaded files
run: ls -R artifacts/
- name: Rename and prepare assets
run: |
mkdir release_files
cp artifacts/minidb-windows/minidb-windows.zip release_files/
cp artifacts/minidb-linux/minidb-linux.tar.gz release_files/
cp artifacts/minidb-macos/minidb-macos.tar.gz release_files/
- name: Create Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
release_files/minidb-windows.zip
release_files/minidb-linux.tar.gz
release_files/minidb-macos.tar.gz
draft: false
prerelease: false
generate_release_notes: true
name: Release ${{ github.ref_name }}
body: |
## MinidDB Release ${{ github.ref_name }}
### Downloads
- Windows: `minidb-windows.zip`
- Linux: `minidb-linux.tar.gz`
- macOS: `minidb-macos.tar.gz`