This repository has been archived by the owner on Oct 5, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 345
78 lines (69 loc) · 2.46 KB
/
ci-cd.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: ci-cd
on:
push:
branches:
- master
pull_request:
branches:
- master
schedule:
- cron: "0 0 * * *" # runs every day at 12 a.m.
workflow_dispatch:
jobs:
build:
name: ${{ matrix.IMAGE_NAME }}@${{ matrix.NPM_TAG }}
runs-on: ubuntu-18.04
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
node_test: [10] # node version for the test suite.
node: [12.18.3]
NPM_TAG: ["latest", "next"]
IMAGE_NAME:
[
"theia-full",
]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node_test }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node_test }}
- name: Lint
shell: bash
run: |
npm -v
npm install -g eclint
eclint check "**/*" || echo "Warning! Formatting errors encountered..."
# determine if the given image needs to be built based on changed files.
# - builds the `theia-docker` image in the case that files not present under an `docker` folder are modified.
# - sets the `steps.check_changed.outputs.status` environment variable which can be re-used.
- name: Determine if ${{ matrix.IMAGE_NAME }} should be built
id: check_changed
if: github.event_name == 'pull_request'
shell: bash
run: |
git fetch origin master:master
RETURN_CODE=$(./check_changed.sh ${{ matrix.IMAGE_NAME }});
if [ $RETURN_CODE -eq 137 ]; then
echo "No changes in ${{ matrix.IMAGE_NAME }}, terminating."
echo ::set-output name=status::'terminate'
elif [ $RETURN_CODE -ne 0]; then
echo "Error happened in check_changed"
exit $RETURN_CODE;
else
echo ::set-output name=status::'continue'
fi
- name: Build
if: github.event_name != 'pull_request' || steps.check_changed.outputs.status == 'continue'
shell: bash
run: ./build_container.sh ${{ matrix.NPM_TAG }} ${{ matrix.IMAGE_NAME }} ${{ matrix.node }} ${{ secrets.GITHUB_TOKEN }} ${{matrix.PORT}} ${{matrix.ENV_VARS}}
- name: Test
if: github.event_name != 'pull_request' || steps.check_changed.outputs.status == 'continue'
shell: bash
run: |
google-chrome --version
chromedriver --version
(cd tests && yarn && yarn test-app-${{ matrix.IMAGE_NAME }})