Skip to content

Separate build into configure and build step #2

Separate build into configure and build step

Separate build into configure and build step #2

Workflow file for this run

name: Build and Upload Artifact
on:
# either when a push is made to the main branch or when a pull request is merged
push:
branches: [ "main" ]
workflow_dispatch:
env:
BUILD_TYPE: Release
jobs:
build-and-release:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Dependencies
run: |
sudo apt update
sudo apt install -y build-essential manpages-dev software-properties-common nlohmann-json3-dev libcgal-dev libomp-dev libfftw3-dev libcairo2-dev libboost-all-dev cmake
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
sudo apt update && sudo apt install -y gcc-11 g++-11
- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
- name: Build
run: |
CORES=$(nproc)

Check failure on line 36 in .github/workflows/build.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/build.yml

Invalid workflow file

You have an error in your yaml syntax on line 36
cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} ---target install -j${CORES} --
# - name: Test
# working-directory: ${{github.workspace}}/build
# # Execute tests defined by the CMake configuration.
# # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
# run: ctest -C ${{env.BUILD_TYPE}}
- name: Build Project
run: |
sudo cmake -B build
sudo make -j${CORES} -C build
#- name: Run Tests
# run: |
# sudo make install -C build
# cd tests/
# chmod +x stress_test.sh
# bash stress_test.sh
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: cartogram
path: ./build/bin/cartogram
- name: Generate and Push Tag
id: generate_tag
run: |
# Configure git committer
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
# Fetch tags
git fetch --tags
# Get the current date
current_date=$(date +'%Y-%m-%d')
# Get the short SHA of the current HEAD
short_sha=$(git rev-parse --short HEAD)
# Create the new tag
new_tag="${current_date}-${short_sha}"
# Create the new tag
git tag -a "${new_tag}" -m "New release ${new_tag}"
# Push the tag to the repository
git push origin "${new_tag}"
echo "new_tag=${new_tag}" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.generate_tag.outputs.new_tag }}
files: build/bin/cartogram
body: "Rolling release ${{ steps.generate_tag.outputs.release_number }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
deploy:
needs: build-and-release
runs-on: ubuntu-latest
steps:
- name: Deploy binary to go-cart.io
uses: appleboy/[email protected]
with:
host: ${{ secrets.DEPLOY_HOST }}
username: ${{ secrets.DEPLOY_USER }}
key: ${{ secrets.DEPLOY_SSH_KEY }}
script: /home/cartogram/deploy-cartogram-cpp.sh