mirror of
				https://github.com/ArthurSonzogni/FTXUI.git
				synced 2025-11-04 05:28:15 +08:00 
			
		
		
		
	Support Bazel build system (#1033)
Bug:https://github.com/ArthurSonzogni/FTXUI/issues/1032 Fixed:https://github.com/ArthurSonzogni/FTXUI/issues/1032
This commit is contained in:
		
							
								
								
									
										66
									
								
								.github/workflows/build.yaml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										66
									
								
								.github/workflows/build.yaml
									
									
									
									
										vendored
									
									
								
							@@ -10,8 +10,41 @@ on:
 | 
			
		||||
      - main
 | 
			
		||||
 | 
			
		||||
jobs:
 | 
			
		||||
  test:
 | 
			
		||||
    name: "Tests"
 | 
			
		||||
 | 
			
		||||
  test_bazel:
 | 
			
		||||
    name: "Bazel, ${{ matrix.compiler }}, ${{ matrix.os }}"
 | 
			
		||||
    strategy:
 | 
			
		||||
      fail-fast: false
 | 
			
		||||
      matrix:
 | 
			
		||||
        include:
 | 
			
		||||
          - os: ubuntu-latest
 | 
			
		||||
            compiler: gcc
 | 
			
		||||
 | 
			
		||||
          - os: ubuntu-latest
 | 
			
		||||
            compiler: llvm
 | 
			
		||||
 | 
			
		||||
          - os: macos-latest
 | 
			
		||||
            compiler: llvm
 | 
			
		||||
 | 
			
		||||
          - os: macos-latest
 | 
			
		||||
            compiler: gcc
 | 
			
		||||
 | 
			
		||||
          - os: windows-latest
 | 
			
		||||
            compiler: cl
 | 
			
		||||
 | 
			
		||||
    runs-on: ${{ matrix.os }}
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: "Checkout repository"
 | 
			
		||||
        uses: actions/checkout@v3
 | 
			
		||||
 | 
			
		||||
      - name: "Build with Bazel"
 | 
			
		||||
        run: bazel build ...
 | 
			
		||||
 | 
			
		||||
      - name: "Tests with Bazel"
 | 
			
		||||
        run: bazel run tests
 | 
			
		||||
 | 
			
		||||
  test_cmake:
 | 
			
		||||
    name: "CMake, ${{ matrix.compiler }}, ${{ matrix.os }}"
 | 
			
		||||
    strategy:
 | 
			
		||||
      fail-fast: false
 | 
			
		||||
      matrix:
 | 
			
		||||
@@ -122,7 +155,9 @@ jobs:
 | 
			
		||||
 | 
			
		||||
  # Create a release on new v* tags
 | 
			
		||||
  release:
 | 
			
		||||
    needs: test
 | 
			
		||||
    needs:
 | 
			
		||||
      - test_cmake
 | 
			
		||||
      - test_bazel
 | 
			
		||||
    if: ${{ github.event_name == 'create' && startsWith(github.ref, 'refs/tags/v') }}
 | 
			
		||||
    name: "Create release"
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
@@ -138,7 +173,7 @@ jobs:
 | 
			
		||||
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
 | 
			
		||||
 | 
			
		||||
  # Build artifact for the release
 | 
			
		||||
  package:
 | 
			
		||||
  package_compiled:
 | 
			
		||||
    name: "Build packages"
 | 
			
		||||
    needs: release
 | 
			
		||||
    strategy:
 | 
			
		||||
@@ -182,6 +217,29 @@ jobs:
 | 
			
		||||
          upload_url: ${{ needs.release.outputs.upload_url }}
 | 
			
		||||
          asset_path: ${{ matrix.asset_path }}
 | 
			
		||||
          overwrite: true
 | 
			
		||||
 | 
			
		||||
  # Build "source" artifact for the release. This is the same as the github
 | 
			
		||||
  # "source" archive, but with a stable URL. This is useful for the Bazel
 | 
			
		||||
  # Central Repository.
 | 
			
		||||
  package_source:
 | 
			
		||||
    name: "Build source package"
 | 
			
		||||
    needs: release
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    steps:
 | 
			
		||||
      - name: "Checkout repository"
 | 
			
		||||
        uses: actions/checkout@v3
 | 
			
		||||
 | 
			
		||||
      - name: "Create source package"
 | 
			
		||||
        run: >
 | 
			
		||||
          git archive --format=tar.gz --prefix=ftxui/ -o source.tar.gz HEAD
 | 
			
		||||
 | 
			
		||||
      - name: "Upload source package"
 | 
			
		||||
        uses: shogo82148/actions-upload-release-asset@v1
 | 
			
		||||
        with:
 | 
			
		||||
          upload_url: ${{ needs.release.outputs.upload_url }}
 | 
			
		||||
          asset_path: source.tar.gz
 | 
			
		||||
          overwrite: true
 | 
			
		||||
 | 
			
		||||
  
 | 
			
		||||
  documentation:
 | 
			
		||||
    if: github.ref == 'refs/heads/main'
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										27
									
								
								.github/workflows/publish.yaml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								.github/workflows/publish.yaml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,27 @@
 | 
			
		||||
on:
 | 
			
		||||
  # On new releases:
 | 
			
		||||
  workflow_call:
 | 
			
		||||
    inputs:
 | 
			
		||||
      tag_name:
 | 
			
		||||
        required: true
 | 
			
		||||
        type: string
 | 
			
		||||
 | 
			
		||||
  # On manual trigger:
 | 
			
		||||
  workflow_dispatch:
 | 
			
		||||
    inputs:
 | 
			
		||||
      tag_name:
 | 
			
		||||
        required: true
 | 
			
		||||
        type: string
 | 
			
		||||
 | 
			
		||||
jobs:    
 | 
			
		||||
  publish:
 | 
			
		||||
    uses: bazel-contrib/publish-to-bcr/.github/workflows/publish.yaml@v0.0.4
 | 
			
		||||
    with:
 | 
			
		||||
      tag_name: ${{ inputs.tag_name }}
 | 
			
		||||
      registry_fork: ArthurSonzogni/bazel-central-registry
 | 
			
		||||
    permissions:
 | 
			
		||||
      attestations: write
 | 
			
		||||
      contents: write
 | 
			
		||||
      id-token: write
 | 
			
		||||
    secrets:
 | 
			
		||||
      publish_token: ${{ secrets.PUBLISH_TOKEN }}
 | 
			
		||||
		Reference in New Issue
	
	Block a user