CI #951
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
pull_request: | |
push: | |
tags: | |
- "**" | |
branches: | |
- main | |
schedule: | |
- cron: "0 0 * * *" | |
env: | |
BB_CI: 1 | |
jobs: | |
generate-config: | |
runs-on: ubuntu-24.04 | |
permissions: write-all | |
outputs: | |
BIRTH_GITHUB_TARGETS: ${{ steps.generate-config.outputs.BIRTH_GITHUB_TARGETS }} | |
BIRTH_BUILD_TYPES: ${{ steps.generate-config.outputs.BIRTH_BUILD_TYPES }} | |
BIRTH_CMAKE_BUILD_TYPES: ${{ steps.generate-config.outputs.BIRTH_CMAKE_BUILD_TYPES }} | |
BIRTH_COMPILERS: ${{ steps.generate-config.outputs.BIRTH_COMPILERS }} | |
BIRTH_LINUX_IMAGE: ${{ steps.generate-config.outputs.BIRTH_LINUX_IMAGE }} | |
BIRTH_MACOS_IMAGE: ${{ steps.generate-config.outputs.BIRTH_MACOS_IMAGE }} | |
BIRTH_WINDOWS_IMAGE: ${{ steps.generate-config.outputs.BIRTH_WINDOWS_IMAGE }} | |
RELEASE_TAG_NAME: ${{ steps.generate-tag.outputs.RELEASE_TAG_NAME }} # Define job output here | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Generate config | |
id: generate-config | |
uses: birth-software/github-config@v4 | |
- name: Create tag | |
if: github.ref == 'refs/heads/main' | |
shell: bash | |
id: generate-tag | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
set -eux | |
git config --global user.name "github-actions" | |
git config --global user.email "[email protected]" | |
TAG="dev" | |
gh release delete $TAG --yes || true | |
git tag -d $TAG || true | |
git push origin --delete $TAG || true | |
git fetch --tags | |
git tag -l | |
git tag $TAG | |
git push origin $TAG | |
echo "RELEASE_TAG_NAME=$TAG" >> $GITHUB_OUTPUT | |
ci: | |
needs: generate-config | |
permissions: write-all | |
strategy: | |
fail-fast: false | |
matrix: | |
os: ${{ fromJSON(needs.generate-config.outputs.BIRTH_GITHUB_TARGETS) }} | |
C_COMPILER: ${{ fromJSON(needs.generate-config.outputs.BIRTH_COMPILERS) }} | |
BIRTH_BUILD_TYPE: ${{ fromJSON(needs.generate-config.outputs.BIRTH_BUILD_TYPES) }} | |
exclude: | |
- C_COMPILER: gcc | |
os: ${{ needs.generate-config.outputs.BIRTH_MACOS_IMAGE }} | |
- C_COMPILER: gcc | |
os: ${{ needs.generate-config.outputs.BIRTH_WINDOWS_IMAGE }} | |
- C_COMPILER: cl | |
os: ${{ needs.generate-config.outputs.BIRTH_MACOS_IMAGE }} | |
- C_COMPILER: cl | |
os: ${{ needs.generate-config.outputs.BIRTH_LINUX_IMAGE }} | |
- C_COMPILER: tcc | |
BIRTH_BUILD_TYPE: release_safe | |
- C_COMPILER: tcc | |
BIRTH_BUILD_TYPE: release_fast | |
- C_COMPILER: tcc | |
BIRTH_BUILD_TYPE: release_small | |
runs-on: ${{ matrix.os }} | |
env: | |
BIRTH_LINUX_IMAGE: ${{ needs.generate-config.outputs.BIRTH_LINUX_IMAGE }} | |
BIRTH_MACOS_IMAGE: ${{ needs.generate-config.outputs.BIRTH_MACOS_IMAGE }} | |
BIRTH_WINDOWS_IMAGE: ${{ needs.generate-config.outputs.BIRTH_WINDOWS_IMAGE }} | |
RELEASE_TAG_NAME: ${{ needs.generate-config.outputs.RELEASE_TAG_NAME }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Fetch dependencies | |
if: matrix.os == env.BIRTH_LINUX_IMAGE | |
run: | | |
if [[ "${{matrix.C_COMPILER}}" == "tcc" ]]; then | |
wget https://github.com/birth-software/tinycc/releases/download/dev/tcc-x86_64-linux.7z | |
7z x tcc-x86_64-linux.7z | |
echo $PWD/tinycc/bin >> $GITHUB_PATH | |
fi | |
- name: Fetch dependencies | |
if: matrix.os == env.BIRTH_MACOS_IMAGE | |
run: | | |
if [[ "${{matrix.C_COMPILER}}" == "tcc" ]]; then | |
wget https://github.com/birth-software/tinycc/releases/download/dev/tcc-aarch64-macos.7z | |
7z x tcc-aarch64-macos.7z | |
echo $PWD/tinycc/bin >> $GITHUB_PATH | |
fi | |
- name: Fetch dependencies | |
if: matrix.os == env.BIRTH_WINDOWS_IMAGE | |
shell: bash | |
run: | | |
set -eux | |
if [[ "${{matrix.C_COMPILER}}" == "tcc" ]]; then | |
curl -L https://github.com/birth-software/tinycc/releases/download/dev/tcc-x86_64-windows.7z --output tcc-x86_64-windows.7z | |
7z x tcc-x86_64-windows.7z | |
TCC_PATH=$(cygpath -w "$PWD/tinycc") | |
echo $TCC_PATH >> $GITHUB_PATH | |
fi | |
- name: Build | |
if: matrix.os != env.BIRTH_WINDOWS_IMAGE | |
env: | |
CC: ${{matrix.C_COMPILER}} | |
BB_BUILD_TYPE: ${{matrix.BIRTH_BUILD_TYPE}} | |
run: ./build.sh | |
- name: Build | |
if: matrix.os == env.BIRTH_WINDOWS_IMAGE | |
shell: cmd | |
env: | |
CC: ${{matrix.C_COMPILER}} | |
BB_BUILD_TYPE: ${{matrix.BIRTH_BUILD_TYPE}} | |
run: | | |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64 || exit /b 1 | |
call build.bat || exit /b 1 | |
- name: Run | |
run: ./cache/bb |