-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(ci): test start-stop aws instance #41
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,19 @@ | ||
# This simple workflow is used to test if a runner is registered on GitHub platform. | ||
name: Test registered runner | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
runner-name: | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
test-runner: | ||
name: Test Runner | ||
runs-on: ${{ inputs.runner-name }} | ||
timeout-minutes: 5 # Job should be picked very quickly | ||
steps: | ||
- name: Runner registered | ||
run: | | ||
echo "Runner name: $ {{ inputs.runner-name }}" | ||
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,37 @@ | ||
# This simple workflow is used to test if a runner is removed from GitHub platform. | ||
name: Test registered runner | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
runner-name: | ||
required: true | ||
type: string | ||
must-exist: | ||
type: boolean | ||
default: false | ||
secrets: | ||
READ_REPO_TOKEN: | ||
required: true | ||
|
||
jobs: | ||
test-removed-runner: | ||
name: Test Removed Runner | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: List runners | ||
run: | | ||
echo "RUNNERS_FOUND=$(gh api "repos/zama-ai/slab-github-runner/actions/runners" --jq '.runners[].name')" >> "${GITHUB_ENV}" | ||
env: | ||
GH_TOKEN: ${{ secrets.READ_REPO_TOKEN }} | ||
|
||
- name: Check runner removed | ||
if: inputs.must-exist == false | ||
run: | | ||
( echo "${{ env.RUNNERS_FOUND }}" | grep --line-regexp -q "${{ inputs.runner-name }}" ) && { exit 1; } || exit 0 | ||
|
||
- name: Check runner persists | ||
if: inputs.must-exist == true | ||
run: | | ||
( echo "${{ env.RUNNERS_FOUND }}" | grep --line-regexp -q "${{ inputs.runner-name }}" ) || exit 1 |
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,44 @@ | ||
name: Test Javascript | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
test-javascript: | ||
name: JavaScript Tests | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
id: checkout | ||
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 | ||
|
||
- name: Setup Node.js | ||
id: setup-node | ||
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af | ||
with: | ||
node-version-file: .node-version | ||
cache: npm | ||
|
||
- name: Install Dependencies | ||
id: npm-ci | ||
run: npm ci | ||
|
||
- name: Check Format | ||
id: npm-format-check | ||
run: npm run format:check | ||
|
||
- name: Lint | ||
id: npm-lint | ||
run: npm run lint | ||
|
||
- name: Test | ||
id: npm-ci-test | ||
run: npm run ci-test |
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,83 @@ | ||
# Test action to spawn/terminate backend instance | ||
name: Test Spawn-Terminate | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
action-start: | ||
name: GitHub Actions Test (spawn) | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
provider: [ aws, hyperstack ] | ||
fail-fast: false | ||
outputs: | ||
runner-aws: ${{ steps.gen-output.outputs.runner_aws }} | ||
runner-hyperstack: ${{ steps.gen-output.outputs.runner_hyperstack }} | ||
steps: | ||
- name: Checkout | ||
id: checkout | ||
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 | ||
|
||
- name: Test start instance | ||
id: test-start | ||
uses: ./ | ||
with: | ||
mode: start | ||
github-token: ${{ secrets.SLAB_ACTION_TOKEN }} | ||
slab-url: ${{ secrets.SLAB_BASE_URL_PRE_PROD }} | ||
job-secret: ${{ secrets.JOB_SECRET }} | ||
backend: ${{ matrix.provider }} | ||
profile: ci-test | ||
|
||
- name: Generate output | ||
id: gen-output | ||
run: | | ||
echo "runner_${{ matrix.provider }}=${{ steps.test-start.outputs.label }}" >> "${GITHUB_OUTPUT}" | ||
|
||
test-runner-alive-aws: | ||
name: Test runner is alive (AWS) | ||
needs: [ action-start ] | ||
uses: ./.github/workflows/registered_runner.yml | ||
with: | ||
runner-name: ${{ needs.action-start.outputs.runner-aws }} | ||
|
||
test-runner-alive-hyperstack: | ||
name: Test runner is alive (Hyperstack) | ||
needs: [ action-start ] | ||
uses: ./.github/workflows/registered_runner.yml | ||
with: | ||
runner-name: ${{ needs.action-start.outputs.runner-hyperstack }} | ||
|
||
action-stop: | ||
name: GitHub Actions Test (terminate) | ||
runs-on: ubuntu-latest | ||
needs: [ action-start, test-runner-alive-aws, test-runner-alive-hyperstack ] | ||
if: ${{ always() && needs.action-start.result != 'skipped' }} | ||
strategy: | ||
matrix: | ||
runner: [ "${{ needs.action-start.outputs.runner-aws }}", | ||
"${{ needs.action-start.outputs.runner-hyperstack }}" ] | ||
fail-fast: false | ||
steps: | ||
- name: Checkout | ||
id: checkout | ||
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 | ||
|
||
- name: Test stop instance | ||
id: test-stop | ||
uses: ./ | ||
with: | ||
mode: stop | ||
github-token: ${{ secrets.SLAB_ACTION_TOKEN }} | ||
slab-url: ${{ secrets.SLAB_BASE_URL_PRE_PROD }} | ||
job-secret: ${{ secrets.JOB_SECRET }} | ||
label: ${{ matrix.runner }} |
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,79 @@ | ||
# Test action to start/stop already provisioned backend instance. | ||
name: Test Start-Stop | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
test-runner-exist: | ||
name: Test runner is registered | ||
uses: ./.github/workflows/removed_runner.yml | ||
with: | ||
runner-name: ci-persistent-runner | ||
must-exist: true | ||
secrets: | ||
READ_REPO_TOKEN: ${{ secrets.SLAB_ACTION_TOKEN }} | ||
|
||
action-start: | ||
name: GitHub Actions Test (start) | ||
runs-on: ubuntu-latest | ||
needs: [ test-runner-exist ] | ||
steps: | ||
- name: Checkout | ||
id: checkout | ||
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 | ||
|
||
- name: Test start instance | ||
id: test-start | ||
uses: ./ | ||
with: | ||
mode: start | ||
github-token: ${{ secrets.SLAB_ACTION_TOKEN }} | ||
slab-url: ${{ secrets.SLAB_BASE_URL_PRE_PROD }} | ||
job-secret: ${{ secrets.JOB_SECRET }} | ||
backend: aws | ||
profile: ci-test-start-stop | ||
|
||
test-runner-alive: | ||
name: Test runner is alive | ||
needs: [ action-start ] | ||
uses: ./.github/workflows/registered_runner.yml | ||
with: | ||
runner-name: ci-persistent-runner | ||
|
||
action-stop: | ||
name: GitHub Actions Test (stop) | ||
runs-on: ubuntu-latest | ||
needs: [ action-start, test-runner-alive ] | ||
if: ${{ always() && needs.action-start.result != 'skipped' }} | ||
steps: | ||
- name: Checkout | ||
id: checkout | ||
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 | ||
|
||
- name: Test stop instance | ||
id: test-stop | ||
uses: ./ | ||
with: | ||
mode: stop | ||
github-token: ${{ secrets.SLAB_ACTION_TOKEN }} | ||
slab-url: ${{ secrets.SLAB_BASE_URL_PRE_PROD }} | ||
job-secret: ${{ secrets.JOB_SECRET }} | ||
label: ci-persistent-runner | ||
|
||
test-runner-persist: | ||
name: Test runner is still registered | ||
needs: [ action-stop ] | ||
uses: ./.github/workflows/removed_runner.yml | ||
with: | ||
runner-name: ci-persistent-runner | ||
must-exist: true | ||
secrets: | ||
READ_REPO_TOKEN: ${{ secrets.SLAB_ACTION_TOKEN }} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this does not echo the runner name as $ is not next to {{ you have
$ {{
vs${{