-
Notifications
You must be signed in to change notification settings - Fork 9
124 lines (117 loc) · 3.38 KB
/
ci-push.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# Workflow for linting, building, testing, CodeQL analysis, and reporting of code coverage
name: Node.js CI
on:
push:
branches:
- master
- develop
- dev/**
paths:
- 'src/**'
- 'tests/**'
- 'package.json'
- 'package-lock.json'
- '.github/workflows/ci-push.yml'
schedule:
- cron: '30 12 * * 0'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20
- run: npm ci
- run: npm run lint
- run: npm run build
- uses: actions/upload-artifact@v4
with:
name: build
path: build
- name: Test usage with TypeScript
run: npm run test:ts
env:
AUTH_JSON: ${{secrets.AUTH_JSON}}
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [10.x, 16.x, 18.x, 22.x]
needs: build
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Setup MediaWiki instance using Docker for integration tests
run: npm run setuplocalwiki
- run: npm ci
- uses: actions/download-artifact@v4
- run: npm run test
env:
AUTH_JSON: ${{secrets.AUTH_JSON}}
- uses: actions/upload-artifact@v4
with:
name: coverage_${{ matrix.node-version }}
path: coverage
coveralls:
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: coverage_18.x
path: coverage
- name: Coveralls
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
# Upload coverage report to toolforge as well
upload_coverage:
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/download-artifact@v4
with:
name: coverage_18.x
path: coverage
- name: Zip coverage report
run: |
mv coverage/lcov-report/* coverage
zip -r coverage.zip coverage
- name: Upload coverage reports to Toolforge
uses: appleboy/scp-action@9ba62064d28ce0897a970e72cdfe30b9fde2fe48
with:
source: ${{github.workspace}}/coverage/*
strip_components: 3
target: /data/project/mwn/www/static/coverage
rm: true
host: login.toolforge.org
username: ${{ secrets.TOOLFORGE_USERNAME }}
key: ${{ secrets.TOOLFORGE_PRIVATE_KEY }}
mirror:
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # all branches and tags
- name: Mirror to Gitlab
run: |
mkdir -p ~/.ssh
echo -e "$KEY" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
git remote add gitlab "[email protected]:sd/mwn.git"
git push gitlab master --force
git push gitlab --tags
rm -rf ~/.ssh
env:
KEY: ${{ secrets.GITLAB_PRIVATE_KEY }}