-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
76 lines (70 loc) · 1.64 KB
/
.gitlab-ci.yml
File metadata and controls
76 lines (70 loc) · 1.64 KB
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
stages:
- build
- lint
- test
- deploy
build-job:
stage: build
script:
- echo "Hello, $GITLAB_USER_LOGIN!"
php-lint:
stage: lint
image: php:latest
allow_failure: true
before_script:
- cd codesniffer
script:
- php phpcs.phar -s --standard=phpcs_ruleset.xml --ignore=*.js ../html
- php phpcbf.phar -s --standard=phpcs_ruleset.xml --ignore=*.js ../html
js-css-lint:
stage: lint
image: node:latest
script:
- npm install
- npm run lint:js
- npm run lint:css
allow_failure: true
only:
- branches
phpunit-tests:
stage: test
image: php:latest
script:
- ./vendor/bin/phpunit html/test/
unit-test:
image: node:latest
stage: test
coverage: /All files[^|]*\|[^|]*\s+([\d\.]+)/
before_script:
- cd html
- cd test
- npm install --save-dev jsdom
- npm install --save-dev jest-environment-jsdom
script:
- ls
# - npx jest waldo_game.test.js
artifacts:
paths:
- coverage/
when: always
reports:
junit:
- junit.xml
deploy-prod:
stage: deploy
image: debian:12.4
before_script:
- 'command -v ssh-agent >/dev/null || ( apt-get update -y && apt-get install openssh-client -y )'
- eval $(ssh-agent -s)
- chmod 400 "$SSH_PRIVATE_KEY"
- ssh-add "$SSH_PRIVATE_KEY"
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- ssh-keyscan cis4250w24-08.socs.uoguelph.ca >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
script:
- echo "On $CI_COMMIT_REF_NAME branch, copying html files...";
- scp -r html/* socs@cis4250w24-08.socs.uoguelph.ca:/var/www/html/;
rules:
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
environment: production