-
Notifications
You must be signed in to change notification settings - Fork 588
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement build-and-test Github Actions CI using AWS spot instances
- Loading branch information
1 parent
2ba5d7e
commit 51916cd
Showing
4 changed files
with
96 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,22 @@ | ||
name: Build And Test (x86-64) | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
generate-runner-id: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- id: generate | ||
name: Generate runner ID | ||
run: | | ||
RUNNER_ID=rr_runner_$(uuidgen|tr -d -) | ||
echo "RUNNER_ID=$RUNNER_ID" >> "$GITHUB_OUTPUT" | ||
outputs: | ||
RUNNER_ID: ${{ steps.generate.outputs.RUNNER_ID }} | ||
|
||
build-and-test-x86-64: | ||
uses: ./.github/workflows/build-and-test.yml | ||
needs: generate-runner-id | ||
with: | ||
architecture: x86_64 | ||
runner_id: ${{ needs.generate-runner-id.outputs.RUNNER_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,48 @@ | ||
name: Build And Test | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
architecture: | ||
required: true | ||
type: string | ||
runner_id: | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
start-runner: | ||
name: Start Runner | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: "Run :: Create and register AWS spot instance" | ||
run: |2- | ||
curl -s -X POST -H "Content-Type: application/json" --data "{\"operation\": \"create\", \"architecture\":\"${{ inputs.architecture }}\", \"label\": \"${{ inputs.runner_id }}\"}" https://gztdxwrnjh46z4ucjge5m4pxhu0vtfzs.lambda-url.us-east-2.on.aws | ||
build-and-test: | ||
name: Build And Test | ||
runs-on: | ||
- ${{ inputs.runner_id }} | ||
needs: | ||
- start-runner | ||
steps: | ||
- name: "Run :: Checkout repository" | ||
uses: actions/checkout@v2 | ||
|
||
- name: "Run :: Build" | ||
run: ./scripts/github-actions-build.sh | ||
|
||
- name: "Run :: Test" | ||
run: ./scripts/github-actions-test.sh | ||
|
||
stop-runner: | ||
name: Stop Runner | ||
runs-on: ubuntu-latest | ||
needs: | ||
- start-runner | ||
- build-and-test | ||
if: ${{ always() }} | ||
steps: | ||
- name: "Run :: Terminate and unregister AWS spot instance" | ||
run: |2- | ||
curl -s -X POST -H "Content-Type: application/json" --data "{\"operation\": \"destroy\", \"label\": \"${{ inputs.runner_id }}\"}" https://gztdxwrnjh46z4ucjge5m4pxhu0vtfzs.lambda-url.us-east-2.on.aws |
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,13 @@ | ||
#!/bin/bash | ||
|
||
set +x # echo commands | ||
set -e # default to exiting on error" | ||
|
||
uname -a | ||
|
||
sudo apt-get install -y rpm ccache cmake g++ pkg-config zlib1g-dev git python-dev-is-python3 libacl1-dev ninja-build manpages-dev capnproto libcapnp-dev gdb lldb python3-pexpect | ||
|
||
mkdir obj | ||
cd obj | ||
cmake -G Ninja -DCMAKE_BUILD_TYPE=DEBUG -Dstaticlibs=FALSE .. | ||
ninja |
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,13 @@ | ||
#!/bin/bash | ||
|
||
set +x # echo commands | ||
set -e # default to exiting on error" | ||
|
||
# Enable perf events for rr | ||
echo 0 | sudo tee /proc/sys/kernel/perf_event_paranoid | ||
# Enable ptrace-attach to any process. This lets us get more data when tests fail. | ||
echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope | ||
# Disable AppArmor restrictions on user namespaces, which our tests need to use | ||
(echo 0 | sudo tee /proc/sys/kernel/apparmor_restrict_unprivileged_userns) || true | ||
let halfproc=`nproc`/2 | ||
ctest -j$halfproc --verbose |