name: CI on: push: pull_request_target: permissions: contents: read packages: write env: DOCKER_DRIVER: overlay2 FAST_MODE: false jobs: builder-image: name: Builder Image runs-on: ubuntu-20.04 outputs: image-tag: ${{ steps.prepare.outputs.image-tag }} repo-name: ${{ steps.prepare.outputs.repo-name }} steps: - name: Checkout code uses: actions/checkout@v4 - name: Prepare id: prepare run: | BRANCH_NAME=$(echo "${GITHUB_REF##*/}" | tr '[:upper:]' '[:lower:]') REPO_NAME=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]') echo "::set-output name=image-tag::${BRANCH_NAME}" echo "::set-output name=repo-name::${REPO_NAME}" - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Login to GitHub Container Registry uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Build and push Docker image uses: docker/build-push-action@v6 with: context: ./contrib/containers/ci file: ./contrib/containers/ci/Dockerfile push: true tags: | ghcr.io/${{ steps.prepare.outputs.repo-name }}/builder:${{ steps.prepare.outputs.image-tag }} ghcr.io/${{ steps.prepare.outputs.repo-name }}/builder:latest cache-from: type=registry,ref=ghcr.io/${{ steps.prepare.outputs.repo-name }}/builder:latest cache-to: type=inline build-depends: name: Build Dependencies needs: builder-image runs-on: ubuntu-20.04 strategy: matrix: include: - build_target: arm-linux host: arm-linux-gnueabihf container: image: ghcr.io/${{ needs.builder-image.outputs.repo-name }}/builder:${{ needs.builder-image.outputs.image-tag }} options: --user root steps: - name: Checkout code uses: actions/checkout@v4 - name: Cache dependencies uses: actions/cache@v4 with: path: | depends/built depends/${{ matrix.host }} depends/sdk-sources # We don't care about no specific key as depends system will handle that for us key: ${{ runner.os }}-depends-${{ matrix.host }}-${{ github.sha }} restore-keys: | ${{ runner.os }}-depends-${{ matrix.host }}-${{ github.sha }} ${{ runner.os }}-depends-${{ matrix.host }} ${{ runner.os }}-depends - name: Build dependencies run: make -j$(nproc) -C depends HOST=${{ matrix.host }} build: name: Build needs: [builder-image, build-depends] runs-on: ubuntu-20.04 strategy: matrix: include: - build_target: arm-linux host: arm-linux-gnueabihf dep_opts: DEBUG=1 container: image: ghcr.io/${{ needs.builder-image.outputs.repo-name }}/builder:${{ needs.builder-image.outputs.image-tag }} options: --user root steps: - name: Checkout code uses: actions/checkout@v4 - name: Restore Cache dependencies uses: actions/cache/restore@v4 with: path: | depends/built depends/${{ matrix.host }} depends/sdk-sources # We don't care about no specific key as depends system will handle that for us key: ${{ runner.os }}-depends-${{ matrix.host }}-${{ github.sha }} restore-keys: | ${{ runner.os }}-depends-${{ matrix.host }}-${{ github.sha }} ${{ runner.os }}-depends-${{ matrix.host }} ${{ runner.os }}-depends - name: CCache uses: actions/cache@v4 with: path: | /cache key: ${{ runner.os }}-${{ matrix.host }}-${{ github.sha }} restore-keys: | ${{ runner.os }}-${{ matrix.host }}-${{ github.sha }} ${{ runner.os }}-${{ matrix.host }} ${{ runner.os }} - name: Build source and run tests run: | git config --global --add safe.directory "$PWD" CCACHE_SIZE="400M" CACHE_DIR="/cache" mkdir /output BASE_OUTDIR="/output" BUILD_TARGET="${{ matrix.build_target }}" source ./ci/dash/matrix.sh ./ci/dash/build_src.sh ./ci/dash/test_unittests.sh shell: bash - name: Upload build artifacts uses: actions/upload-artifact@v4 with: name: build-artifacts path: | /output # Come back to this later and implement tests :) # test: # name: Test # needs: [builder-image, build] # runs-on: ubuntu-20.04 # container: # image: ghcr.io/${{ needs.builder-image.outputs.repo-name }}/builder:${{ needs.builder-image.outputs.image-tag }} # options: --user root # steps: # - name: Checkout code # uses: actions/checkout@v4 # # - name: Download build artifacts # uses: actions/download-artifact@v4 # with: # name: build-artifacts # path: src/ # ## - name: Setup environment ## run: | ## echo "BUILD_TARGET=${{ needs.build.matrix.build_target }}" ## source ./ci/dash/matrix.sh # # - name: Run integration tests # run: ./ci/dash/test_integrationtests.sh --extended --exclude feature_pruning,feature_dbcrash