Skip to content

Commit

Permalink
chore(ci): format codebase using prettier and standardjs
Browse files Browse the repository at this point in the history
  • Loading branch information
soonum committed Dec 12, 2024
1 parent f1bfb59 commit 9154d0a
Show file tree
Hide file tree
Showing 12 changed files with 124 additions and 116 deletions.
1 change: 1 addition & 0 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,5 @@ jobs:
JAVASCRIPT_DEFAULT_STYLE: prettier
VALIDATE_ALL_CODEBASE: true
VALIDATE_JSCPD: false
VALIDATE_JAVASCRIPT_STANDARD: false
VALIDATE_MARKDOWN: false
5 changes: 4 additions & 1 deletion .github/workflows/registered_runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ on:
required: true
type: string

permissions:
contents: read

jobs:
test-runner:
name: Test Runner
runs-on: ${{ inputs.runner-name }}
timeout-minutes: 5 # Job should be picked very quickly
timeout-minutes: 5 # Job should be picked very quickly
steps:
- name: Runner registered
run: |
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/removed_runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ on:
READ_REPO_TOKEN:
required: true

permissions:
contents: read

jobs:
test-removed-runner:
name: Test Removed Runner
Expand Down
19 changes: 11 additions & 8 deletions .github/workflows/test_spawn_terminate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
provider: [ aws, hyperstack ]
provider: [aws, hyperstack]
fail-fast: false
outputs:
runner-aws: ${{ steps.gen-output.outputs.runner_aws }}
Expand Down Expand Up @@ -45,27 +45,30 @@ jobs:
test-runner-alive-aws:
name: Test runner is alive (AWS)
needs: [ action-start ]
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 ]
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 ]
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 }}" ]
runner:
[
'${{ needs.action-start.outputs.runner-aws }}',
'${{ needs.action-start.outputs.runner-hyperstack }}'
]
fail-fast: false
steps:
- name: Checkout
Expand All @@ -84,7 +87,7 @@ jobs:

test-runner-removed-aws:
name: Test runner is removed (AWS)
needs: [ action-start, action-stop ]
needs: [action-start, action-stop]
uses: ./.github/workflows/removed_runner.yml
with:
runner-name: ${{ needs.action-start.outputs.runner-aws }}
Expand All @@ -94,7 +97,7 @@ jobs:

test-runner-removed-hyperstack:
name: Test runner is removed (Hyperstack)
needs: [ action-start, action-stop ]
needs: [action-start, action-stop]
uses: ./.github/workflows/removed_runner.yml
with:
runner-name: ${{ needs.action-start.outputs.runner-hyperstack }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/test_start_stop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
action-start:
name: GitHub Actions Test (start)
runs-on: ubuntu-latest
needs: [ test-runner-exist ]
needs: [test-runner-exist]
steps:
- name: Checkout
id: checkout
Expand All @@ -43,15 +43,15 @@ jobs:

test-runner-alive:
name: Test runner is alive
needs: [ action-start ]
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 ]
needs: [action-start, test-runner-alive]
if: ${{ always() && needs.action-start.result != 'skipped' }}
steps:
- name: Checkout
Expand All @@ -70,7 +70,7 @@ jobs:

test-runner-persist:
name: Test runner is still registered
needs: [ action-stop ]
needs: [action-stop]
uses: ./.github/workflows/removed_runner.yml
with:
runner-name: ci-persistent-runner
Expand Down
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# On-demand self-hosted runner for GitHub Actions

Start your EC2 [self-hosted runner](https://docs.github.com/en/free-pro-team@latest/actions/hosting-your-own-runners)
right before you need it.
Run the job on it. Finally, stop it when you finish.
Start your EC2
[self-hosted runner](https://docs.github.com/en/free-pro-team@latest/actions/hosting-your-own-runners)
right before you need it. Run the job on it. Finally, stop it when you finish.
And all this automatically as a part of your GitHub Actions workflow.

It relies on Slab CI bot to do all the heavy-lifting.
Expand All @@ -22,7 +22,7 @@ See [below](#example) the YAML code of the depicted workflow.
### Inputs

| Name | Required | Description |
|----------------|-----------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| -------------- | --------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `mode` | Always required. | Specify here which mode you want to use: `start` to start a new runner, `stop` to stop the previously created runner. |
| `github-token` | Always required. | GitHub Personal Access Token with the `repo` scope assigned. |
| `slab-url` | Always required. | URL to Slab CI server. |
Expand All @@ -33,13 +33,14 @@ See [below](#example) the YAML code of the depicted workflow.

### Outputs

| Name | Description |
|---------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `label` | Name of the unique label assigned to the runner. The label is used in two cases: to use as the input of `runs-on` property for the following jobs and to remove the runner from GitHub when it is not needed anymore. |
| Name | Description |
| ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `label` | Name of the unique label assigned to the runner. The label is used in two cases: to use as the input of `runs-on` property for the following jobs and to remove the runner from GitHub when it is not needed anymore. |

### Examples

Here's an example workflow. It uses a backend profile declared in `ci/slab.toml` within the calling repository
Here's an example workflow. It uses a backend profile declared in `ci/slab.toml`
within the calling repository

```yml
name: do-the-job
Expand All @@ -62,7 +63,7 @@ jobs:
profile: cpu-test

do-the-job:
# ... #
# ... #

stop-runner:
name: Stop self-hosted EC2 runner
Expand Down
23 changes: 12 additions & 11 deletions action.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
name: On-demand self-hosted runner for GitHub Actions
description: GitHub Action for automatic AWS EC2 instance provisioning as a GitHub Actions self-hosted runner.
description:
GitHub Action for automatic AWS EC2 instance provisioning as a GitHub Actions
self-hosted runner.
author: zama-ai
branding:
icon: 'box'
Expand All @@ -25,27 +27,26 @@ inputs:
required: true
backend:
description: >-
Backend provider name to look for in slab.toml file in repository that uses the action.
This input is required if you use the 'start' mode.
Backend provider name to look for in slab.toml file in repository that
uses the action. This input is required if you use the 'start' mode.
required: false
profile:
description: >-
Profile to use as described slab.toml file in repository that uses the action.
This input is required if you use the 'start' mode.
Profile to use as described slab.toml file in repository that uses the
action. This input is required if you use the 'start' mode.
required: false
label:
description: >-
Name of the unique label assigned to the runner.
The label is used to remove the runner from GitHub when the runner is not needed anymore.
This input is required if you use the 'stop' mode.
Name of the unique label assigned to the runner. The label is used to
remove the runner from GitHub when the runner is not needed anymore. This
input is required if you use the 'stop' mode.
required: false

outputs:
label:
description: >-
Name of the unique label assigned to the runner.
The label is used in two cases:
- to use as the input of 'runs-on' property for the following jobs;
Name of the unique label assigned to the runner. The label is used in two
cases: - to use as the input of 'runs-on' property for the following jobs;
- to remove the runner from GitHub when it is not needed anymore.
runs:
using: node20
Expand Down
Loading

0 comments on commit 9154d0a

Please sign in to comment.