Skip to content

Commit

Permalink
chore(ci): test start-stop aws instance
Browse files Browse the repository at this point in the history
  • Loading branch information
soonum committed Nov 20, 2024
1 parent e9a29e9 commit 150d577
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
24 changes: 15 additions & 9 deletions .github/workflows/removed_runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,20 @@ jobs:
test-removed-runner:
name: Test Removed Runner
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ secrets.READ_REPO_TOKEN }}

steps:
- name: Check runner removal
- 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: |
RUNNERS_FOUND=$(gh api "repos/zama-ai/slab-github-runner/actions/runners" --jq '.runners[].name')
if [ ${{ inputs.must-exist }} == true ]; then
echo "$RUNNERS_FOUND" | grep -w "${{ inputs.runner-name }}" || exit 1
else
echo "$RUNNERS_FOUND" | grep -w "${{ inputs.runner-name }}" || exit 0
fi
( echo "${{ env.RUNNERS_FOUND }}" | grep --line-regexp -q "${{ inputs.runner-name }}" ) || exit 1
2 changes: 1 addition & 1 deletion .github/workflows/test_spawn_terminate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
- name: Generate output
id: gen-output
run: |
echo "runner_${{ matrix.provider }}=${{ steps.test-start.outputs.label }}" >> "$GITHUB_OUTPUT"
echo "runner_${{ matrix.provider }}=${{ steps.test-start.outputs.label }}" >> "${GITHUB_OUTPUT}"
test-runner-alive-aws:
name: Test runner is alive (AWS)
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/test_start_stop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,6 @@ jobs:
uses: ./.github/workflows/removed_runner.yml
with:
runner-name: ci-persistent-runner
must-exist: true
secrets:
READ_REPO_TOKEN: ${{ secrets.READ_REPO_TOKEN }}
READ_REPO_TOKEN: ${{ secrets.SLAB_ACTION_TOKEN }}

0 comments on commit 150d577

Please sign in to comment.