Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
howso-automation committed Sep 12, 2023
0 parents commit 9b887ad
Show file tree
Hide file tree
Showing 206 changed files with 253,530 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# top-most EditorConfig file
root = true

[*.{cpp,h,hpp,c,amlg}]
indent_style = tab
indent_size = 4
trim_trailing_whitespace = true
6 changes: 6 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
##########################################
# code ownership
##########################################

# default ownership: default owners for everything in the repo (Unless a later match takes precedence)
* @howsoai/devs
300 changes: 300 additions & 0 deletions .github/workflows/build-test-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,300 @@
name: Reusable WF - Build

on:
workflow_call:
inputs:
version:
required: true
type: string

defaults:
run:
shell: bash

jobs:

build-linux:
runs-on: ubuntu-20.04
container:
image: ghcr.io/howsoai/amalgam-build-container-linux:0.13.0
credentials:
username: ${{ github.actor }}
password: ${{ github.token }}
strategy:
matrix:
preset:
- arch: amd64
platform: linux
- arch: arm64
platform: linux
- arch: arm64_8a
platform: linux
- arch: wasm64
platform: linux
permissions:
contents: write

steps:
- uses: actions/checkout@v3

- name: Set build preset
run: |
PRESET=$(echo ${{ matrix.preset.arch }}-release-${{ matrix.preset.platform }})
echo "PRESET=$(echo $PRESET)" >> $GITHUB_ENV
echo "Build preset: $PRESET"
- name: CMake Configure
run: AMALGAM_BUILD_VERSION=${{ inputs.version }} cmake --preset $PRESET

- name: CMake Build
run: cmake --build --preset $PRESET -- --quiet

- name: CMake Test
run: cmake --build --preset $PRESET --target test

- name: CMake Install
run: cmake --build --preset $PRESET --target install

- name: CMake Package
run: cmake --build --preset $PRESET --target package

- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: amalgam-${{ inputs.version }}-${{ matrix.preset.platform }}-${{ matrix.preset.arch }}
path: ./out/package/amalgam-*.tar.gz
if-no-files-found: error

build-macos:
runs-on: macos-11
strategy:
matrix:
preset:
- arch: amd64
build: release
platform: macos
- arch: arm64
build: release
platform: macos
permissions:
contents: write

steps:
- uses: actions/checkout@v3

- name: Set build preset
run: |
PRESET=$(echo ${{ matrix.preset.arch }}-release-${{ matrix.preset.platform }})
echo "PRESET=$(echo $PRESET)" >> $GITHUB_ENV
echo "Build preset: $PRESET"
- name: Install build dependencies
run: |
if [ "${{ matrix.preset.arch }}" = "arm64" ]; then
brew uninstall --ignore-dependencies libomp
brew cleanup -s
rm -rf `brew --cache`
brew fetch --force --bottle-tag=arm64_big_sur libomp
brew install `brew --cache --bottle-tag=arm64_big_sur libomp`
else
brew install libomp
fi
brew list --versions libomp
brew install ninja
- name: CMake Configure
run: AMALGAM_BUILD_VERSION=${{ inputs.version }} cmake --preset $PRESET

- name: CMake Build
run: cmake --build --preset $PRESET -- --quiet

- name: CMake Test
run: cmake --build --preset $PRESET --target test

- name: CMake Install
run: cmake --build --preset $PRESET --target install

- name: CMake Package
run: cmake --build --preset $PRESET --target package

- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: amalgam-${{ inputs.version }}-darwin-${{ matrix.preset.arch }}
path: ./out/package/amalgam-*.tar.gz
if-no-files-found: error

build-windows:
runs-on: windows-2022
strategy:
matrix:
preset:
- arch: amd64
build: release
platform: windows
permissions:
contents: write

steps:
- uses: actions/checkout@v3

- name: Set build preset
run: |
PRESET=$(echo ${{ matrix.preset.arch }}-release-${{ matrix.preset.platform }})
echo "PRESET=$(echo $PRESET)" >> $GITHUB_ENV
echo "Build preset: $PRESET"
- name: Enable developer commandline tools
uses: ilammy/msvc-dev-cmd@v1

- name: Download tz data
shell: pwsh
run: ./build/powershell/Download-Tzdata.ps1

- name: Install build dependencies
run: choco upgrade ninja

- name: CMake Configure
run: AMALGAM_BUILD_VERSION=${{ inputs.version }} cmake --preset $PRESET

- name: CMake Build
run: cmake --build --preset $PRESET -- --quiet

- name: CMake Test
run: cmake --build --preset $PRESET --target test

- name: CMake Install
run: cmake --build --preset $PRESET --target install

- name: CMake Package
run: cmake --build --preset $PRESET --target package

- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: amalgam-${{ inputs.version }}-${{ matrix.preset.platform }}-${{ matrix.preset.arch }}
path: ./out/package/amalgam-*.tar.gz
if-no-files-found: error

smoke-test-linux-amd64:
needs: ['build-linux']
runs-on: ubuntu-latest
steps:
- name: Download Artifact
uses: actions/download-artifact@v3
with:
name: amalgam-${{ inputs.version }}-linux-amd64

- name: Extract Amalgam
run: |
mkdir ./amalgam
tar -xvf ./amalgam-${{ inputs.version }}-linux-amd64.tar.gz -C ./amalgam
- name: Smoke test
run: |
set -e
BIN=./amalgam/bin
echo -n "amalgam: " && $BIN/amalgam --version
echo -n "amalgam-mt: " && $BIN/amalgam-mt --version
echo -n "amalgam-mt-noavx: " && $BIN/amalgam-mt-noavx --version
echo -n "amalgam-st: " && $BIN/amalgam-st --version
echo -n "amalgam-omp: " && $BIN/amalgam-omp --version
smoke-test-linux-arm64:
needs: ['build-linux']
runs-on: ubuntu-latest
steps:
- name: Download Artifact
uses: actions/download-artifact@v3
with:
name: amalgam-${{ inputs.version }}-linux-arm64

- name: Extract Amalgam
run: |
mkdir ./amalgam
tar -xvf ./amalgam-${{ inputs.version }}-linux-arm64.tar.gz -C ./amalgam
- name: Smoke test
uses: pguyot/arm-runner-action@v2
with:
base_image: raspios_lite_arm64:latest
cpu: cortex-a8
commands: |
set -e
PATH=$PATH:/usr/aarch64-linux-gnu
BIN=./amalgam/bin
echo -n "amalgam: " && $BIN/amalgam --version
echo -n "amalgam-mt: " && $BIN/amalgam-mt --version
echo -n "amalgam-st: " && $BIN/amalgam-st --version
echo -n "amalgam-omp: " && $BIN/amalgam-omp --version
smoke-test-linux-arm64_8a:
needs: ['build-linux']
runs-on: ubuntu-latest
steps:
- name: Download Artifact
uses: actions/download-artifact@v3
with:
name: amalgam-${{ inputs.version }}-linux-arm64_8a

- name: Extract Amalgam
run: |
mkdir ./amalgam
tar -xvf ./amalgam-${{ inputs.version }}-linux-arm64_8a.tar.gz -C ./amalgam
- name: Smoke test
uses: pguyot/arm-runner-action@v2
with:
base_image: raspios_lite_arm64:latest
cpu: cortex-a7
commands: |
set -e
PATH=$PATH:/usr/aarch64-linux-gnu
BIN=./amalgam/bin
echo -n "amalgam: " && $BIN/amalgam --version
echo -n "amalgam-st: " && $BIN/amalgam-st --version
smoke-test-macos-amd64:
needs: ['build-macos']
runs-on: macos-latest
steps:
- name: Download Artifact
uses: actions/download-artifact@v3
with:
name: amalgam-${{ inputs.version }}-darwin-amd64

- name: Extract Amalgam
run: |
mkdir ./amalgam
tar -xvf ./amalgam-${{ inputs.version }}-darwin-amd64.tar.gz -C ./amalgam
# GitHub macos runner does not support AVX
- name: Smoke test
run: |
set -e
BIN=./amalgam/bin
echo -n "amalgam-mt-noavx: " && $BIN/amalgam-mt-noavx --version
smoke-test-windows-amd64:
needs: ['build-windows']
runs-on: windows-latest
steps:
- name: Download Artifact
uses: actions/download-artifact@v3
with:
name: amalgam-${{ inputs.version }}-windows-amd64

- name: Extract Amalgam
run: |
mkdir ./amalgam
tar -xvf ./amalgam-${{ inputs.version }}-windows-amd64.tar.gz -C ./amalgam
- name: Smoke test
run: |
set -e
BIN=./amalgam/bin
echo -n "amalgam: " && $BIN/amalgam --version
echo -n "amalgam-mt: " && $BIN/amalgam-mt --version
echo -n "amalgam-mt-noavx: " && $BIN/amalgam-mt-noavx --version
echo -n "amalgam-st: " && $BIN/amalgam-st --version
echo -n "amalgam-omp: " && $BIN/amalgam-omp --version
59 changes: 59 additions & 0 deletions .github/workflows/create-branch-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Create Branch Build
run-name: "Branch Build (${{ github.run_attempt }}.${{ github.run_number }}) - ${{ github.ref_name }}"

on:
workflow_dispatch:

defaults:
run:
shell: bash

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:

set-branch-version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.set-branch-version.outputs.version }}
steps:

- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Get previous git tag
id: previous-tag
uses: WyriHaximus/github-action-get-previous-tag@v1
with:
fallback: 0.0.0

- name: Get next semver from previous tag
id: next-semvers
uses: WyriHaximus/github-action-next-semvers@v1
with:
version: ${{ steps.previous-tag.outputs.tag }}

- name: Set Branch version
id: set-branch-version
run: |
BRANCH_ITERATION=${{ github.run_attempt }}.${{ github.run_number }}
echo "version=$(echo ${{ steps.next-semvers.outputs.patch }}-alpha+BR.${{ github.ref_name }}.${BRANCH_ITERATION})" >> $GITHUB_OUTPUT
build-test-package:
needs: ['set-branch-version']
uses: "./.github/workflows/build-test-package.yml"
secrets: inherit
with:
version: ${{ needs.set-branch-version.outputs.version }}

# This job is here to have only one final step to add for "Status Checks"
# in GitHub, instead of adding every leaf test from 'build-test-package'
final-check:
needs: ['build-test-package']
if: always() && (contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled'))
runs-on: ubuntu-latest
steps:
- run: exit 1
Loading

0 comments on commit 9b887ad

Please sign in to comment.