forked from hoverkraft-tech/compose-action
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: migrate to node20 and typescritp
Signed-off-by: Emilien Escalle <[email protected]>
- Loading branch information
Showing
2,101 changed files
with
82,512 additions
and
440,028 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 |
---|---|---|
@@ -1,22 +1,41 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the | ||
// README at: https://github.com/devcontainers/templates/tree/main/src/javascript-node | ||
{ | ||
"name": "Node.js", | ||
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile | ||
"image": "mcr.microsoft.com/devcontainers/javascript-node:1-16-buster", | ||
|
||
// Features to add to the dev container. More info: https://containers.dev/features. | ||
// "features": {}, | ||
|
||
// Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
// "forwardPorts": [], | ||
|
||
// Use 'postCreateCommand' to run commands after the container is created. | ||
// "postCreateCommand": "yarn install", | ||
|
||
// Configure tool-specific properties. | ||
// "customizations": {}, | ||
|
||
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. | ||
"remoteUser": "root" | ||
"name": "GitHub Actions (TypeScript)", | ||
"image": "mcr.microsoft.com/devcontainers/typescript-node:20", | ||
"postCreateCommand": "npm install", | ||
"customizations": { | ||
"codespaces": { | ||
"openFiles": ["README.md"] | ||
}, | ||
"vscode": { | ||
"extensions": [ | ||
"bierner.markdown-preview-github-styles", | ||
"davidanson.vscode-markdownlint", | ||
"dbaeumer.vscode-eslint", | ||
"esbenp.prettier-vscode", | ||
"github.copilot", | ||
"github.copilot-chat", | ||
"github.vscode-github-actions", | ||
"github.vscode-pull-request-github", | ||
"me-dutour-mathieu.vscode-github-actions", | ||
"redhat.vscode-yaml", | ||
"rvest.vs-code-prettier-eslint", | ||
"yzhang.markdown-all-in-one" | ||
], | ||
"settings": { | ||
"editor.defaultFormatter": "esbenp.prettier-vscode", | ||
"editor.tabSize": 2, | ||
"editor.formatOnSave": true, | ||
"markdown.extension.list.indentationSize": "adaptive", | ||
"markdown.extension.italic.indicator": "_", | ||
"markdown.extension.orderedList.marker": "one" | ||
} | ||
} | ||
}, | ||
"remoteEnv": { | ||
"GITHUB_TOKEN": "${localEnv:GITHUB_TOKEN}" | ||
}, | ||
"features": { | ||
"ghcr.io/devcontainers/features/github-cli:1": {}, | ||
"ghcr.io/devcontainers-contrib/features/prettier: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,3 @@ | ||
* text=auto eol=lf | ||
|
||
dist/** -diff linguist-generated=true |
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
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
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
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 |
---|---|---|
|
@@ -6,7 +6,7 @@ steps: | |
- uses: actions/checkout@v4 | ||
- uses: hoverkraft-tech/[email protected] | ||
with: | ||
compose-file: "./docker/docker-compose.yml" | ||
compose-file: './docker/docker-compose.yml' | ||
env: | ||
CUSTOM_VARIABLE: "test" | ||
CUSTOM_VARIABLE: '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 |
---|---|---|
|
@@ -9,7 +9,7 @@ steps: | |
- uses: actions/checkout@v3 | ||
- uses: hoverkraft-tech/[email protected] | ||
with: | ||
compose-file: "./docker/docker-compose.yml" | ||
compose-file: './docker/docker-compose.yml' | ||
services: | | ||
helloworld2 | ||
helloworld3 | ||
|
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 |
---|---|---|
@@ -1,4 +1,7 @@ | ||
<!-- markdownlint-disable-next-line first-line-heading --> | ||
### Example using `up-flags` | ||
|
||
Specify flags to pass to the `docker-compose up`. Default is none. Can be used to pass the `--build` flag, for example, if you want persistent volumes to be deleted as well during cleanup. A full list of flags can be found in the [docker-compose up documentation](https://docs.docker.com/compose/reference/up/). | ||
Specify flags to pass to the `docker-compose up`. Default is none. Can be used | ||
to pass the `--build` flag, for example, if you want persistent volumes to be | ||
deleted as well during cleanup. A full list of flags can be found in the | ||
[docker-compose up documentation](https://docs.docker.com/compose/reference/up/). |
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 |
---|---|---|
@@ -1,4 +1,8 @@ | ||
<!-- markdownlint-disable-next-line first-line-heading --> | ||
### Example using `down-flags` | ||
|
||
Specify flags to pass to the `docker-compose down` command during cleanup. Default is none. Can be used to pass the `--volumes` flag, for example, if you want persistent volumes to be deleted as well during cleanup. A full list of flags can be found in the [docker-compose down documentation](https://docs.docker.com/compose/reference/down/). | ||
Specify flags to pass to the `docker-compose down` command during cleanup. | ||
Default is none. Can be used to pass the `--volumes` flag, for example, if you | ||
want persistent volumes to be deleted as well during cleanup. A full list of | ||
flags can be found in the | ||
[docker-compose down documentation](https://docs.docker.com/compose/reference/down/). |
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 |
---|---|---|
@@ -1,15 +1,17 @@ | ||
<!-- markdownlint-disable-next-line first-line-heading --> | ||
### Example using `compose-flags` | ||
|
||
Specify flags to pass to the `docker-compose` command. Default is none. A full list of flags can be found in the [docker-compose documentation](https://docs.docker.com/compose/reference/#command-options-overview-and-help). | ||
Specify flags to pass to the `docker-compose` command. Default is none. A full | ||
list of flags can be found in the | ||
[docker-compose documentation](https://docs.docker.com/compose/reference/#command-options-overview-and-help). | ||
|
||
```yaml | ||
steps: | ||
# need checkout before using compose-action | ||
- uses: actions/checkout@v3 | ||
- uses: hoverkraft-tech/[email protected] | ||
with: | ||
compose-file: "./docker/docker-compose.yml" | ||
compose-file: './docker/docker-compose.yml' | ||
services: | | ||
helloworld2 | ||
helloworld3 | ||
|
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,103 @@ | ||
name: Internal - Tests for action | ||
|
||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
test-action-with-services: | ||
runs-on: ubuntu-latest | ||
name: Test with services | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: hoverkraft-tech/ci-github-nodejs/actions/[email protected] | ||
|
||
- name: Act | ||
uses: ./ | ||
with: | ||
compose-file: "./docker/docker-compose.yml" | ||
services: | | ||
helloworld2 | ||
helloworld3 | ||
- name: "Assert: only expected services are running" | ||
run: | | ||
docker-compose -f ./docker/docker-compose.yml ps | ||
docker-compose -f ./docker/docker-compose.yml ps | grep docker-helloworld2-1 | ||
docker-compose -f ./docker/docker-compose.yml ps | grep docker-helloworld3-1 | ||
docker-compose -f ./docker/docker-compose.yml ps | (grep docker-helloworld-1 && echo "Unexpected service helloworld is running" && exit 1) || true | ||
test-action-with-down-flags: | ||
runs-on: ubuntu-latest | ||
name: Test compose action | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: hoverkraft-tech/ci-github-nodejs/actions/[email protected] | ||
|
||
- name: Act | ||
uses: ./ | ||
with: | ||
compose-file: "./docker/docker-compose.yml" | ||
down-flags: "--volumes" | ||
|
||
test-action-with-compose-flags: | ||
runs-on: ubuntu-latest | ||
name: Test with compose flags | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: hoverkraft-tech/ci-github-nodejs/actions/[email protected] | ||
|
||
- name: Act | ||
uses: ./ | ||
with: | ||
compose-file: "./docker/docker-compose.yml" | ||
compose-flags: "--profile profile-1" | ||
down-flags: "--volumes" | ||
|
||
- name: "Assert: profile is used" | ||
run: | | ||
docker-compose -f ./docker/docker-compose.yml -p profile-1 ps || (echo "Profile not used" && exit 1) | ||
test-action-with-env: | ||
runs-on: ubuntu-latest | ||
name: Test with env | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: hoverkraft-tech/ci-github-nodejs/actions/[email protected] | ||
|
||
- name: Act | ||
uses: ./ | ||
with: | ||
compose-file: "./docker/docker-compose-with-env.yml" | ||
env: | ||
IMAGE_NAME: hello-world | ||
|
||
- name: "Assert: env is used" | ||
run: | | ||
docker-compose -f ./docker/docker-compose-with-env.yml ps | ||
docker-compose -f ./docker/docker-compose-with-env.yml ps | grep docker-helloworld-1 | ||
test-action-with-multiple-compose-files: | ||
runs-on: ubuntu-latest | ||
name: Test with multiple compose files | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: hoverkraft-tech/ci-github-nodejs/actions/[email protected] | ||
|
||
- name: Act | ||
uses: ./ | ||
with: | ||
compose-file: | | ||
./docker/docker-compose.yml | ||
./docker/docker-compose.ci.yml | ||
services: | | ||
helloworld2 | ||
helloworld4 | ||
- name: "Assert: only expected services are running" | ||
run: | | ||
docker-compose -f ./docker/docker-compose.yml -f ./docker/docker-compose.ci.yml ps | ||
docker-compose -f ./docker/docker-compose.yml -f ./docker/docker-compose.ci.yml ps | grep docker-helloworld2-1 | ||
docker-compose -f ./docker/docker-compose.yml -f ./docker/docker-compose.ci.yml ps | grep docker-helloworld4-1 | ||
docker-compose -f ./docker/docker-compose.yml -f ./docker/docker-compose.ci.yml ps | (grep docker-helloworld-1 && echo "Unexpected service is running" && exit 1) || true | ||
docker-compose -f ./docker/docker-compose.yml -f ./docker/docker-compose.ci.yml ps | (grep docker-helloworld3-1 && echo "Unexpected service is running" && exit 1) || true |
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,36 @@ | ||
name: Internal - Checks for dist | ||
|
||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
check-dist: | ||
name: Check dist | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: hoverkraft-tech/ci-github-nodejs/actions/[email protected] | ||
|
||
- name: Build dist/ Directory | ||
id: package | ||
run: npm run package | ||
|
||
# This will fail the workflow if the PR wasn't created by Dependabot. | ||
- name: Compare Directories | ||
id: diff | ||
run: | | ||
if [ "$(git diff --ignore-space-at-eol --text dist/ | wc -l)" -gt "0" ]; then | ||
echo "Detected uncommitted changes after package. See status below:" | ||
git diff --ignore-space-at-eol --text dist/ | ||
exit 1 | ||
fi | ||
# If `dist/` was different than expected, and this was not a Dependabot | ||
# PR, upload the expected version as a workflow artifact. | ||
- if: ${{ failure() && steps.diff.outcome == 'failure' }} | ||
name: Upload Artifact | ||
id: upload | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: dist | ||
path: dist/ |
Oops, something went wrong.