Skip to content

Commit

Permalink
github: add workflows for pr, develop, release
Browse files Browse the repository at this point in the history
  • Loading branch information
alerei committed Jan 10, 2024
1 parent b176fef commit b22e15d
Show file tree
Hide file tree
Showing 6 changed files with 163 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Build

on:
workflow_call:
inputs:
build-type:
required: true
type: string

jobs:
build:
runs-on: ubuntu-22.04
container: flecspublic.azurecr.io/flecs-build

strategy:
matrix:
arch: ["amd64", "armhf", "arm64"]

steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: "CMake: Configure"
run: |
cmake -G Ninja -B build/${{ matrix.arch }} -DARCH=${{ matrix.arch }} -DCMAKE_BUILD_TYPE=${{ inputs.build-type }} -DCMAKE_INSTALL_PREFIX=out/${{ matrix.arch }}
- name: "CMake: Build"
run: |
cmake --build build/${{ matrix.arch }}
- name: "CMake: Install"
run: |
cmake --build build/${{ matrix.arch }} --target install
- name: "CMake: Packages"
run: |
cmake --build build/${{ matrix.arch }} --target package
- name: "Archive packages"
uses: actions/upload-artifact@v3
with:
name: packages_${{ matrix.arch }}
path: |
build/${{ matrix.arch }}/*.deb
build/${{ matrix.arch }}/*.tar.gz
build/${{ matrix.arch }}/latest_*
retention-days: 1
41 changes: 41 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Deploy

on:
workflow_call:
inputs:
deploy-type:
required: true
type: string

jobs:
test:
runs-on: ubuntu-22.04

steps:
- name: Download packages
uses: actions/download-artifact@v3
with:
path: build/

- name: Azure Login
uses: azure/#@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}

- name: Deploy packages and latest files
uses: azure/CLI@v1
with:
azcliversion: 2.53.0
inlineScript: |
for i in `find build/ -mindepth 1 -maxdepth 1 -name "*.deb"`; do \
echo "Uploading ${i}"; \
az storage blob upload --account-name flecs --container-name flecs-dl --name ${{ inputs.deploy-type }}/libflunder/deb/$(basename ${i}) --file ${i} --overwrite
done
for i in `find build/ -mindepth 1 -maxdepth 1 -name "*.tar.gz"`; do \
echo "Uploading ${i}"; \
az storage blob upload --account-name flecs --container-name flecs-dl --name ${{ inputs.deploy-type }}/libflunder/tgz/$(basename ${i}) --file ${i} --overwrite
done
for i in `find build/ -mindepth 1 -maxdepth 1 -name "latest_*"`; do \
echo "Uploading ${i}"; \
az storage blob upload --account-name flecs --container-name flecs-dl --name ${{ inputs.deploy-type }}/libflunder/$(basename ${i}) --file ${i} --overwrite
done
20 changes: 20 additions & 0 deletions .github/workflows/develop.workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Develop

on:
workflow_dispatch:
push:
branches: [main]

jobs:
build:
uses: ./.github/workflows/build.yml
with:
build-type: Debug
test:
uses: ./.github/workflows/test.yml
deploy:
needs: [build, test]
uses: ./.github/workflows/deploy.yml
with:
deploy-type: dev
secrets: inherit
13 changes: 13 additions & 0 deletions .github/workflows/pull-request.workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Pull request

on:
pull_request:
branches: [main]

jobs:
build:
uses: ./.github/workflows/build.yml
with:
build-type: Debug
test:
uses: ./.github/workflows/test.yml
20 changes: 20 additions & 0 deletions .github/workflows/release.workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Release

on:
workflow_dispatch:
release:
types: [published]

jobs:
build:
uses: ./.github/workflows/build.yml
with:
build-type: Release
test:
uses: ./.github/workflows/test.yml
deploy:
needs: [build, test]
uses: ./.github/workflows/deploy.yml
with:
deploy-type: public
secrets: inherit
26 changes: 26 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Test

on:
workflow_call:

jobs:
test:
runs-on: ubuntu-22.04
container: flecspublic.azurecr.io/flecs-build

steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: "CMake: Configure"
run: |
cmake -G Ninja -B build/test -DCMAKE_BUILD_TYPE=RelWithDebInfo -DFLECS_BUILD_TESTS=On -DCMAKE_INSTALL_PREFIX=out/test
- name: "CMake: Build"
run: |
cmake --build build/test
- name: "CMake: Test"
run: |
cmake --build build/test --target test
- name: "CMake: Coverage"
run: |
cmake --build build/test --target coverage

0 comments on commit b22e15d

Please # to comment.