Skip to content

Commit

Permalink
CI workflow with Github Actions (#2192)
Browse files Browse the repository at this point in the history
## Summary
### Why
1. GIthub Actions workflow are native GH workflows 
2. Github Actions do not require additional non-github accounts unlike CircleCI
3. plenty of compute resources[^0] available for OSS projects
4. unlike CircleCI resource limits (don't have details)

[^0]:https://docs.github.com/en/actions/administering-github-actions/usage-limits-billing-and-administration#availability

### What
1. creates CI workflow `ci.yaml`
2. creates Artifactory workflow: `artifactory.yaml`

Workflow structure is documented in the spec[^1]

[^1]:https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions

## Expected Behavior
CI is expected to 
1. execute unit tests
1. execute integration tests
1. execute hw platform unit tests 
1. publish artifacts to the artifactory when a tag is published
1. provide ability to re-run tests on failures
1. report results to corresponding PR/branch 

which is to be used as quality gates for PR merging.

## Actual Behavior
1. current Circle CI integration provides [1] [2] [3] [4] from the expected behavior
4. but re-run-ing checks requires additional efforts like logging in into the Circle CI 
5. which slows PR feedback loop as users may not have CircleCI credentials and knowledge of the system

[1]:https://github.com/linkedin/cruise-control/blob/a298df86095532264f13ca7490cfabb8ff68839f/.circleci/config.yml#L51-L53
[2]:https://github.com/linkedin/cruise-control/blob/a298df86095532264f13ca7490cfabb8ff68839f/.circleci/config.yml#L51-L53
[3]:https://github.com/linkedin/cruise-control/blob/a298df86095532264f13ca7490cfabb8ff68839f/.circleci/config.yml#L5-L34
[4]:https://github.com/linkedin/cruise-control/blob/a298df86095532264f13ca7490cfabb8ff68839f/.circleci/config.yml#L94-L103

## Steps to reproduce
1. see failed PR checks, ie #2133

## Known Workarounds
1. asking PR authors to trigger build

## Migration Plan
1. add GH Actions integration along with CircleCI
2. confirm GH Actions provide equivalent or better functionality 
3. remove CircleCI integration
4. ensure publishing via GH actions works

## Categorization
- [x] refactor
  • Loading branch information
mhratson authored Sep 6, 2024
1 parent a298df8 commit 8e0b2a2
Show file tree
Hide file tree
Showing 2 changed files with 105 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/artifactory.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Artifactory

on:
workflow_dispatch: # manual trigger
#release:
# types: [published]

jobs:
publish:
# if: startsWith(github.event.ref, 'release/')
name: publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # so gradle doesn't fail traversing the history
- uses: actions/setup-java@v4
with:
java-version: 11
distribution: microsoft
cache: gradle
- uses: gradle/actions/setup-gradle@v4 # v4.0.0
- name: publish
run: |
./gradlew :artifactoryPublish :cruise-control:artifactoryPublish :cruise-control-core:artifactoryPublish :cruise-control-metrics-reporter:artifactoryPublish
80 changes: 80 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: CI

on:
push:
branches: ['main']
pull_request:
types: [ opened, synchronize, reopened ]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
test:
name: "test with JDK=${{matrix.java-dist}}:${{matrix.java-ver}}"
runs-on: [ubuntu-latest]
strategy:
fail-fast: false
matrix:
java-ver: [11]
java-dist: ['microsoft', 'temurin']
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # so gradle doesn't fail traversing the history
- uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java-ver }}
distribution: ${{ matrix.java-dist }}
cache: gradle
# see: https://github.com/gradle/actions/blob/main/setup-gradle/README.md
- uses: gradle/actions/setup-gradle@v4 # v4.0.0
- name: gradle build
run: ./gradlew --no-daemon -PmaxParallelForks=1 build

integration-test:
name: "integration-test with JDK=${{matrix.java-dist}}:${{matrix.java-ver}}"
runs-on: [ubuntu-latest]
strategy:
fail-fast: false
matrix:
java-ver: [11]
java-dist: ['microsoft', 'temurin']
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # so gradle doesn't fail traversing the history
- uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java-ver }}
distribution: ${{ matrix.java-dist }}
cache: gradle
# see: https://github.com/gradle/actions/blob/main/setup-gradle/README.md
- uses: gradle/actions/setup-gradle@v4 # v4.0.0
- name: gradle integration test
run: ./gradlew --no-daemon -PmaxParallelForks=1 clean integrationTest

build-platform:
name: platform build with JDK=${{matrix.java-dist}}:${{matrix.java-ver}} on ${{matrix.hw_platform}}
strategy:
fail-fast: false
matrix:
java-ver: [11]
java-dist: ['temurin']
hw_platform: ['s390x']
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # so gradle doesn't fail traversing the history
- run: |
# install required qemu libraries
docker run --rm --privileged tonistiigi/binfmt:latest --install all
# run docker container with qemu emulation
docker run --rm \
--platform ${{ matrix.hw_platform }} \
--name qemu-cross-${{ matrix.hw_platform }} \
--mount type=bind,source=${PWD},target=/workspace \
--workdir /workspace \
${{matrix.hw_platform}}/eclipse-temurin:11-jdk-focal uname -a; ./gradlew --no-daemon -PmaxParallelForks=1 build

0 comments on commit 8e0b2a2

Please sign in to comment.