Skip to content
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): update actions and javascript dependencies #47

Merged
merged 3 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/check-dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
steps:
- name: Checkout
id: checkout
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683

- name: Setup Node.js
id: setup-node
Expand Down Expand Up @@ -62,7 +62,7 @@ jobs:
- if: ${{ failure() && steps.diff.outcome == 'failure' }}
name: Upload Artifact
id: upload
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882
with:
name: dist
path: dist/
7 changes: 5 additions & 2 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ jobs:
steps:
- name: Checkout
id: checkout
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
fetch-depth: 0

- name: Setup Node.js
id: setup-node
Expand All @@ -34,12 +36,13 @@ jobs:

- name: Lint Codebase
id: super-linter
uses: super-linter/super-linter/slim@v5
uses: super-linter/super-linter/slim@e1cb86b6e8d119f789513668b4b30bf17fe1efe4
env:
DEFAULT_BRANCH: main
FILTER_REGEX_EXCLUDE: dist/**/*
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
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
2 changes: 1 addition & 1 deletion .github/workflows/test_javascript.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
steps:
- name: Checkout
id: checkout
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683

- name: Setup Node.js
id: setup-node
Expand Down
23 changes: 13 additions & 10 deletions .github/workflows/test_spawn_terminate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ 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 }}
runner-hyperstack: ${{ steps.gen-output.outputs.runner_hyperstack }}
steps:
- name: Checkout
id: checkout
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683

- name: Test start instance
id: test-start
Expand All @@ -45,32 +45,35 @@ 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
id: checkout
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683

- name: Test stop instance
id: test-stop
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
12 changes: 6 additions & 6 deletions .github/workflows/test_start_stop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ 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
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683

- name: Test start instance
id: test-start
Expand All @@ -43,20 +43,20 @@ 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
id: checkout
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683

- name: Test stop instance
id: test-stop
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
Loading