Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 28 additions & 36 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,54 +1,46 @@
name: CI
on:
workflow_dispatch:
pull_request:
branches:
- master
- overhaul

push:
branches:
- master
- overhaul
workflow_call:
inputs:
release:
type: boolean
required: true
default: false

jobs:
cache:
uses: ./.github/workflows/cache.yml

build-options:
runs-on: ubuntu-latest
outputs:
exclude: ${{ steps.set.outputs.exclude }}
steps:
- id: set
run: |
echo "exclude=[${{ inputs.release && '{"runners": { "upload": false } }' || '' }}]" >> $GITHUB_OUTPUT

build:
name: Build
needs: cache
needs: [ cache, build-options ]

strategy:
fail-fast: false
matrix:
os: [ 'ubuntu-22.04', 'ubuntu-latest', 'windows-latest' ]
include:
# we need to ship ubuntu 22.04 because of glibc reasons
- os: ubuntu-22.04
#cc: clang-8
#cxx: clang++-8
cc: clang
cxx: clang++
upload: true
upload-artifact-name: accelerator_linux
- os: ubuntu-latest
cc: clang
cxx: clang++
upload: false
upload-artifact-name: none
- os: windows-latest
cc: msvc
cxx: msvc
upload: true
upload-artifact-name: accelerator_windows
runners: [
{ os: ubuntu-22.04, cc: clang, cxx: clang++, upload: true, upload-artifact-name: accelerator_linux },
{ os: ubuntu-latest, cc: clang, cxx: clang++, upload: false },
{ os: windows-latest, cc: msvc, cxx: msvc, upload: true, upload-artifact-name: accelerator_windows }
]
exclude: ${{ fromJson(needs.build-options.outputs.exclude) }}

uses: ./.github/workflows/build-extension.yml
with:
os: ${{ matrix.os }}
cc: ${{ matrix.cc }}
cxx: ${{ matrix.cxx }}
upload: ${{ matrix.upload }}
upload-artifact-name: ${{ matrix.upload-artifact-name }}
os: ${{ matrix.runners.os }}
cc: ${{ matrix.runners.cc }}
cxx: ${{ matrix.runners.cxx }}
upload: ${{ matrix.runners.upload }}
upload-artifact-name: ${{ matrix.runners.upload-artifact-name }}
cache-key: ${{ needs.cache.outputs.key }}
cache-dir: ${{ needs.cache.outputs.dir }}
cache-dir: ${{ needs.cache.outputs.dir }}
12 changes: 12 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Pull Request

on:
workflow_dispatch:
pull_request:
branches: [ master ]

jobs:
main-ci:
uses: ./.github/workflows/ci.yml
with:
release: false
76 changes: 76 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Release

on:
workflow_dispatch:
push:
branches: [ master, release_ci ]

jobs:
main-ci:
uses: ./.github/workflows/ci.yml
with:
release: true

release:
permissions: write-all
runs-on: ubuntu-latest
needs: [ main-ci ]

env:
PROJECT: 'accelerator'
steps:
- run: sudo apt-get install -y tree

- uses: actions/checkout@v4
name: Repository checkout
with:
fetch-depth: 0
path: repository

- name: Download Linux release
uses: actions/download-artifact@v5
with:
name: accelerator_linux
path: linux

- name: Download Windows release
uses: actions/download-artifact@v5
with:
name: accelerator_windows
path: windows

- name: Zip release again
run: |
cd repository
read -r PRODUCT_VERSION < ./product.version
REV_COUNT=$(git rev-list --count HEAD)
REV_SHA=$(git rev-parse --short HEAD)
cd ..
WINDOWS_ZIP="${{ env.PROJECT }}-$PRODUCT_VERSION-git$REV_COUNT-$REV_SHA-windows.zip"
LINUX_ZIP="${{ env.PROJECT }}-$PRODUCT_VERSION-git$REV_COUNT-$REV_SHA-linux.zip"
zip -r ${WINDOWS_ZIP} windows
zip -r ${LINUX_ZIP} linux

echo "WINDOWS_ZIP=${WINDOWS_ZIP}" >> $GITHUB_ENV
echo "LINUX_ZIP=${LINUX_ZIP}" >> $GITHUB_ENV

- name: Upload release
shell: bash
run: |
echo "Begin upload for branch (${{ github.ref_name }})"
AUTHORIZATION="$(echo -n 'builds:${{ secrets.UPLOAD_PASSWORD }}' | base64)"
echo "::add-mask::${AUTHORIZATION}"

echo "Uploading ${{ env.WINDOWS_ZIP }}"
HTTP_CODE=$(curl -XPOST -H "Authorization: Basic ${AUTHORIZATION}" -H "Content-Type: application/zip" --output /dev/null --silent --write-out "%{http_code}" --data-binary "@${{ env.WINDOWS_ZIP }}" "https://builds.limetech.io/upload.php?project=${{ env.PROJECT }}&branch=${{ github.ref_name }}&filename=${{ env.WINDOWS_ZIP }}")
if test ${HTTP_CODE} -ne 200; then
echo "Upload failed with HTTP Code: ${HTTP_CODE}"
exit 1
fi
echo "Uploading ${{ env.LINUX_ZIP }}"
HTTP_CODE=$(curl -XPOST -H "Authorization: Basic ${AUTHORIZATION}" -H "Content-Type: application/zip" --output /dev/null --silent --write-out "%{http_code}" --data-binary "@${{ env.LINUX_ZIP }}" "https://builds.limetech.io/upload.php?project=${{ env.PROJECT }}&branch=${{ github.ref_name }}&filename=${{ env.LINUX_ZIP }}")
if test ${HTTP_CODE} -ne 200; then
echo "Upload failed with HTTP Code: ${HTTP_CODE}"
exit 1
fi
echo "Upload successful!"