Skip to content

Commit 91b0a25

Browse files
authored
Merge pull request #83 from boesing/refactor/typescript
Refactoring: typescript
2 parents 05f7639 + 6733c63 commit 91b0a25

File tree

75 files changed

+10050
-2547
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+10050
-2547
lines changed

.eslintrc.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"parser": "@typescript-eslint/parser",
3+
"env": {
4+
"browser": false,
5+
"es2021": true,
6+
"node": true
7+
},
8+
"extends": [
9+
"incredible",
10+
"plugin:@typescript-eslint/recommended"
11+
],
12+
"parserOptions": {
13+
"ecmaVersion": 2021,
14+
"ecmaFeatures": {
15+
"modules": true
16+
}
17+
},
18+
"plugins": [
19+
"@typescript-eslint"
20+
],
21+
"rules": {
22+
"no-unused-vars": "off",
23+
"@typescript-eslint/no-unused-vars": "error",
24+
"node/no-unpublished-import": ["error", {
25+
"allowModules": ["@cfworker/json-schema"]
26+
}],
27+
"no-process-exit": "off",
28+
"no-sync": "off",
29+
"no-shadow": "off",
30+
"object-curly-spacing": "off",
31+
"comma-dangle": "off",
32+
"censor/no-swear": "off",
33+
"@typescript-eslint/no-inferrable-types": "off",
34+
"object-shorthand": "off"
35+
},
36+
"settings": {
37+
"import/resolver": {
38+
"typescript": {}
39+
}
40+
}
41+
}

.github/workflows/continuous-integration.yml

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ on:
44
pull_request:
55
push:
66
branches:
7+
- '[0-9]+.[0-9]+.x'
78
- 'refs/pull/*'
9+
tags:
810

911
env:
1012
TEST_TAG: laminas/ci-matrix-action:test
@@ -82,7 +84,7 @@ jobs:
8284
id: matrix_generation
8385
env:
8486
PROJECT_NAME_TO_TEST: ${{ matrix.projectName }}
85-
run: cd tests/${PROJECT_NAME_TO_TEST} && docker run -i --entrypoint /action/index.js -v $(realpath .):/github/workspace -w=/github/workspace ${TEST_TAG} $(test -r diff && cat diff || echo -n "")
87+
run: cd tests/${PROJECT_NAME_TO_TEST} && docker run -i --entrypoint "/action/main.js" -v $(realpath .):/github/workspace -w=/github/workspace ${TEST_TAG} $(test -r diff && cat diff || echo -n "")
8688

8789
- name: "Output generated matrix"
8890
uses: sergeysova/jq-action@v2
@@ -97,5 +99,34 @@ jobs:
9799
with:
98100
cmd: 'jq -c . < tests/${PROJECT_NAME_TO_TEST}/matrix.json'
99101

100-
- name: "verify output of generated matrix for project: empty-project"
101-
run: diff --color <(echo '${{ steps.expected_matrix.outputs.value }}') <(echo '${{ steps.matrix_generation.outputs.matrix }}')
102+
- name: "verify output of generated matrix for project: ${{ matrix.projectName }}"
103+
run: diff --color <(echo '${{ steps.expected_matrix.outputs.value }}' | jq --sort-keys) <(echo '${{ steps.matrix_generation.outputs.matrix }}' | jq --sort-keys)
104+
105+
docker-build:
106+
runs-on: "ubuntu-latest"
107+
steps:
108+
- name: Checkout
109+
uses: actions/checkout@v2
110+
111+
- name: Set up QEMU
112+
uses: docker/setup-qemu-action@v1
113+
114+
- name: Set up Docker Buildx
115+
uses: docker/setup-buildx-action@v1
116+
117+
- name: Build
118+
uses: docker/build-push-action@v2
119+
with:
120+
push: false
121+
122+
linting:
123+
runs-on: "ubuntu-latest"
124+
steps:
125+
- uses: "actions/checkout@v2"
126+
- uses: "actions/setup-node@v2"
127+
with:
128+
check-latest: true
129+
- name: "Install node modules"
130+
run: "npm ci"
131+
- name: Run ESLint
132+
run: "npm run lint"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
/node_modules/
2+
/dist/

Dockerfile

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
1-
FROM node:current-alpine
1+
FROM node:17-alpine as compiler
22

3+
RUN mkdir -p /usr/local/source
4+
WORKDIR /usr/local/source
5+
COPY package*.json ./
6+
COPY tsconfig.json ./
7+
COPY webpack.config.js ./
8+
RUN npm ci
9+
COPY ./src ./src
10+
RUN npm run build
11+
12+
13+
FROM node:17-alpine
314
LABEL "repository"="http://github.com/laminas/laminas-ci-matrix-action"
415
LABEL "homepage"="http://github.com/laminas/laminas-ci-matrix-action"
516
LABEL "maintainer"="https://github.com/laminas/technical-steering-committee/"
@@ -8,14 +19,11 @@ RUN apk update \
819
&& apk add --no-cache bash git
920

1021
RUN mkdir /action
11-
ADD index.js /action/index.js
12-
RUN chmod u+x /action/index.js
13-
ADD src /action/src
14-
ADD package.json /action/package.json
15-
ADD package-lock.json /action/package-lock.json
16-
ADD composer.schema.json /action/
22+
ADD https://getcomposer.org/schema.json /action/composer.schema.json
1723
ADD laminas-ci.schema.json /action/
18-
RUN (cd /action ; npm install)
24+
25+
COPY --from=compiler /usr/local/source/dist/main.js /action/
26+
RUN chmod u+x /action/main.js
1927

2028
ADD entrypoint.sh /usr/local/bin/entrypoint.sh
2129

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,3 +221,14 @@ $ docker run -v $(realpath .):/github/workspace -w=/github/workspace ghcr.io/lam
221221
```
222222

223223
This will run the action locally and detail what matrix will be produced; it can be particularly useful for debugging issues with your `.laminas-ci.json` configuration.
224+
225+
## Development
226+
227+
In case you want to contribute features, bugfixes, tests or JSONSchema enhancements, you might want to build the docker container locally.
228+
229+
To do so, you can follow these steps:
230+
231+
1. Build the docker container by executing `$ docker build -t laminas/laminas-ci-matrix-action:dev-local .`
232+
2. Change to the `tests/` directory you want to create a matrix for
233+
3. Run the docker container while overriding the `entrypoint.sh` to ensure the `diff` is being passed to the matrix generator
234+
- `docker run -it --entrypoint "/action/main.js" -v $(realpath .):/github/workspace -w=/github/workspace docker.io/laminas/laminas-ci-matrix-action:dev-local $(test -r diff && cat diff || echo "")`

0 commit comments

Comments
 (0)