|
6 | 6 | branches: [ master ]
|
7 | 7 |
|
8 | 8 | jobs:
|
9 |
| - # TODO(https://github.com/AcademySoftwareFoundation/OpenCue/issues/715) Add the other |
10 |
| - # packaging steps here. Things like building Docker images and extracting artifacts |
11 |
| - # will need to be generalized, but we need to test a few things in the master branch |
12 |
| - # first to make sure things are working as we expect. |
13 |
| - build_cuebot: |
14 |
| - name: Build Cuebot |
| 9 | + build_components: |
15 | 10 | runs-on: ubuntu-latest
|
| 11 | + strategy: |
| 12 | + matrix: |
| 13 | + component: [cuebot, rqd] |
| 14 | + include: |
| 15 | + - component: cuebot |
| 16 | + NAME: Cuebot |
| 17 | + ARTIFACTS: cuebot-${BUILD_ID}-all.jar opencue-cuebot-${BUILD_ID}-1.noarch.rpm |
| 18 | + |
| 19 | + - component: rqd |
| 20 | + NAME: RQD |
| 21 | + ARTIFACTS: rqd-${BUILD_ID}-all.tar.gz |
| 22 | + |
| 23 | + - component: cuegui |
| 24 | + NAME: CueGUI |
| 25 | + ARTIFACTS: cuegui-${BUILD_ID}-all.tar.gz |
| 26 | + |
| 27 | + - component: pycue |
| 28 | + NAME: PyCue |
| 29 | + ARTIFACTS: pycue-${BUILD_ID}-all.tar.gz |
| 30 | + |
| 31 | + - component: pyoutline |
| 32 | + NAME: PyOutline |
| 33 | + ARTIFACTS: pyoutline-${BUILD_ID}-all.tar.gz |
| 34 | + |
| 35 | + - component: cuesubmit |
| 36 | + NAME: CueSubmit |
| 37 | + ARTIFACTS: cuesubmit-${BUILD_ID}-all.tar.gz |
| 38 | + |
| 39 | + - component: cueadmin |
| 40 | + NAME: CueAdmin |
| 41 | + ARTIFACTS: cueadmin-${BUILD_ID}-all.tar.gz |
| 42 | + |
| 43 | + name: Build ${{ matrix.NAME }} |
16 | 44 | steps:
|
17 |
| - - uses: actions/checkout@v2 |
| 45 | + - name: Checkout |
| 46 | + uses: actions/checkout@v2 |
18 | 47 | with:
|
19 | 48 | # Fetch all Git history, otherwise the current version number will
|
20 | 49 | # not be correctly calculated.
|
21 | 50 | fetch-depth: 0
|
| 51 | + |
| 52 | + - name: Configure AWS credentials |
| 53 | + uses: aws-actions/configure-aws-credentials@v1 |
| 54 | + with: |
| 55 | + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} |
| 56 | + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
| 57 | + aws-region: ${{ secrets.S3_REGION }} |
| 58 | + role-to-assume: ${{ secrets.AWS_S3_ROLE }} |
| 59 | + role-duration-seconds: 1800 |
| 60 | + |
22 | 61 | - name: Set build ID
|
23 | 62 | run: |
|
24 | 63 | set -e
|
25 | 64 | ci/generate_version_number.sh > VERSION
|
26 | 65 | echo "Build ID: $(cat ./VERSION)"
|
27 | 66 | echo "::set-env name=BUILD_ID::$(cat ./VERSION)"
|
28 |
| - - uses: docker/build-push-action@v1 |
29 |
| - name: Build Docker image |
| 67 | +
|
| 68 | + - name: Build Docker image |
| 69 | + uses: docker/build-push-action@v1 |
30 | 70 | with:
|
31 | 71 | username: ${{ secrets.DOCKER_USER }}
|
32 | 72 | password: ${{ secrets.DOCKER_PASS }}
|
33 |
| - dockerfile: cuebot/Dockerfile |
34 |
| - repository: opencuebuild/cuebot |
| 73 | + dockerfile: ${{ matrix.component }}/Dockerfile |
| 74 | + repository: opencuebuild/${{ matrix.component }} |
35 | 75 | tags: ${{ env.BUILD_ID }}
|
| 76 | + |
36 | 77 | - name: Extract Artifacts
|
37 | 78 | run: |
|
38 | 79 | set -e
|
39 |
| - image_name="opencuebuild/cuebot:${BUILD_ID}" |
| 80 | + image_name="opencuebuild/${{ matrix.component }}:${BUILD_ID}" |
40 | 81 | container_id=$(docker create ${image_name})
|
41 |
| - artifacts="/opt/opencue/cuebot-${BUILD_ID}-all.jar /opt/opencue/opencue-cuebot-${BUILD_ID}-1.noarch.rpm" |
| 82 | + artifacts="${{ matrix.ARTIFACTS }}" |
42 | 83 | mkdir -p "${GITHUB_WORKSPACE}/artifacts/"
|
43 | 84 | for artifact in $artifacts; do
|
44 |
| - docker cp ${container_id}:${artifact} "${GITHUB_WORKSPACE}/artifacts/" |
| 85 | + docker cp ${container_id}:/opt/opencue/${artifact} "${GITHUB_WORKSPACE}/artifacts/" |
45 | 86 | done
|
46 | 87 | docker rm $container_id
|
47 |
| - - uses: actions/upload-artifact@v2 |
48 |
| - name: Upload JAR |
| 88 | +
|
| 89 | + - name: Upload Artifacts |
| 90 | + env: |
| 91 | + S3_BUCKET: ${{ secrets.S3_BUCKET }} |
| 92 | + run: | |
| 93 | + artifacts="${{ matrix.ARTIFACTS }}" |
| 94 | + for artifact in $artifacts; do |
| 95 | + aws s3 cp ${GITHUB_WORKSPACE}/artifacts/${artifact} s3://${S3_BUCKET}/opencue/${BUILD_ID}/ |
| 96 | + done |
| 97 | +
|
| 98 | + create_other_artifacts: |
| 99 | + needs: build_components |
| 100 | + runs-on: ubuntu-latest |
| 101 | + name: Create Other Build Artifacts |
| 102 | + steps: |
| 103 | + - name: Checkout |
| 104 | + uses: actions/checkout@v2 |
49 | 105 | with:
|
50 |
| - name: cuebot-jar |
51 |
| - path: ${{ github.workspace }}/artifacts/cuebot-*.jar |
52 |
| - - uses: actions/upload-artifact@v2 |
53 |
| - name: Upload RPM |
| 106 | + # Fetch all Git history, otherwise the current version number will |
| 107 | + # not be correctly calculated. |
| 108 | + fetch-depth: 0 |
| 109 | + |
| 110 | + - name: Configure AWS credentials |
| 111 | + uses: aws-actions/configure-aws-credentials@v1 |
54 | 112 | with:
|
55 |
| - name: cuebot-rpm |
56 |
| - path: ${{ github.workspace }}/artifacts/opencue-cuebot-*.rpm |
57 |
| - # TODO(https://github.com/AcademySoftwareFoundation/OpenCue/issues/715) Remove this step |
58 |
| - # in the next PR. This info will help us track this pipeline's artifacts as we attempt |
59 |
| - # to download them later, in the release pipeline. Once we know how the artifact tagging |
60 |
| - # works in the master branch it won't be needed anymore. |
61 |
| - - name: Print environment information |
| 113 | + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} |
| 114 | + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
| 115 | + aws-region: ${{ secrets.S3_REGION }} |
| 116 | + role-to-assume: ${{ secrets.AWS_S3_ROLE }} |
| 117 | + role-duration-seconds: 1800 |
| 118 | + |
| 119 | + - name: Set build ID |
62 | 120 | run: |
|
63 | 121 | set -e
|
64 |
| - echo "This SHA: ${{ github.sha }}" |
65 |
| - echo "This workflow run: ${{ github.run_id }}" |
| 122 | + ci/generate_version_number.sh > VERSION |
| 123 | + echo "Build ID: $(cat ./VERSION)" |
| 124 | + echo "::set-env name=BUILD_ID::$(cat ./VERSION)" |
| 125 | +
|
| 126 | + - name: Extract database schema |
| 127 | + run: | |
| 128 | + mkdir -p "${GITHUB_WORKSPACE}/artifacts/" |
| 129 | + ci/extract_schema.sh ${BUILD_ID} "${GITHUB_WORKSPACE}/artifacts/" |
| 130 | +
|
| 131 | + - name: Create build metadata |
| 132 | + run: | |
| 133 | + mkdir -p "${GITHUB_WORKSPACE}/artifacts/" |
| 134 | + echo "{\"git_commit\": \"$(BUILD_SOURCEVERSION)\"}" | tee "${GITHUB_WORKSPACE}/artifacts/build_metadata.json" |
| 135 | +
|
| 136 | + - name: Upload artifacts |
| 137 | + env: |
| 138 | + S3_BUCKET: ${{ secrets.S3_BUCKET }} |
| 139 | + run: | |
| 140 | + aws s3 cp LICENSE s3://${S3_BUCKET}/opencue/${BUILD_ID}/ |
| 141 | + aws s3 cp VERSION s3://${S3_BUCKET}/opencue/${BUILD_ID}/ |
| 142 | + aws s3 cp "${GITHUB_WORKSPACE}/artifacts/schema-${BUILD_ID}.sql" s3://${S3_BUCKET}/opencue/${BUILD_ID}/ |
| 143 | + aws s3 cp "${GITHUB_WORKSPACE}/artifacts/demo_data-${BUILD_ID}.sql" s3://${S3_BUCKET}/opencue/${BUILD_ID}/ |
| 144 | + aws s3 cp "${GITHUB_WORKSPACE}/artifacts/build_metadata.json" s3://${S3_BUCKET}/opencue/${BUILD_ID}/ |
| 145 | +
|
| 146 | + - name: Display artifacts |
| 147 | + env: |
| 148 | + S3_BUCKET: ${{ secrets.S3_BUCKET }} |
| 149 | + run: | |
| 150 | + aws s3 ls s3://${S3_BUCKET}/opencue/${BUILD_ID}/ |
0 commit comments