Skip to content

Commit

Permalink
Migrate CI to Github Large Runner (#309)
Browse files Browse the repository at this point in the history
* attempt to migrate back to gha from aws

* remove dep on start-runner

* use explicit cxx-commons version

* fix url

* update CI
  • Loading branch information
Ninja3047 authored Oct 24, 2022
1 parent fdfe905 commit 59b4751
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 211 deletions.
59 changes: 1 addition & 58 deletions .github/workflows/anghabench-after-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,39 +8,6 @@ on:
types: [completed]

jobs:
start-runner:
if: github.event.workflow_run.conclusion == 'success'
name: Start self-hosted EC2 runner
runs-on: ubuntu-latest
strategy:
matrix:
ec2:
- { ami: ami-0610b26d76319237e, instance-type: m6i.8xlarge}
outputs:
label: ${{ steps.start-ec2-runner.outputs.label }}
ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }}
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Start EC2 runner
id: start-ec2-runner
uses: machulav/ec2-github-runner@v2
with:
mode: start
github-token: ${{ secrets.ACCESS_TOKEN }}
ec2-image-id: ${{ matrix.ec2.ami }}
ec2-instance-type: ${{ matrix.ec2.instance-type }}
subnet-id: subnet-0deb935f0bbfe1a5d
security-group-id: sg-0f6a02eb80fafb982
aws-resource-tags: > # optional, requires additional permissions
[
{"Key": "Name", "Value": "ec2-github-runner"},
{"Key": "GitHubRepository", "Value": "${{ github.repository }}"}
]
do-the-job:
strategy:
fail-fast: false
Expand All @@ -49,8 +16,7 @@ jobs:
run_size: [ '1k' ]

name: Run AnghaBench CI (AMD64)
needs: start-runner # required to start the main job when the runner is ready
runs-on: ${{ needs.start-runner.outputs.label }} # run the job on the newly created runner
runs-on: gha-ubuntu-32
steps:
- uses: actions/checkout@v2
with:
Expand Down Expand Up @@ -173,26 +139,3 @@ jobs:
AWS_ACCESS_KEY_ID: ${{ secrets.DO_SPACES_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.DO_SPACES_SECRET }}
SLACK_HOOK: ${{ secrets.SLACK_HOOK }}

stop-runner:
name: Stop self-hosted EC2 runner
needs:
- start-runner # required to get output from the start-runner job
- do-the-job # required to wait when the main job is done
runs-on: ubuntu-latest
if: ${{ always() }} # required to stop the runner even if the error happened in the previous jobs
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Stop EC2 runner
uses: machulav/ec2-github-runner@v2
with:
mode: stop
github-token: ${{ secrets.ACCESS_TOKEN }}
label: ${{ needs.start-runner.outputs.label }}
ec2-instance-id: ${{ needs.start-runner.outputs.ec2-instance-id }}

59 changes: 1 addition & 58 deletions .github/workflows/anghabench-cron-jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,6 @@ on:
- cron: "0 3 * * *"

jobs:
start-runner:
if: github.event.workflow_run.conclusion == 'success'
name: Start self-hosted EC2 runner
runs-on: ubuntu-latest
strategy:
matrix:
ec2:
- { ami: ami-0610b26d76319237e, instance-type: m6i.8xlarge}
outputs:
label: ${{ steps.start-ec2-runner.outputs.label }}
ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }}
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Start EC2 runner
id: start-ec2-runner
uses: machulav/ec2-github-runner@v2
with:
mode: start
github-token: ${{ secrets.ACCESS_TOKEN }}
ec2-image-id: ${{ matrix.ec2.ami }}
ec2-instance-type: ${{ matrix.ec2.instance-type }}
subnet-id: subnet-0deb935f0bbfe1a5d
security-group-id: sg-0f6a02eb80fafb982
aws-resource-tags: > # optional, requires additional permissions
[
{"Key": "Name", "Value": "ec2-github-runner"},
{"Key": "GitHubRepository", "Value": "${{ github.repository }}"}
]
do-the-job:
strategy:
fail-fast: false
Expand All @@ -47,8 +14,7 @@ jobs:
run_size: [ '1k' ]

name: Run AnghaBench CI (AMD64)
needs: start-runner # required to start the main job when the runner is ready
runs-on: ${{ needs.start-runner.outputs.label }} # run the job on the newly created runner
runs-on: gha-ubuntu-32
steps:
- uses: actions/checkout@v2
with:
Expand Down Expand Up @@ -171,26 +137,3 @@ jobs:
AWS_ACCESS_KEY_ID: ${{ secrets.DO_SPACES_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.DO_SPACES_SECRET }}
SLACK_HOOK: ${{ secrets.SLACK_HOOK }}

stop-runner:
name: Stop self-hosted EC2 runner
needs:
- start-runner # required to get output from the start-runner job
- do-the-job # required to wait when the main job is done
runs-on: ubuntu-latest
if: ${{ always() }} # required to stop the runner even if the error happened in the previous jobs
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Stop EC2 runner
uses: machulav/ec2-github-runner@v2
with:
mode: stop
github-token: ${{ secrets.ACCESS_TOKEN }}
label: ${{ needs.start-runner.outputs.label }}
ec2-instance-id: ${{ needs.start-runner.outputs.ec2-instance-id }}

65 changes: 5 additions & 60 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,38 +17,6 @@ on:
- '*'

jobs:
start-runner:
name: Start self-hosted EC2 runner (Linux)
runs-on: ubuntu-latest
strategy:
matrix:
ec2:
- { ami: ami-0610b26d76319237e, instance-type: m6i.8xlarge}
outputs:
label: ${{ steps.start-ec2-runner.outputs.label }}
ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }}
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Start EC2 runner
id: start-ec2-runner
uses: machulav/ec2-github-runner@v2
with:
mode: start
github-token: ${{ secrets.ACCESS_TOKEN }}
ec2-image-id: ${{ matrix.ec2.ami }}
ec2-instance-type: ${{ matrix.ec2.instance-type }}
subnet-id: subnet-0deb935f0bbfe1a5d
security-group-id: sg-0f6a02eb80fafb982
aws-resource-tags: > # optional, requires additional permissions
[
{"Key": "Name", "Value": "ec2-github-runner"},
{"Key": "GitHubRepository", "Value": "${{ github.repository }}"}
]
build_linux:
strategy:
fail-fast: false
Expand All @@ -60,8 +28,7 @@ jobs:
]

name: Rellic CI
needs: start-runner # required to start the main job when the runner is ready
runs-on: ${{ needs.start-runner.outputs.label }} # run the job on the newly created runner
runs-on: "gha-ubuntu-32"
container:
image: docker.pkg.github.com/lifting-bits/cxx-common/vcpkg-builder-${{ matrix.image.name }}:${{ matrix.image.tag }}
credentials:
Expand Down Expand Up @@ -115,9 +82,9 @@ jobs:
shell: bash
working-directory: rellic-build
run: |
echo ::set-output name=DEB_PACKAGE_PATH::rellic-build/$(ls *.deb)
echo ::set-output name=RPM_PACKAGE_PATH::rellic-build/$(ls *.rpm)
echo ::set-output name=TGZ_PACKAGE_PATH::rellic-build/$(ls *.tar.gz)
echo "DEB_PACKAGE_PATH=rellic-build/$(ls *.deb)" >> ${GITHUB_OUTPUT}
echo "RPM_PACKAGE_PATH=rellic-build/$(ls *.rpm)" >> ${GITHUB_OUTPUT}
echo "TGZ_PACKAGE_PATH=rellic-build/$(ls *.tar.gz)" >> ${GITHUB_OUTPUT}
- name: Install the DEB package
run: |
Expand Down Expand Up @@ -154,28 +121,6 @@ jobs:
name: ${{ matrix.image.name }}-${{ matrix.image.tag }}_llvm${{ matrix.llvm }}_tgz_package
path: ${{ steps.package_names.outputs.TGZ_PACKAGE_PATH }}

stop-runner:
name: Stop self-hosted EC2 runner (Linux)
needs:
- start-runner # required to get output from the start-runner job
- build_linux # required to wait when the main job is done
runs-on: ubuntu-latest
if: ${{ always() }} # required to stop the runner even if the error happened in the previous jobs
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Stop EC2 runner
uses: machulav/ec2-github-runner@v2
with:
mode: stop
github-token: ${{ secrets.ACCESS_TOKEN }}
label: ${{ needs.start-runner.outputs.label }}
ec2-instance-id: ${{ needs.start-runner.outputs.ec2-instance-id }}

build_mac:
strategy:
fail-fast: false
Expand Down Expand Up @@ -216,7 +161,7 @@ jobs:
shell: bash
working-directory: rellic-build
run: |
echo ::set-output name=TGZ_PACKAGE_PATH::rellic-build/$(ls *.tar.gz)
echo "TGZ_PACKAGE_PATH=rellic-build/$(ls *.tar.gz)" >> ${GITHUB_OUTPUT}
- name: Store the TGZ package
uses: actions/upload-artifact@v1
Expand Down
35 changes: 1 addition & 34 deletions .github/workflows/diff_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,6 @@ on:
- '*'

jobs:
start-runner:
name: Start self-hosted EC2 runner (Linux)
runs-on: ubuntu-latest
strategy:
matrix:
ec2:
- { ami: ami-0610b26d76319237e, instance-type: m6i.8xlarge}
outputs:
label: ${{ steps.start-ec2-runner.outputs.label }}
ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }}
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Start EC2 runner
id: start-ec2-runner
uses: machulav/ec2-github-runner@v2
with:
mode: start
github-token: ${{ secrets.ACCESS_TOKEN }}
ec2-image-id: ${{ matrix.ec2.ami }}
ec2-instance-type: ${{ matrix.ec2.instance-type }}
subnet-id: subnet-0deb935f0bbfe1a5d
security-group-id: sg-0f6a02eb80fafb982
aws-resource-tags: > # optional, requires additional permissions
[
{"Key": "Name", "Value": "ec2-github-runner"},
{"Key": "GitHubRepository", "Value": "${{ github.repository }}"}
]
do-the-job:
strategy:
fail-fast: false
Expand All @@ -52,8 +20,7 @@ jobs:
CXX: clang++-${{ matrix.llvm }}

name: Diff in ouput between old and new rellic
needs: start-runner # required to start the main job when the runner is ready
runs-on: ${{ needs.start-runner.outputs.label }} # run the job on the newly created runner
runs-on: gha-ubuntu-32
container:
image: docker.pkg.github.com/lifting-bits/cxx-common/vcpkg-builder-${{ matrix.image.name }}:${{ matrix.image.tag }}
credentials:
Expand Down
3 changes: 2 additions & 1 deletion scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ CURR_DIR=$( pwd )
BUILD_DIR="${CURR_DIR}/rellic-build"
INSTALL_DIR=/usr/local
LLVM_VERSION=llvm-14
CXX_COMMON_VERSION=v0.2.10
OS_VERSION=unknown
ARCH_VERSION=unknown
BUILD_FLAGS=
Expand Down Expand Up @@ -97,7 +98,7 @@ function GetArchVersion
function DownloadVcpkgLibraries
{
local GITHUB_LIBS="${LIBRARY_VERSION}.tar.xz"
local URL="https://github.com/lifting-bits/cxx-common/releases/latest/download/${GITHUB_LIBS}"
local URL="https://github.com/lifting-bits/cxx-common/releases/download/${CXX_COMMON_VERSION}/${GITHUB_LIBS}"

mkdir -p "${DOWNLOAD_DIR}"
pushd "${DOWNLOAD_DIR}" || return 1
Expand Down

0 comments on commit 59b4751

Please sign in to comment.