-
-
Notifications
You must be signed in to change notification settings - Fork 2
59 lines (57 loc) · 2.25 KB
/
CI.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
on:
push:
branches: [master]
pull_request:
name: CI
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js 20
uses: actions/setup-node@v3
with:
node-version: 20
- name: Install npm dependencies
run: npm install -r
- name: Run linter
run: npm run lint
- name: Run tests
run: npm run all-test
- name: Build docker image
run: docker build -t gomezguillaume/browser-ui-test .
- name: Run GUI tests
run: docker run -v "$PWD:/data" gomezguillaume/browser-ui-test --test-folder /data/tests/full-check/ --failure-folder /data/failures --variable DOC_PATH /data/tests/html_files
deploy:
runs-on: ubuntu-latest
needs: test
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v2
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Build docker image (without date nor version)
run: docker build -t gomezguillaume/browser-ui-test .
- name: Build docker image (with date)
run: docker build -t gomezguillaume/browser-ui-test:`date '+%Y-%m-%d'` .
- name: Check if docker image is needed with version
run: |
echo package_version=`grep '"version":' package.json | cut -d ':' -f 2 | cut -d '"' -f 2` >> $GITHUB_ENV
if docker manifest inspect gomezguillaume/browser-ui-test:${{env.package_version}}; then
echo "push_version=false" >> $GITHUB_ENV
else
echo "push_version=true" >> $GITHUB_ENV
fi
- name: Build docker image (with version)
if: ${{ env.push_version == 'true' }}
run: docker build -t gomezguillaume/browser-ui-test:${{env.package_version}} .
- name: Publish new docker images (normal and date)
run: |
docker push gomezguillaume/browser-ui-test
docker push gomezguillaume/browser-ui-test:`date '+%Y-%m-%d'`
- name: Publish new docker image (with version)
if: ${{ env.push_version == 'true' }}
run: docker push gomezguillaume/browser-ui-test:${{env.package_version}}