|
| 1 | +name: build |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ "develop-lsdk-21.08" ] |
| 6 | + pull_request: |
| 7 | + branches: [ "develop-lsdk-21.08" ] |
| 8 | + # Allows you to run this workflow manually from the Actions tab |
| 9 | + workflow_dispatch: |
| 10 | + |
| 11 | +jobs: |
| 12 | + prepare_container: |
| 13 | + runs-on: self-hosted |
| 14 | + outputs: |
| 15 | + uid: ${{ steps.uid_step.outputs.userid }} |
| 16 | + gid: ${{ steps.uid_step.outputs.groupid }} |
| 17 | + steps: |
| 18 | + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it |
| 19 | + - uses: actions/checkout@v4 |
| 20 | + |
| 21 | + - name: Get user id/group |
| 22 | + id: uid_step |
| 23 | + run: | |
| 24 | + echo "userid=$(id -u)" >> "$GITHUB_OUTPUT" |
| 25 | + echo "groupid=$(id -g)" >> "$GITHUB_OUTPUT" |
| 26 | +
|
| 27 | + - name: Set up Docker Buildx |
| 28 | + uses: docker/setup-buildx-action@v3 |
| 29 | + with: |
| 30 | + buildkitd-config: /etc/docker/cibuilder.toml |
| 31 | + |
| 32 | + - name: Login to Docker Registry |
| 33 | + uses: docker/login-action@v3 |
| 34 | + with: |
| 35 | + registry: ciserver.ci:5000 |
| 36 | + username: ${{ secrets.CI_CACHE_REGISTRY_LOGIN }} |
| 37 | + password: ${{ secrets.CI_CACHE_REGISTRY_PASSWORD }} |
| 38 | + |
| 39 | + - name: Build and push |
| 40 | + uses: docker/build-push-action@v5 |
| 41 | + with: |
| 42 | + context: docker |
| 43 | + push: true |
| 44 | + tags: ciserver.ci:5000/${{ github.repository_id }}:lsdk-21.08 |
| 45 | + cache-from: type=registry,ref=ciserver.ci:5000/${{ github.repository_id }}:cache |
| 46 | + cache-to: type=registry,ref=ciserver.ci:5000/${{ github.repository_id }}:cache,mode=max |
| 47 | + build-args: | |
| 48 | + USER_ID=${{ steps.uid_step.outputs.userid }} |
| 49 | + GROUP_ID=${{ steps.uid_step.outputs.groupid }} |
| 50 | +
|
| 51 | + build_images: |
| 52 | + needs: prepare_container |
| 53 | + runs-on: self-hosted |
| 54 | + timeout-minutes: 1080 |
| 55 | + container: |
| 56 | + image: ciserver.ci:5000/${{ github.repository_id }}:lsdk-21.08 |
| 57 | + credentials: |
| 58 | + username: ${{ secrets.CI_CACHE_REGISTRY_LOGIN }} |
| 59 | + password: ${{ secrets.CI_CACHE_REGISTRY_PASSWORD }} |
| 60 | + options: --user "${{ needs.prepare_container.outputs.uid }}:${{ needs.prepare_container.outputs.gid }}" |
| 61 | + outputs: |
| 62 | + build_tag: ${{ steps.tag_step.outputs.build_tag }} |
| 63 | + steps: |
| 64 | + - name: Checkout pull-request version of lx2160a_build |
| 65 | + uses: actions/checkout@v4 |
| 66 | + |
| 67 | + - name: Get build tag |
| 68 | + shell: bash {0} |
| 69 | + id: tag_step |
| 70 | + run: | |
| 71 | + build_tag=$(date +%Y-%m-%d)_$(git rev-parse --short HEAD) |
| 72 | + echo "build_tag=$build_tag" >> "$GITHUB_OUTPUT" |
| 73 | +
|
| 74 | + - name: Build |
| 75 | + shell: bash {0} |
| 76 | + run: | |
| 77 | + env SHALLOW=true BUS_SPEED=700 DDR_SPEED=2400 SERDES=8_5_2 ./runme.sh |
| 78 | + env SHALLOW=true BUS_SPEED=700 DDR_SPEED=2600 SERDES=8_5_2 ./runme.sh |
| 79 | + env SHALLOW=true BUS_SPEED=700 DDR_SPEED=2900 SERDES=8_5_2 ./runme.sh |
| 80 | + env SHALLOW=true BUS_SPEED=650 DDR_SPEED=2900 SERDES=LX2162A_CLEARFOG_18_9_0 ./runme.sh |
| 81 | + env SHALLOW=true BOOTSOURCE=auto BUS_SPEED=700 CPU_REVISION=2 CPU_SPEED=2000 DDR_SPEED=2600 TARGET=LX2160A_CEX7_CLEARFOG-CX_8_5_2 ./runme.sh |
| 82 | + env SHALLOW=true BOOTSOURCE=auto BUS_SPEED=700 CPU_REVISION=2 CPU_SPEED=2000 DDR_SPEED=2900 TARGET=LX2160A_CEX7_CLEARFOG-CX_8_5_2 ./runme.sh |
| 83 | +
|
| 84 | + - name: Select artifacts for publishing |
| 85 | + shell: bash -e {0} |
| 86 | + run: | |
| 87 | + mkdir deploy |
| 88 | + cp -L images/linux-*.tar deploy/ |
| 89 | + cp -L images/linux-headers-*.tar deploy/ |
| 90 | + cp -L images/*.img deploy/ |
| 91 | + xz -9 deploy/* |
| 92 | + ls -lh deploy |
| 93 | +
|
| 94 | + - name: Deploy to the local minio storage |
| 95 | + |
| 96 | + with: |
| 97 | + endpoint: http://ciserver.ci:9000 |
| 98 | + insecure: true |
| 99 | + access_key: ${{ secrets.CI_CACHE_MINIO_ACCESS }} |
| 100 | + secret_key: ${{ secrets.CI_CACHE_MINIO_SECRET }} |
| 101 | + bucket: cipublish |
| 102 | + source: ./deploy |
| 103 | + target: "/${{ github.repository_id }}/${{ steps.tag_step.outputs.build_tag }}" |
| 104 | + recursive: true |
| 105 | + |
| 106 | + publish_images: |
| 107 | + needs: build_images |
| 108 | + runs-on: self-hosted |
| 109 | + if: github.ref == 'refs/heads/develop-lsdk-21.08' && github.event_name != 'pull_request' |
| 110 | + steps: |
| 111 | + - name: Download an artifacts from MinIO |
| 112 | + |
| 113 | + with: |
| 114 | + endpoint: http://ciserver.ci:9000 |
| 115 | + insecure: true |
| 116 | + access_key: ${{ secrets.CI_CACHE_MINIO_ACCESS }} |
| 117 | + secret_key: ${{ secrets.CI_CACHE_MINIO_SECRET }} |
| 118 | + bucket: cipublish |
| 119 | + source: "/${{ github.repository_id }}/${{ needs.build_images.outputs.build_tag }}/" |
| 120 | + target: "." |
| 121 | + recursive: true |
| 122 | + |
| 123 | + - name: Upload to S3 |
| 124 | + uses: shallwefootball/[email protected] |
| 125 | + with: |
| 126 | + aws_key_id: ${{ secrets.IMAGES_S3_ACCESS }} |
| 127 | + aws_secret_access_key: ${{ secrets.IMAGES_S3_SECRET }} |
| 128 | + aws_bucket: ${{ secrets.IMAGES_S3_BUCKET }} |
| 129 | + endpoint: ${{ secrets.IMAGES_S3_HOST }} |
| 130 | + source_dir: deploy |
| 131 | + destination_dir: LX2k/lx2160a_build/lsdk-21.08/${{ needs.build_images.outputs.build_tag }} |
0 commit comments