Skip to content

Commit

Permalink
Separate build and deploy workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
adisidev committed Oct 9, 2024
1 parent 27a9416 commit 7ea73f5
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 39 deletions.
61 changes: 22 additions & 39 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Build and Upload Artifact
name: Build and Release (on GitHub only)

on:
# either when a push is made to the main branch or when a pull request is merged
# when a push is made to the main branch (like when a pull request is merged, or something is pushed directly)
workflow_dispatch:
push:
branches: [ "main", "pr/adisidev/201" ]
Expand All @@ -20,13 +20,13 @@ jobs:
with:
fetch-depth: 0

- name: Cache APT packages
uses: actions/cache@v3
with:
path: /var/cache/apt
key: ${{ runner.os }}-apt-${{ hashFiles('apt-dependencies.txt') }}
restore-keys: |
${{ runner.os }}-apt-
# - name: Cache APT packages
# uses: actions/cache@v3
# with:
# path: /var/cache/apt
# key: ${{ runner.os }}-apt-${{ hashFiles('apt-dependencies.txt') }}
# restore-keys: |
# ${{ runner.os }}-apt-

- name: Install Dependencies
run: |
Expand All @@ -35,11 +35,11 @@ jobs:
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
sudo apt update && sudo apt install -y gcc-11 g++-11
- name: Save APT cache
uses: actions/cache@v3
with:
path: /var/cache/apt
key: ${{ runner.os }}-apt-${{ hashFiles('apt-dependencies.txt') }}
# - name: Save APT cache
# uses: actions/cache@v3
# with:
# path: /var/cache/apt
# key: ${{ runner.os }}-apt-${{ hashFiles('apt-dependencies.txt') }}

- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
Expand All @@ -48,23 +48,18 @@ jobs:
run: |
cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --target install -j$(nproc) --
# - name: Test
# - name: Run CTest
# 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: Run Stress Test
# 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
Expand Down Expand Up @@ -105,16 +100,4 @@ jobs:
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
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17 changes: 17 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Depoy (to go-cart.io)

on:
# only when triggered manually, after we have tested it ourselves
workflow_dispatch:

jobs:
deploy:
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

0 comments on commit 7ea73f5

Please sign in to comment.