name: build on: push: branches: [master] paths-ignore: - '**.md' pull_request: types: [opened, reopened, synchronize] release: types: [published] jobs: bot-build: runs-on: ubuntu-latest container: image: ghcr.io/yapb/builder:latest options: --hostname github-actions strategy: matrix: arch: ['linux-x86', 'linux-amd64', 'linux-x86-gcc', 'linux-x86-nosimd', 'linux-arm64', 'linux-riscv64', 'apple-x86', 'windows-x86-clang', 'windows-amd64', 'windows-x86-gcc'] fail-fast: false steps: - name: Checkout repository uses: actions/checkout@v4 with: fetch-depth: 0 submodules: true - name: Configure meson shell: bash run: | if [[ ${{matrix.arch}} == linux-x86 ]]; then CXX=clang CXX_LD=lld meson setup ${{matrix.arch}} elif [[ ${{matrix.arch}} == linux-x86-gcc ]]; then CXX=gcc CXX_LD=gold meson setup ${{matrix.arch}} elif [[ ${{matrix.arch}} == linux-x86-nosimd ]]; then CXX=gcc CXX_LD=gold meson setup ${{matrix.arch}} -Dnosimd=true elif [[ ${{matrix.arch}} == linux-amd64 ]]; then CXX=clang CXX_LD=lld meson setup ${{matrix.arch}} -D64bit=true elif [[ ${{matrix.arch}} == windows-amd64 ]]; then meson setup ${{matrix.arch}} --cross-file ${{matrix.arch}} -D64bit=true elif [[ ${{matrix.arch}} == apple-x86 ]]; then meson setup ${{matrix.arch}} --cross-file ${{matrix.arch}} -Db_lto=false else meson setup ${{matrix.arch}} --cross-file ${{matrix.arch}} fi - name: Build sources shell: bash run: | meson compile -C ${{matrix.arch}} -v echo "artifcat=${{matrix.arch}}/`ls ${{matrix.arch}}/ | egrep '^yapb*.*(so|dylib|dll)$' | head -1`" >> $GITHUB_ENV - name: Upload artifacts uses: actions/upload-artifact@v4 with: name: ${{matrix.arch}} path: ${{env.artifcat}} bot-msvc: env: name: windows-x86-msvc strategy: matrix: arch: ['windows-x86', 'windows-x86-msvc-xp'] fail-fast: false runs-on: windows-latest steps: - name: Checkout repository uses: actions/checkout@v4 with: fetch-depth: 0 submodules: true - name: Setup msbuild uses: ilammy/msvc-dev-cmd@v1 with: arch: amd64_x86 - name: Install meson run: | python -m pip install --upgrade meson ninja - name: Configure meson shell: pwsh run: | if ('${{matrix.arch}}' -eq 'windows-x86-msvc-xp') { meson setup ${{matrix.arch}} -Dwinxp=true } else { meson setup ${{matrix.arch}} } - name: Build sources run: | meson compile -C ${{matrix.arch}} -v - name: Upload artifacts uses: actions/upload-artifact@v4 with: name: ${{matrix.arch}} path: | ${{matrix.arch}}/yapb.dll bot-apple: env: name: apple-arm64 strategy: matrix: arch: ['apple-arm64'] fail-fast: false runs-on: macos-latest steps: - name: Checkout repository uses: actions/checkout@v4 with: fetch-depth: 0 submodules: true - name: Install meson run: | python -m pip install --upgrade meson ninja - name: Configure meson run: | meson setup ${{matrix.arch}} - name: Build sources run: | meson compile -C ${{matrix.arch}} -v - name: Upload artifacts uses: actions/upload-artifact@v4 with: name: ${{matrix.arch}} path: | ${{matrix.arch}}/yapb*.dylib bot-continuous-release: if: github.event_name == 'push' name: bot-continuous-release runs-on: ubuntu-latest needs: [bot-build, bot-msvc, bot-apple] steps: - name: Checkout repository uses: actions/checkout@v4 with: fetch-depth: 0 submodules: true - name: Install signing tools run: | sudo apt-get update sudo apt-get install -y --no-install-recommends osslsigncode - name: Get artifacts uses: actions/download-artifact@v4 with: path: artifacts - name: Setup python uses: actions/setup-python@v5 with: python-version: '3.x' - name: Configure meson run: | python -m pip install --upgrade meson ninja requests - name: Create packages run: | meson setup dist ninja -C dist package env: CS_CERTIFICATE: ${{secrets.CS_CERTIFICATE}} CS_CERTIFICATE_PASSWORD: ${{secrets.CS_CERTIFICATE_PASSWORD}} - name: Purge old build continue-on-error: true run: gh release delete continuous --cleanup-tag env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Very important stage continue-on-error: true run: | sleep 20s - name: Push new build run: gh release create continuous --generate-notes --prerelease --title "Continuous Build" ./pkg/* env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} bot-release: if: | github.event_name == 'release' && github.event.action == 'published' name: bot-release runs-on: ubuntu-latest needs: [bot-build, bot-msvc] steps: - name: Checkout repository uses: actions/checkout@v4 with: fetch-depth: 0 submodules: true - name: Install signing tools run: | sudo apt-get update sudo apt-get install -y --no-install-recommends osslsigncode - name: Get artifacts uses: actions/download-artifact@v4 with: path: artifacts - name: Setup Python uses: actions/setup-python@v5 with: python-version: '3.x' - name: Configure meson run: | python -m pip install --upgrade meson ninja requests - name: Create packages run: | meson setup dist ninja -C dist package env: CS_CERTIFICATE: ${{secrets.CS_CERTIFICATE}} CS_CERTIFICATE_PASSWORD: ${{secrets.CS_CERTIFICATE_PASSWORD}} - name: Publish release uses: softprops/action-gh-release@v1 if: startsWith(github.ref, 'refs/tags/') with: files: pkg/* env: GITHUB_TOKEN: ${{secrets.API_TOKEN}}