Skip to content

Commit 278f804

Browse files
committed
Move to JS actions
1 parent 97bae9a commit 278f804

Some content is hidden

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

49 files changed

+1694
-29524
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
PKG_LIST := node-sdk find load-metadata create codecov-uploader codacy-uploader
2+
TARGETS := configure install build package lint test
3+
4+
define FOR_EACH_PKG
5+
@for PKG in $(PKG_LIST); do \
6+
echo ">>>>>> $(1) \"$$PKG\" Package >>>>>>"; \
7+
$(MAKE) -C $$PKG $(1) || exit 1; \
8+
echo "<<<<<<\n"; \
9+
done
10+
endef
11+
12+
$(TARGETS):
13+
$(call FOR_EACH_PKG,$@)
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
.PHONY: install
2+
install:
3+
@echo "Nothing to install !"
4+
5+
.PHONY: build
6+
build:
7+
@echo "Nothing to build !"
8+
9+
.PHONY: package
10+
package:
11+
@echo "Nothing to pack !"
12+
13+
.PHONY: lint
14+
lint:
15+
@echo "Nothing to lint !"
16+
17+
.PHONY: test
18+
test:
19+
@echo "Nothing to test !"

.github/actions/reports-group/codacy-uploader/action.yml

Lines changed: 32 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,48 +14,44 @@ inputs:
1414
default: 'true'
1515

1616
outputs:
17-
uploaded-reports:
17+
reports:
1818
description: TODO
19-
value: ${{ steps.build-uploader-options.outputs.coverage-reports }}
19+
value: ${{ steps.build-outputs.outputs.reports }}
2020

2121
runs:
2222
using: "composite"
2323
steps:
24-
- name: Make action inputs available for actions/github-script scripts
24+
# Even if an input is marked as "required", an empty value (or no value) may be passed !
25+
- name: Validate inputs
2526
uses: actions/github-script@v7
2627
env:
2728
INPUT_MAP: ${{ toJson(inputs) }}
2829
with:
2930
script: |
30-
Object.entries(JSON.parse(process.env.INPUT_MAP)).forEach(([key, value]) => {
31-
const envName = 'INPUT_' + key.replace(/ /g, '_').toUpperCase();
32-
core.debug(`Promote ${key} input as ${envName} env var. value='${value}'`);
33-
core.exportVariable(envName, value);
34-
});
35-
36-
- uses: actions/github-script@v7
37-
with:
38-
script: |
39-
core.info('Validate required inputs');
40-
41-
core.getInput('path', {required: true});
42-
core.getInput('project-token', {required: true});
31+
return core.group(
32+
'Validate inputs',
33+
async () => Object.entries(JSON.parse(process.env.INPUT_MAP))
34+
.forEach(([key, val]) => {
35+
if (!val.trim()) { throw new Error(`Input required and not supplied: ${name}`); }
36+
})
37+
);
4338
4439
# @TODO move reports-group/load-metadata action to a dedicated repo and remove the checkout
4540
- uses: actions/checkout@v4
4641
with:
4742
path: custom-action-repo
4843

49-
- id: load-metadata
44+
- name: Load groups metadata
45+
id: load-metadata
5046
uses: ./custom-action-repo/.github/actions/reports-group/load-metadata
5147
with:
5248
path: ${{ inputs.path }}
5349
format: string # String in order to concatenate interesting values
5450
glue-string: ',' # Ensure glue string as it's the expected one by the uploader
5551
follow-symbolic-links: ${{ inputs.follow-symbolic-links }}
5652

57-
58-
- id: build-uploader-options
53+
- name: Build uploader option
54+
id: build-uploader-options
5955
uses: actions/github-script@v7
6056
env:
6157
METADATA: ${{ steps.load-metadata.outputs.metadata }}
@@ -67,14 +63,29 @@ runs:
6763
const metadata = JSON.parse(METADATA);
6864
core.setOutput('coverage-reports', metadata.reportPaths);
6965
70-
- if: ${{ '' == steps.build-uploader-options.outputs.coverage-reports }}
66+
- name: Ensure at least one report to upload
67+
if: ${{ '' == steps.build-uploader-options.outputs.coverage-reports }}
7168
uses: actions/github-script@v7
7269
with:
7370
script: |
7471
core.setFailed('Unable to retrieve any report to upload. Something wrong most likely happened !');
7572
76-
- id: upload
73+
- name: Upload to codacy
74+
id: upload
7775
uses: codacy/codacy-coverage-reporter-action@v1
7876
with:
7977
coverage-reports: ${{ steps.build-uploader-options.outputs.coverage-reports }}
8078
project-token: ${{ inputs.project-token }}
79+
80+
- name: Build action outputs
81+
id: build-outputs
82+
uses: actions/github-script@v7
83+
env:
84+
METADATA: ${{ steps.load-metadata.outputs.metadata }}
85+
with:
86+
script: |
87+
core.info('Build output');
88+
const {METADATA} = process.env;
89+
90+
const metadata = JSON.parse(METADATA);
91+
core.setOutput('reports', metadata.reportPaths.split(',').join('\n'));

.github/actions/reports-group/codacy-uploader/package.json

Lines changed: 0 additions & 12 deletions
This file was deleted.

.github/actions/reports-group/codecov-uploader/.nvmrc

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
.PHONY: install
2+
install:
3+
@echo "Nothing to install !"
4+
5+
.PHONY: build
6+
build:
7+
@echo "Nothing to build !"
8+
9+
.PHONY: package
10+
package:
11+
@echo "Nothing to pack !"
12+
13+
.PHONY: lint
14+
lint:
15+
@echo "Nothing to lint !"
16+
17+
.PHONY: test
18+
test:
19+
@echo "Nothing to test !"

.github/actions/reports-group/codecov-uploader/action.yml

Lines changed: 45 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,43 +13,51 @@ inputs:
1313
Indicates whether to follow symbolic links when resolving `path`
1414
default: 'true'
1515

16+
outputs:
17+
name:
18+
description: TODO
19+
value: ${{ steps.build-outputs.outputs.name }}
20+
reports:
21+
description: TODO
22+
value: ${{ steps.build-outputs.outputs.reports }}
23+
flags:
24+
description: TODO
25+
value: ${{ steps.build-outputs.outputs.flags }}
26+
1627
runs:
1728
using: "composite"
1829
steps:
19-
- name: Make action inputs available for actions/github-script scripts
30+
# Even if an input is marked as "required", an empty value (or no value) may be passed !
31+
- name: Validate inputs
2032
uses: actions/github-script@v7
2133
env:
2234
INPUT_MAP: ${{ toJson(inputs) }}
2335
with:
2436
script: |
25-
Object.entries(JSON.parse(process.env.INPUT_MAP)).forEach(([key, value]) => {
26-
const envName = 'INPUT_' + key.replace(/ /g, '_').toUpperCase();
27-
core.debug(`Promote ${key} input as ${envName} env var. value='${value}'`);
28-
core.exportVariable(envName, value);
29-
});
30-
31-
- uses: actions/github-script@v7
32-
with:
33-
script: |
34-
core.info('Validate required inputs');
35-
36-
core.getInput('path', {required: true});
37-
core.getInput('token', {required: true});
37+
return core.group(
38+
'Validate inputs',
39+
async () => Object.entries(JSON.parse(process.env.INPUT_MAP))
40+
.forEach(([key, val]) => {
41+
if (!val.trim()) { throw new Error(`Input required and not supplied: ${name}`); }
42+
})
43+
);
3844
3945
# @TODO move reports-group/load-metadata action to a dedicated repo and remove the checkout
4046
- uses: actions/checkout@v4
4147
with:
4248
path: custom-action-repo
4349

44-
- id: load-metadata
50+
- name: Load groups metadata
51+
id: load-metadata
4552
uses: ./custom-action-repo/.github/actions/reports-group/load-metadata
4653
with:
4754
path: ${{ inputs.path }}
4855
format: string # String in order to concatenate interesting values
4956
glue-string: ',' # Ensure glue string as it's the expected one by the uploader
5057
follow-symbolic-links: ${{ inputs.follow-symbolic-links }}
5158

52-
- id: build-uploader-options
59+
- name: Build uploader option
60+
id: build-uploader-options
5361
uses: actions/github-script@v7
5462
env:
5563
METADATA: ${{ steps.load-metadata.outputs.metadata }}
@@ -64,15 +72,16 @@ runs:
6472
if (metadata.flags.length > 0) {
6573
core.setOutput('flags', metadata.flags);
6674
}
67-
6875
69-
- if: ${{ '' == steps.build-uploader-options.outputs.files }}
76+
- name: Ensure at least one report to upload
77+
if: ${{ '' == steps.build-uploader-options.outputs.files }}
7078
uses: actions/github-script@v7
7179
with:
7280
script: |
7381
core.setFailed('Unable to retrieve any report to upload. Something wrong most likely happened !');
7482
75-
- id: upload
83+
- name: Upload to codacy
84+
id: upload
7685
uses: codecov/codecov-action@v4
7786
with:
7887
token: ${{ inputs.token }}
@@ -84,3 +93,20 @@ runs:
8493
# GHAction behavior
8594
fail_ci_if_error: true
8695
verbose: ${{ runner.debug == '1' }}
96+
97+
- name: Build action outputs
98+
id: build-outputs
99+
uses: actions/github-script@v7
100+
env:
101+
METADATA: ${{ steps.load-metadata.outputs.metadata }}
102+
with:
103+
script: |
104+
core.info('Build output');
105+
const {METADATA} = process.env;
106+
107+
const metadata = JSON.parse(METADATA);
108+
core.setOutput('name', metadata.name);
109+
core.setOutput('reports', metadata.reportPaths.split(',').join('\n'));
110+
if (metadata.flags.length > 0) {
111+
core.setOutput('flags', metadata.flags.split(',').join('\n'));
112+
}

.github/actions/reports-group/codecov-uploader/package.json

Lines changed: 0 additions & 12 deletions
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

0 commit comments

Comments
 (0)