-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Beginning to migrate pipelines to Github Actions. (#684)
- Loading branch information
Showing
4 changed files
with
181 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: OpenCue Packaging Pipeline | ||
|
||
# Trigger this pipeline on new commits to master. | ||
on: | ||
push: | ||
branches: [ master ] | ||
|
||
jobs: | ||
# TODO(https://github.com/AcademySoftwareFoundation/OpenCue/issues/715) Add the other | ||
# packaging steps here. Things like building Docker images and extracting artifacts | ||
# will need to be generalized, but we need to test a few things in the master branch | ||
# first to make sure things are working as we expect. | ||
build_cuebot: | ||
name: Build Cuebot | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set build ID | ||
run: | | ||
ci/generate_version_number.sh > VERSION | ||
echo "::set-env name=BUILD_ID::$(cat ./VERSION)" | ||
- uses: docker/build-push-action@v1 | ||
name: Build Docker image | ||
with: | ||
username: ${{ secrets.DOCKER_USER }} | ||
password: ${{ secrets.DOCKER_PASS }} | ||
dockerfile: cuebot/Dockerfile | ||
repository: opencuebuild/cuebot | ||
tags: ${{ env.BUILD_ID }} | ||
- name: Extract Artifacts | ||
run: | | ||
set -e | ||
image_name="opencuebuild/cuebot:${BUILD_ID}" | ||
container_id=$(docker create ${image_name}) | ||
artifacts="/opt/opencue/cuebot-${BUILD_ID}-all.jar /opt/opencue/opencue-cuebot-${BUILD_ID}-1.noarch.rpm" | ||
mkdir -p "${GITHUB_WORKSPACE}/artifacts/" | ||
for artifact in $artifacts; do | ||
docker cp ${container_id}:${artifact} "${GITHUB_WORKSPACE}/artifacts/" | ||
done | ||
docker rm $container_id | ||
- uses: actions/upload-artifact@v2 | ||
name: Upload JAR | ||
with: | ||
name: cuebot-jar | ||
path: ${{ github.workspace }}/artifacts/cuebot-*.jar | ||
- uses: actions/upload-artifact@v2 | ||
name: Upload RPM | ||
with: | ||
name: cuebot-rpm | ||
path: ${{ github.workspace }}/artifacts/opencue-cuebot-*.rpm | ||
# TODO(https://github.com/AcademySoftwareFoundation/OpenCue/issues/715) Remove this step | ||
# in the next PR. This info will help us track this pipeline's artifacts as we attempt | ||
# to download them later, in the release pipeline. Once we know how the artifact tagging | ||
# works in the master branch it won't be needed anymore. | ||
- name: Print environment information | ||
run: | | ||
set -e | ||
echo "This SHA: ${{ github.sha }}" | ||
echo "This workflow run: ${{ github.run_id }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: OpenCue Release Pipeline | ||
|
||
# Trigger this pipeline when a commit is tagged with a version number, e.g. "v0.4.32". | ||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
|
||
jobs: | ||
# TODO(https://github.com/AcademySoftwareFoundation/OpenCue/issues/715) Add another job to | ||
# release the Docker images. | ||
create_release: | ||
name: Create Release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Fetch artifacts | ||
env: | ||
PACKAGING_WORKFLOW_ID: 1539149 | ||
# Fetching artifacts from another pipeline, or even a different run of the same pipeline, | ||
# is currently not well-supported in Github Actions. We must use the Github REST API to | ||
# search for the correct workflow by commit SHA, then we can attempt to download the | ||
# artifacts from that workflow run. | ||
run: | | ||
set -e | ||
echo "SHA: ${{ github.sha }}" | ||
run_id=$(curl -s https://api.github.com/repos/${{ github.repository }}/actions/runs \ | ||
| jq ".workflow_runs[] | select(.head_sha == \"${{ github.sha }}\" and .workflow_id==${{ PACKAGING_WORKFLOW_ID }}).id") | ||
echo "Packaging pipeline run ID: ${run_id}" | ||
artifact_ids=$(curl -s https://api.github.com/repos/${{ github.repository }}/actions/runs/${run_id}/artifacts \ | ||
| jq '.artifacts[].id') | ||
echo "Artifact IDs: ${artifact_ids}" | ||
for artifact_id in ${artifact_ids}; do | ||
api_path="repos/${{ github.repository }}/actions/artifacts/${artifact_id}/zip" | ||
echo "Fetching artifact ${artifact_id} at https://api.github.com/${api_path}" | ||
curl -L -O "https://${{ secrets.GITHUB_TOKEN }}@api.github.com/${api_path}" | ||
done | ||
- name: Generate release notes | ||
id: release_notes | ||
run: | | ||
last_tagged_version=$(git describe --tags $(git rev-list --tags --max-count=1)) | ||
commits_since_last_release=$(git log --pretty="* %H %s" ${last_tagged_version}..HEAD) | ||
echo "::set-output name=commits::${commits_since_last_release}" | ||
- name: Create release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: Release ${{ github.ref }} | ||
body: | | ||
To learn how to install and configure OpenCue, see our | ||
[Getting Started guide](https://www.opencue.io/docs/getting-started/). | ||
## Changes: | ||
${{ steps.release_notes.outputs.commits }} | ||
draft: true | ||
prerelease: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: OpenCue Testing Pipeline | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
test_python_2019: | ||
name: Run Python Unit Tests (CY2019) | ||
runs-on: ubuntu-latest | ||
container: aswf/ci-opencue:2019 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Run Python Tests | ||
run: ci/run_python_tests.sh | ||
|
||
test_cuebot_2019: | ||
name: Build Cuebot and Run Unit Tests (CY2019) | ||
runs-on: ubuntu-latest | ||
container: | ||
image: aswf/ci-opencue:2019 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Build with Gradle | ||
run: | | ||
chown -R aswfuser:aswfgroup . | ||
su -c "cd cuebot && ./gradlew build --stacktrace --info" aswfuser | ||
test_python_2020: | ||
name: Run Python Unit Tests (CY2020) | ||
runs-on: ubuntu-latest | ||
container: aswf/ci-opencue:2020 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Run Python Tests | ||
run: ci/run_python_tests.sh | ||
|
||
test_cuebot_2020: | ||
name: Build Cuebot and Run Unit Tests (CY2020) | ||
runs-on: ubuntu-latest | ||
container: | ||
image: aswf/ci-opencue:2020 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Build with Gradle | ||
run: | | ||
chown -R aswfuser:aswfgroup . | ||
su -c "cd cuebot && ./gradlew build --stacktrace --info" aswfuser | ||
test_sphinx: | ||
name: Test Documentation Build | ||
runs-on: ubuntu-latest | ||
container: | ||
image: aswf/ci-opencue:2020 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Run Sphinx build | ||
run: ci/build_sphinx_docs.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters