Skip to content

Fix release

Fix release #731

Workflow file for this run

name: Build
on:
push:
branches:
- master
tags:
- "*.*.*"
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- { os: ubuntu-20.04, target: linux, platform: linux-x64 }
- { os: ubuntu-20.04, target: linux, platform: linux-aarch64 }
- { os: macos-latest, target: darwin, platform: darwin-x64 }
- { os: macos-latest, target: darwin, platform: darwin-arm64 }
- { os: windows-latest, target: windows, platform: win32-x64 }
steps:
- uses: actions/setup-node@v3
with:
node-version: '20'
- uses: actions/checkout@v3
with:
ref: refs/heads/master
- name: Prepare Linux-64
if: ${{ matrix.target == 'linux' && matrix.platform == 'linux-x64' }}
run: |
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install -y gcc-11 g++-11
echo "CC=gcc-11" >> $GITHUB_ENV
echo "CXX=g++-11" >> $GITHUB_ENV
- name: Prepare Linux-aarch64
if: ${{ matrix.target == 'linux' && matrix.platform == 'linux-aarch64' }}
run: |
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install -y gcc-10-aarch64-linux-gnu g++-10-aarch64-linux-gnu
echo "CC=aarch64-linux-gnu-gcc-10" >> $GITHUB_ENV
echo "CXX=aarch64-linux-gnu-g++-10" >> $GITHUB_ENV
- name: Build-Windows
if: startsWith(matrix.os, 'windows')
run: |
mkdir build
cd build
cmake .. -DCMAKE_USER_MAKE_RULES_OVERRIDE="${{ github.workspace }}/cmake/flags_override.cmake" -DBUILD_GMOCK=OFF -DINSTALL_GTEST=OFF
cmake --build . --config Release
ctest -V -C Release
cmake --install . --config Release --prefix ${{ github.workspace }}/artifact/
- name: Build-Linux-x64
if: ${{ matrix.platform == 'linux-x64' }}
run: |
mkdir build
cd build
cmake .. -DBUILD_GMOCK=OFF -DINSTALL_GTEST=OFF -DCMAKE_BUILD_TYPE=Release
cmake --build . --config Release
ctest -V -C Release
cmake --install . --config Release --prefix ${{ github.workspace }}/artifact/
- name: Build-Linux-aarch64
if: ${{ matrix.platform == 'linux-aarch64' }}
run: |
mkdir build
cd build
cmake .. -DBUILD_GMOCK=OFF -DINSTALL_GTEST=OFF -DCMAKE_BUILD_TYPE=Release
cmake --build . --config Release
cmake --install . --config Release --prefix ${{ github.workspace }}/artifact/
- name: Build-macosx
if: startsWith(matrix.os, 'macos')
run: |
mkdir build
cd build
if [[ "${{ matrix.platform }}" = darwin-arm64 ]]; then
cmake .. -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DBUILD_GMOCK=OFF -DINSTALL_GTEST=OFF -DCMAKE_BUILD_TYPE=Release
else
cmake .. -DBUILD_GMOCK=OFF -DINSTALL_GTEST=OFF -DCMAKE_BUILD_TYPE=Release
fi
cmake --build . --config Release
ctest -V -C Release
cmake --install . --config Release --prefix ${{ github.workspace }}/artifact/
- name: Upload
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.platform }}
path: ${{ github.workspace }}/artifact/
release:
name: Upload Release
needs: [build]
runs-on: [ubuntu-latest]
steps:
- name: Download
uses: actions/download-artifact@v3
- name: Display structure of downloaded files
run: ls -R
- name: zip win32-x64
uses: TheDoctor0/[email protected]
with:
filename: win32-x64.zip
path: win32-x64
- name: zip linux-x64
uses: TheDoctor0/[email protected]
with:
filename: linux-x64.zip
path: linux-x64
- name: tar linux-64
run: |
chmod 777 linux-x64/bin/CodeFormat
chmod 777 linux-x64/bin/CodeFormatServer
tar -czvf linux-x64.tar.gz linux-x64
- name: tar linux-aarch64
run: |
chmod 777 linux-aarch64/bin/CodeFormat
chmod 777 linux-aarch64/bin/CodeFormatServer
tar -czvf linux-aarch64.tar.gz linux-aarch64
- name: zip darwin-x64
uses: TheDoctor0/[email protected]
with:
filename: darwin-x64.zip
path: darwin-x64
- name: zip darwin-arm64
uses: TheDoctor0/[email protected]
with:
filename: darwin-arm64.zip
path: darwin-arm64
- name: tar darwin-arm64
run: |
chmod 777 darwin-arm64/bin/CodeFormat
chmod 777 darwin-arm64/bin/CodeFormatServer
tar -czvf darwin-arm64.tar.gz darwin-arm64
- name: tar darwin-x64
run: |
chmod 777 darwin-x64/bin/CodeFormat
chmod 777 darwin-x64/bin/CodeFormatServer
tar -czvf darwin-x64.tar.gz darwin-x64
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
name: CodeFormat
draft: false
generate_release_notes: true
files: |
linux-x64.zip
linux-x64.tar.gz
linux-aarch64.tar.gz
darwin-x64.zip
darwin-arm64.zip
win32-x64.zip
darwin-x64.tar.gz
darwin-arm64.tar.gz
token: ${{ secrets.RELEASE }}