mirror of
				https://github.com/XRPLF/clio.git
				synced 2025-11-04 03:45:50 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			143 lines
		
	
	
		
			3.8 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
			
		
		
	
	
			143 lines
		
	
	
		
			3.8 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
name: Build Clio
 | 
						|
on:
 | 
						|
  push:
 | 
						|
    branches:  [master, release, develop, develop-next]
 | 
						|
  pull_request:
 | 
						|
    branches:  [master, release, develop, develop-next]
 | 
						|
  workflow_dispatch:
 | 
						|
 | 
						|
jobs:
 | 
						|
  lint:
 | 
						|
    name: Lint
 | 
						|
    runs-on: ubuntu-20.04
 | 
						|
    steps:
 | 
						|
      - uses: actions/checkout@v3
 | 
						|
      - name: Run clang-format
 | 
						|
        uses: ./.github/actions/lint
 | 
						|
 | 
						|
  build_clio:
 | 
						|
    name: Build Clio
 | 
						|
    runs-on: [self-hosted, Linux]
 | 
						|
    needs: lint
 | 
						|
    strategy:
 | 
						|
      fail-fast: false
 | 
						|
      matrix:
 | 
						|
        type:
 | 
						|
          - suffix: deb
 | 
						|
            image: rippleci/clio-dpkg-builder:2022-09-17
 | 
						|
            script: dpkg
 | 
						|
          - suffix: rpm
 | 
						|
            image: rippleci/clio-rpm-builder:2022-09-17
 | 
						|
            script: rpm
 | 
						|
    container:
 | 
						|
      image: ${{ matrix.type.image }}
 | 
						|
 | 
						|
    steps:
 | 
						|
      - uses: actions/checkout@v3
 | 
						|
        with:
 | 
						|
          path: clio
 | 
						|
 | 
						|
      - name: Clone Clio packaging repo
 | 
						|
        uses: actions/checkout@v3
 | 
						|
        with:
 | 
						|
          path: clio-packages
 | 
						|
          repository: XRPLF/clio-packages
 | 
						|
 | 
						|
      - name: Build
 | 
						|
        shell: bash
 | 
						|
        run: |
 | 
						|
          export CLIO_ROOT=$(realpath clio)
 | 
						|
          if [ ${{ matrix.type.suffix }} == "rpm" ]; then
 | 
						|
            source /opt/rh/devtoolset-11/enable
 | 
						|
          fi
 | 
						|
          cmake -S clio-packages -B clio-packages/build -DCLIO_ROOT=$CLIO_ROOT
 | 
						|
          cmake --build clio-packages/build --parallel $(nproc)
 | 
						|
          cp ./clio-packages/build/clio-prefix/src/clio-build/clio_tests .
 | 
						|
          mv ./clio-packages/build/*.${{ matrix.type.suffix }} .
 | 
						|
 | 
						|
      - name: Artifact packages
 | 
						|
        uses: actions/upload-artifact@v3
 | 
						|
        with:
 | 
						|
          name: clio_${{ matrix.type.suffix }}_packages
 | 
						|
          path: ${{ github.workspace }}/*.${{ matrix.type.suffix }}
 | 
						|
 | 
						|
      - name: Artifact clio_tests
 | 
						|
        uses: actions/upload-artifact@v3
 | 
						|
        with:
 | 
						|
          name: clio_tests-${{ matrix.type.suffix }}
 | 
						|
          path: ${{ github.workspace }}/clio_tests
 | 
						|
 | 
						|
  sign:
 | 
						|
    name: Sign packages
 | 
						|
    needs: build_clio
 | 
						|
    runs-on: ubuntu-20.04
 | 
						|
    if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/release' || github.ref == 'refs/heads/develop'
 | 
						|
    env:
 | 
						|
      GPG_KEY_B64: ${{ secrets.GPG_KEY_B64 }}
 | 
						|
      GPG_KEY_PASS_B64: ${{ secrets.GPG_KEY_PASS_B64 }}
 | 
						|
    strategy:
 | 
						|
      fail-fast: false
 | 
						|
      matrix:
 | 
						|
        type:
 | 
						|
          - suffix: deb
 | 
						|
            image: ubuntu:20.04
 | 
						|
            script: dpkg
 | 
						|
          # - suffix: rpm
 | 
						|
          #   image: centos:7
 | 
						|
          #   script: rpm
 | 
						|
    container:
 | 
						|
      image: ${{ matrix.type.image }}
 | 
						|
    steps:
 | 
						|
      - uses: actions/checkout@v3
 | 
						|
      - name: Install dpkg-sig
 | 
						|
        run: |
 | 
						|
          apt-get update && apt-get install -y dpkg-sig gnupg
 | 
						|
      - name: Get package artifact
 | 
						|
        uses: actions/download-artifact@v3
 | 
						|
        with:
 | 
						|
          name: clio_${{ matrix.type.suffix }}_packages
 | 
						|
 | 
						|
      - name: find packages
 | 
						|
        run: find . -name "*.${{ matrix.type.suffix }}"
 | 
						|
 | 
						|
      - name: Sign packages
 | 
						|
        uses: ./.github/actions/sign
 | 
						|
 | 
						|
 | 
						|
      - name: Verify the signature
 | 
						|
        run: |
 | 
						|
          set -e
 | 
						|
          for PKG in $(ls *.deb); do
 | 
						|
            gpg --verify "${PKG}"
 | 
						|
          done
 | 
						|
 | 
						|
      - name: Get short SHA
 | 
						|
        id: shortsha
 | 
						|
        run: echo "::set-output name=sha8::$(echo ${GITHUB_SHA} | cut -c1-8)"
 | 
						|
 | 
						|
      - name: Artifact signed packages
 | 
						|
        uses: actions/upload-artifact@v2
 | 
						|
        with:
 | 
						|
          name: signed-clio-deb-packages-${{ steps.shortsha.outputs.sha8 }}
 | 
						|
          path: ${{ github.workspace }}/*.deb
 | 
						|
 | 
						|
  test_clio:
 | 
						|
    name: Test Clio
 | 
						|
    runs-on: [self-hosted, Linux]
 | 
						|
    needs: build_clio
 | 
						|
    strategy:
 | 
						|
      fail-fast: false
 | 
						|
      matrix:
 | 
						|
        suffix: [rpm, deb]
 | 
						|
    steps:
 | 
						|
      - uses: actions/checkout@v3
 | 
						|
 | 
						|
      - name: Get clio_tests artifact
 | 
						|
        uses: actions/download-artifact@v3
 | 
						|
        with:
 | 
						|
          name: clio_tests-${{ matrix.suffix }}
 | 
						|
 | 
						|
      - name: Run tests
 | 
						|
        timeout-minutes: 10
 | 
						|
        uses: ./.github/actions/test
 |