Skip to content

Commit f74b4c1

Browse files
authored
Merge pull request #3 from devatherock/tests
chore: Added functional tests to CI pipeline
2 parents bd7cb48 + e39572a commit f74b4c1

4 files changed

Lines changed: 92 additions & 56 deletions

File tree

.circleci/config.yml

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
slack_image: &slack_image
22
docker:
3-
- image: devatherock/simple-slack:0.5.0
3+
- image: devatherock/simple-slack:0.7.0
44
auth:
55
username: $DOCKER_USERNAME
66
password: $DOCKER_PASSWORD
@@ -23,6 +23,13 @@ executors:
2323

2424
version: 2.1
2525
jobs:
26+
docker_build_dry_run:
27+
executor: docker-executor
28+
steps:
29+
- checkout
30+
- setup_remote_docker
31+
- run: docker build .
32+
2633
publish:
2734
executor: docker-executor
2835
steps:
@@ -36,6 +43,26 @@ jobs:
3643
docker push devatherock/minify-js:$TAG
3744
docker push devatherock/minify-js:latest
3845
46+
functional_test:
47+
machine:
48+
image: ubuntu-2004:202010-01
49+
steps:
50+
- checkout
51+
- attach_workspace:
52+
at: ~/minify-js
53+
- restore_cache:
54+
keys:
55+
- v1-dependencies-{{ checksum "build.gradle" }}
56+
- v1-dependencies-
57+
- run: |
58+
./gradlew test
59+
- store_test_results:
60+
path: build/test-results
61+
- save_cache:
62+
paths:
63+
- ~/.gradle
64+
key: v1-dependencies-{{ checksum "build.gradle" }}
65+
3966
publish_release:
4067
executor: docker-executor
4168
steps:
@@ -47,14 +74,7 @@ jobs:
4774
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
4875
docker pull devatherock/minify-js:$DEV_TAG
4976
docker tag devatherock/minify-js:$DEV_TAG devatherock/minify-js:$TAG
50-
docker push devatherock/minify-js:$TAG
51-
52-
docker_build_dry_run:
53-
executor: docker-executor
54-
steps:
55-
- checkout
56-
- setup_remote_docker
57-
- run: docker build .
77+
docker push devatherock/minify-js:$TAG
5878
5979
notify:
6080
<<: *slack_image
@@ -77,12 +97,17 @@ workflows:
7797
filters:
7898
branches:
7999
only: master
100+
- functional_test:
101+
context:
102+
- docker-credentials
103+
requires:
104+
- publish
80105
- notify:
81106
context:
82107
- docker-credentials
83108
- slack-webhook
84109
requires:
85-
- publish
110+
- functional_test
86111
release:
87112
jobs:
88113
- publish_release:

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## [Unreleased]
4+
### Added
5+
- Functional tests to CI pipeline
6+
37
## [1.0.2] - 2021-02-08
48
### Added
59
- test: Added tests to test the final docker image

DOCS.md

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

README.md

Lines changed: 53 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,34 +9,82 @@ Github action/CI Plugin to minify html, javascript and css files, using [minify]
99

1010
## Usage
1111
### Github Action
12-
Please refer [action.yml](action.yml) for parameters.
12+
The following parameters can be set to configure the action.
13+
14+
* **directory** - File to minify or a folder containing files to minify. By default, all files in current folder and
15+
its sub-folders will be minified
16+
17+
* **output** - Path where the minified files will be saved. By default, the minified files will be saved in the
18+
original file path
19+
20+
* **add_suffix** - Indicates if the output files should have the suffix `.min` added after the name. Default is true
1321

1422
```yaml
1523
jobs:
1624
build:
1725
runs-on: ubuntu-latest # Docker-based github actions have to run on a linux environment
1826
steps:
1927
- name: HTML/CSS/JS Minifier
20-
uses: docker://devatherock/minify-js:latest # To use a specific release, use a docker tag like 1.0.2 instead of latest
28+
uses: docker://devatherock/minify-js:1.0.2
2129
with:
2230
directory: 'src' # Optional
2331
output: 'minify/src' # Optional
2432
add_suffix: false # Optional
2533
```
2634
2735
### Docker
36+
2837
```shell
2938
docker run --rm \
3039
-v "/path/to/files":/work \
3140
-w=/work \
3241
-e PARAMETER_INPUT_PATH=/work/src \
3342
-e PARAMETER_OUTPUT_PATH=/work/minify/src \
3443
-e PARAMETER_ADD_SUFFIX=false \
35-
devatherock/minify-js:latest
44+
devatherock/minify-js:1.0.2
45+
```
46+
47+
### vela
48+
The following parameters can be set to configure the plugin.
49+
50+
* **input_path** - File to minify or a folder containing files to minify. By default, all files in current folder and
51+
its sub-folders will be minified
52+
53+
* **output_path** - Path where the minified files will be saved. By default, the minified files will be saved in the
54+
original file path
55+
56+
* **add_suffix** - Indicates if the output files should have the suffix `.min` added after the name. Default is true
57+
58+
```yaml
59+
steps:
60+
- name: minify_js
61+
ruleset:
62+
branch: master
63+
event: push
64+
image: devatherock/minify-js:1.0.2
65+
parameters:
66+
input_path: src
67+
output_path: minify/src
68+
add_suffix: false
3669
```
3770
38-
### vela/CircleCI
39-
Please refer [docs](DOCS.md)
71+
### CircleCI
72+
73+
```yaml
74+
version: 2.1
75+
jobs:
76+
minify_js:
77+
docker:
78+
- image: devatherock/minify-js:1.0.2
79+
working_directory: ~/my-repo
80+
environment:
81+
PARAMETER_INPUT_PATH: src
82+
PARAMETER_OUTPUT_PATH: minify/src
83+
PARAMETER_ADD_SUFFIX: false
84+
steps:
85+
- checkout
86+
- run: sh /entrypoint.sh
87+
```
4088
4189
## Tests
4290
To test the latest plugin image, run the below command

0 commit comments

Comments
 (0)