diff options
author | Chocobozzz <me@florianbigard.com> | 2021-12-01 14:14:58 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-12-03 10:14:17 +0100 |
commit | 51e9e152f7df003c65c16f822669a0674efcaf03 (patch) | |
tree | a18abdf95bfc449d8d08e4c47e8ccc7ee094bbf4 | |
parent | f3fbbf01402fc7491e044f160edca06ef793eb50 (diff) | |
download | PeerTube-51e9e152f7df003c65c16f822669a0674efcaf03.tar.gz PeerTube-51e9e152f7df003c65c16f822669a0674efcaf03.tar.zst PeerTube-51e9e152f7df003c65c16f822669a0674efcaf03.zip |
Build nightly using github action
-rw-r--r-- | .github/actions/reusable-deploy/action.yml | 46 | ||||
-rw-r--r-- | .github/actions/reusable-prepare-peertube-build/action.yml | 31 | ||||
-rw-r--r-- | .github/actions/reusable-prepare-peertube-run/action.yml | 16 | ||||
-rw-r--r-- | .github/workflows/benchmark.yml | 69 | ||||
-rw-r--r-- | .github/workflows/codeql.yml | 2 | ||||
-rw-r--r-- | .github/workflows/nightly.yml | 36 | ||||
-rw-r--r-- | .github/workflows/stats.yml | 48 | ||||
-rw-r--r-- | .github/workflows/test.yml | 25 | ||||
-rw-r--r-- | .gitlab-ci.yml | 40 | ||||
-rw-r--r-- | support/doc/development/ci.md | 40 |
10 files changed, 191 insertions, 162 deletions
diff --git a/.github/actions/reusable-deploy/action.yml b/.github/actions/reusable-deploy/action.yml new file mode 100644 index 000000000..bc69a2e43 --- /dev/null +++ b/.github/actions/reusable-deploy/action.yml | |||
@@ -0,0 +1,46 @@ | |||
1 | name: "Reusable deploy on builds.joinpeertube.org" | ||
2 | |||
3 | description: "Reusable deploy on builds.joinpeertube.org" | ||
4 | |||
5 | inputs: | ||
6 | source: | ||
7 | required: true | ||
8 | description: "Source file/files/directory/directories to deploy" | ||
9 | destination: | ||
10 | required: true | ||
11 | description: "Destination directory on builds.joinpeertube.org" | ||
12 | knownHosts: | ||
13 | required: true | ||
14 | description: "Known hosts" | ||
15 | deployKey: | ||
16 | required: true | ||
17 | description: "Deploy key" | ||
18 | deployUser: | ||
19 | required: true | ||
20 | description: "Deploy user" | ||
21 | deployHost: | ||
22 | required: true | ||
23 | description: "Deploy host" | ||
24 | |||
25 | |||
26 | runs: | ||
27 | using: "composite" | ||
28 | |||
29 | steps: | ||
30 | - name: "Deploy" | ||
31 | shell: bash | ||
32 | run: | | ||
33 | mkdir -p ~/.ssh | ||
34 | chmod 700 ~/.ssh | ||
35 | |||
36 | echo "Adding ssh key to known hosts" | ||
37 | echo -e "${{ inputs.knownHosts }}" > ~/.ssh/known_hosts; | ||
38 | |||
39 | eval `ssh-agent -s` | ||
40 | |||
41 | echo "Adding ssh deploy key" | ||
42 | ssh-add <(echo "${{ inputs.deployKey }}"); | ||
43 | |||
44 | echo "Uploading files" | ||
45 | |||
46 | scp ${{ inputs.source }} ${{ inputs.deployUser }}@${{ inputs.deployHost }}:../../web/${{ inputs.destination }}; | ||
diff --git a/.github/actions/reusable-prepare-peertube-build/action.yml b/.github/actions/reusable-prepare-peertube-build/action.yml new file mode 100644 index 000000000..41ebf71c5 --- /dev/null +++ b/.github/actions/reusable-prepare-peertube-build/action.yml | |||
@@ -0,0 +1,31 @@ | |||
1 | name: "Reusable prepare PeerTube build" | ||
2 | |||
3 | description: "Reusable prepare PeerTube build" | ||
4 | |||
5 | inputs: | ||
6 | node-version: | ||
7 | required: true | ||
8 | description: 'NodeJS version' | ||
9 | |||
10 | runs: | ||
11 | using: "composite" | ||
12 | |||
13 | steps: | ||
14 | - name: Use Node.js | ||
15 | uses: actions/setup-node@v1 | ||
16 | with: | ||
17 | node-version: ${{ inputs.node-version }} | ||
18 | |||
19 | - name: Cache Node.js modules | ||
20 | uses: actions/cache@v2 | ||
21 | with: | ||
22 | path: | | ||
23 | **/node_modules | ||
24 | key: ${{ runner.OS }}-node-${{ hashFiles('**/yarn.lock') }} | ||
25 | restore-keys: | | ||
26 | ${{ runner.OS }}-node- | ||
27 | ${{ runner.OS }}- | ||
28 | |||
29 | - name: Install dependencies | ||
30 | shell: bash | ||
31 | run: yarn install --frozen-lockfile | ||
diff --git a/.github/actions/reusable-prepare-peertube-run/action.yml b/.github/actions/reusable-prepare-peertube-run/action.yml new file mode 100644 index 000000000..1a6cd2cfd --- /dev/null +++ b/.github/actions/reusable-prepare-peertube-run/action.yml | |||
@@ -0,0 +1,16 @@ | |||
1 | name: "Reusable prepare PeerTube run" | ||
2 | description: "Reusable prepare PeerTube run" | ||
3 | |||
4 | runs: | ||
5 | using: "composite" | ||
6 | |||
7 | steps: | ||
8 | - name: Setup system dependencies | ||
9 | shell: bash | ||
10 | run: | | ||
11 | sudo apt-get install postgresql-client-common redis-tools parallel | ||
12 | wget --quiet --no-check-certificate "https://download.cpy.re/ffmpeg/ffmpeg-release-4.3.1-64bit-static.tar.xz" | ||
13 | tar xf ffmpeg-release-4.3.1-64bit-static.tar.xz | ||
14 | mkdir -p $HOME/bin | ||
15 | cp ffmpeg-*/{ffmpeg,ffprobe} $HOME/bin | ||
16 | echo "$HOME/bin" >> $GITHUB_PATH | ||
diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 86f675432..f02b88a42 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml | |||
@@ -29,48 +29,15 @@ jobs: | |||
29 | env: | 29 | env: |
30 | PGUSER: peertube | 30 | PGUSER: peertube |
31 | PGHOST: localhost | 31 | PGHOST: localhost |
32 | NODE_PENDING_JOB_WAIT: 500 | ||
33 | 32 | ||
34 | steps: | 33 | steps: |
35 | - uses: actions/checkout@v2 | 34 | - uses: actions/checkout@v2 |
36 | 35 | ||
37 | - name: Use Node.js | 36 | - uses: './.github/actions/reusable-prepare-peertube-build' |
38 | uses: actions/setup-node@v1 | ||
39 | with: | 37 | with: |
40 | node-version: '12.x' | 38 | node-version: '12.x' |
41 | 39 | ||
42 | - name: Setup system dependencies | 40 | - uses: './.github/actions/reusable-prepare-peertube-run' |
43 | run: | | ||
44 | sudo apt-get install postgresql-client-common redis-tools parallel | ||
45 | wget --quiet --no-check-certificate "https://download.cpy.re/ffmpeg/ffmpeg-release-4.3.1-64bit-static.tar.xz" | ||
46 | tar xf ffmpeg-release-4.3.1-64bit-static.tar.xz | ||
47 | mkdir -p $HOME/bin | ||
48 | cp ffmpeg-*/{ffmpeg,ffprobe} $HOME/bin | ||
49 | echo "$HOME/bin" >> $GITHUB_PATH | ||
50 | |||
51 | - name: Cache Node.js modules | ||
52 | uses: actions/cache@v2 | ||
53 | with: | ||
54 | path: | | ||
55 | **/node_modules | ||
56 | key: ${{ runner.OS }}-node-${{ hashFiles('**/yarn.lock') }} | ||
57 | restore-keys: | | ||
58 | ${{ runner.OS }}-node- | ||
59 | ${{ runner.OS }}- | ||
60 | |||
61 | - name: Cache fixtures | ||
62 | uses: actions/cache@v2 | ||
63 | with: | ||
64 | path: | | ||
65 | fixtures | ||
66 | key: ${{ runner.OS }}-fixtures-${{ matrix.test_suite }}-${{ hashFiles('fixtures/*') }} | ||
67 | restore-keys: | | ||
68 | ${{ runner.OS }}-fixtures-${{ matrix.test_suite }}- | ||
69 | ${{ runner.OS }}-fixtures- | ||
70 | ${{ runner.OS }}- | ||
71 | |||
72 | - name: Install dependencies | ||
73 | run: yarn install --frozen-lockfile | ||
74 | 41 | ||
75 | - name: Build | 42 | - name: Build |
76 | run: | | 43 | run: | |
@@ -111,27 +78,11 @@ jobs: | |||
111 | cat benchmark.json build-time.json startup-time.json | 78 | cat benchmark.json build-time.json startup-time.json |
112 | 79 | ||
113 | - name: Upload benchmark result | 80 | - name: Upload benchmark result |
114 | env: | 81 | uses: './.github/actions/reusable-deploy.yml' |
115 | STATS_DEPLOYEMENT_KNOWN_HOSTS: ${{ secrets.STATS_DEPLOYEMENT_KNOWN_HOSTS }} | 82 | with: |
116 | STATS_DEPLOYEMENT_KEY: ${{ secrets.STATS_DEPLOYEMENT_KEY }} | 83 | source: benchmark.json build-time.json startup-time.json |
117 | STATS_DEPLOYEMENT_USER: ${{ secrets.STATS_DEPLOYEMENT_USER }} | 84 | destination: peertube-stats |
118 | STATS_DEPLOYEMENT_HOST: ${{ secrets.STATS_DEPLOYEMENT_HOST }} | 85 | knownHosts: ${{ secrets.STATS_DEPLOYEMENT_KNOWN_HOSTS }} |
119 | run: | | 86 | deployKey: ${{ secrets.STATS_DEPLOYEMENT_KEY }} |
120 | mkdir -p ~/.ssh | 87 | deployUser: ${{ secrets.STATS_DEPLOYEMENT_USER }} |
121 | chmod 700 ~/.ssh | 88 | deployHost: ${{ secrets.STATS_DEPLOYEMENT_HOST }} |
122 | if [ ! -z ${STATS_DEPLOYEMENT_KNOWN_HOSTS+x} ]; then | ||
123 | echo "Adding ssh key to known hosts" | ||
124 | echo -e "${STATS_DEPLOYEMENT_KNOWN_HOSTS}" > ~/.ssh/known_hosts; | ||
125 | fi | ||
126 | |||
127 | eval `ssh-agent -s` | ||
128 | |||
129 | if [ ! -z ${STATS_DEPLOYEMENT_KEY+x} ]; then | ||
130 | echo "Adding ssh reployement key" | ||
131 | ssh-add <(echo "${STATS_DEPLOYEMENT_KEY}"); | ||
132 | fi | ||
133 | |||
134 | if [ ! -z ${STATS_DEPLOYEMENT_KEY+x} ]; then | ||
135 | echo "Uploading files" | ||
136 | scp benchmark.json build-time.json startup-time.json ${STATS_DEPLOYEMENT_USER}@${STATS_DEPLOYEMENT_HOST}:../../web/peertube-stats; | ||
137 | fi | ||
diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 20803bd86..5c0c93886 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml | |||
@@ -13,7 +13,7 @@ name: "CodeQL" | |||
13 | 13 | ||
14 | on: | 14 | on: |
15 | push: | 15 | push: |
16 | branches: [ next ] | 16 | branches: [ develop, next ] |
17 | pull_request: | 17 | pull_request: |
18 | # The branches below must be a subset of the branches above | 18 | # The branches below must be a subset of the branches above |
19 | branches: [ next ] | 19 | branches: [ next ] |
diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml new file mode 100644 index 000000000..156b7143a --- /dev/null +++ b/.github/workflows/nightly.yml | |||
@@ -0,0 +1,36 @@ | |||
1 | name: Nightly | ||
2 | |||
3 | on: | ||
4 | push: | ||
5 | branches: | ||
6 | - 'next' | ||
7 | schedule: | ||
8 | - cron: '0 3 * * *' | ||
9 | |||
10 | jobs: | ||
11 | |||
12 | nightly: | ||
13 | runs-on: ubuntu-latest | ||
14 | |||
15 | steps: | ||
16 | - | ||
17 | name: Checkout develop | ||
18 | uses: actions/checkout@v2 | ||
19 | with: | ||
20 | ref: next | ||
21 | |||
22 | - uses: './.github/actions/reusable-prepare-peertube-build' | ||
23 | with: | ||
24 | node-version: '14.x' | ||
25 | |||
26 | - name: Build | ||
27 | run: npm run nightly | ||
28 | |||
29 | - uses: './.github/actions/reusable-deploy' | ||
30 | with: | ||
31 | source: ./peertube-nightly-* | ||
32 | destination: nightly-test | ||
33 | knownHosts: ${{ secrets.STATS_DEPLOYEMENT_KNOWN_HOSTS }} | ||
34 | deployKey: ${{ secrets.STATS_DEPLOYEMENT_KEY }} | ||
35 | deployUser: ${{ secrets.STATS_DEPLOYEMENT_USER }} | ||
36 | deployHost: ${{ secrets.STATS_DEPLOYEMENT_HOST }} | ||
diff --git a/.github/workflows/stats.yml b/.github/workflows/stats.yml index e50c14720..c87e6fb77 100644 --- a/.github/workflows/stats.yml +++ b/.github/workflows/stats.yml | |||
@@ -20,24 +20,10 @@ jobs: | |||
20 | steps: | 20 | steps: |
21 | - uses: actions/checkout@v2 | 21 | - uses: actions/checkout@v2 |
22 | 22 | ||
23 | - name: Use Node.js | 23 | - uses: './.github/actions/reusable-prepare-peertube-build' |
24 | uses: actions/setup-node@v1 | ||
25 | with: | 24 | with: |
26 | node-version: '14.x' | 25 | node-version: '14.x' |
27 | 26 | ||
28 | - name: Cache Node.js modules | ||
29 | uses: actions/cache@v2 | ||
30 | with: | ||
31 | path: | | ||
32 | **/node_modules | ||
33 | key: ${{ runner.OS }}-node-${{ hashFiles('**/yarn.lock') }} | ||
34 | restore-keys: | | ||
35 | ${{ runner.OS }}-node- | ||
36 | ${{ runner.OS }}- | ||
37 | |||
38 | - name: Install dependencies | ||
39 | run: yarn install --frozen-lockfile | ||
40 | |||
41 | - name: Angular bundlewatch | 27 | - name: Angular bundlewatch |
42 | uses: jackyef/bundlewatch-gh-action@master | 28 | uses: jackyef/bundlewatch-gh-action@master |
43 | with: | 29 | with: |
@@ -73,27 +59,11 @@ jobs: | |||
73 | 59 | ||
74 | - name: Upload stats | 60 | - name: Upload stats |
75 | if: github.event_name != 'pull_request' | 61 | if: github.event_name != 'pull_request' |
76 | env: | 62 | uses: './.github/actions/reusable-deploy' |
77 | STATS_DEPLOYEMENT_KNOWN_HOSTS: ${{ secrets.STATS_DEPLOYEMENT_KNOWN_HOSTS }} | 63 | with: |
78 | STATS_DEPLOYEMENT_KEY: ${{ secrets.STATS_DEPLOYEMENT_KEY }} | 64 | source: lighthouse.json client-build-stats.json scc.json |
79 | STATS_DEPLOYEMENT_USER: ${{ secrets.STATS_DEPLOYEMENT_USER }} | 65 | destination: peertube-stats |
80 | STATS_DEPLOYEMENT_HOST: ${{ secrets.STATS_DEPLOYEMENT_HOST }} | 66 | knownHosts: ${{ secrets.STATS_DEPLOYEMENT_KNOWN_HOSTS }} |
81 | run: | | 67 | deployKey: ${{ secrets.STATS_DEPLOYEMENT_KEY }} |
82 | mkdir -p ~/.ssh | 68 | deployUser: ${{ secrets.STATS_DEPLOYEMENT_USER }} |
83 | chmod 700 ~/.ssh | 69 | deployHost: ${{ secrets.STATS_DEPLOYEMENT_HOST }} |
84 | if [ ! -z ${STATS_DEPLOYEMENT_KNOWN_HOSTS+x} ]; then | ||
85 | echo "Adding ssh key to known hosts" | ||
86 | echo -e "${STATS_DEPLOYEMENT_KNOWN_HOSTS}" > ~/.ssh/known_hosts; | ||
87 | fi | ||
88 | |||
89 | eval `ssh-agent -s` | ||
90 | |||
91 | if [ ! -z ${STATS_DEPLOYEMENT_KEY+x} ]; then | ||
92 | echo "Adding ssh reployement key" | ||
93 | ssh-add <(echo "${STATS_DEPLOYEMENT_KEY}"); | ||
94 | fi | ||
95 | |||
96 | if [ ! -z ${STATS_DEPLOYEMENT_KEY+x} ]; then | ||
97 | echo "Uploading files" | ||
98 | scp lighthouse.json client-build-stats.json scc.json ${STATS_DEPLOYEMENT_USER}@${STATS_DEPLOYEMENT_HOST}:../../web/peertube-stats; | ||
99 | fi | ||
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0366ac49f..030ec3790 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml | |||
@@ -50,29 +50,11 @@ jobs: | |||
50 | steps: | 50 | steps: |
51 | - uses: actions/checkout@v2 | 51 | - uses: actions/checkout@v2 |
52 | 52 | ||
53 | - name: Use Node.js | 53 | - uses: './.github/actions/reusable-prepare-peertube-build' |
54 | uses: actions/setup-node@v1 | ||
55 | with: | 54 | with: |
56 | node-version: '12.x' | 55 | node-version: '12.x' |
57 | 56 | ||
58 | - name: Setup system dependencies | 57 | - uses: './.github/actions/reusable-prepare-peertube-run' |
59 | run: | | ||
60 | sudo apt-get install postgresql-client-common redis-tools parallel | ||
61 | wget --quiet --no-check-certificate "https://download.cpy.re/ffmpeg/ffmpeg-release-4.3.1-64bit-static.tar.xz" | ||
62 | tar xf ffmpeg-release-4.3.1-64bit-static.tar.xz | ||
63 | mkdir -p $HOME/bin | ||
64 | cp ffmpeg-*/{ffmpeg,ffprobe} $HOME/bin | ||
65 | echo "$HOME/bin" >> $GITHUB_PATH | ||
66 | |||
67 | - name: Cache Node.js modules | ||
68 | uses: actions/cache@v2 | ||
69 | with: | ||
70 | path: | | ||
71 | **/node_modules | ||
72 | key: ${{ runner.OS }}-node-${{ hashFiles('**/yarn.lock') }} | ||
73 | restore-keys: | | ||
74 | ${{ runner.OS }}-node- | ||
75 | ${{ runner.OS }}- | ||
76 | 58 | ||
77 | - name: Cache fixtures | 59 | - name: Cache fixtures |
78 | uses: actions/cache@v2 | 60 | uses: actions/cache@v2 |
@@ -85,9 +67,6 @@ jobs: | |||
85 | ${{ runner.OS }}-fixtures- | 67 | ${{ runner.OS }}-fixtures- |
86 | ${{ runner.OS }}- | 68 | ${{ runner.OS }}- |
87 | 69 | ||
88 | - name: Install dependencies | ||
89 | run: yarn install --frozen-lockfile | ||
90 | |||
91 | - name: Set env test variable (schedule) | 70 | - name: Set env test variable (schedule) |
92 | if: github.event_name != 'schedule' | 71 | if: github.event_name != 'schedule' |
93 | run: | | 72 | run: | |
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 66c6df761..000000000 --- a/.gitlab-ci.yml +++ /dev/null | |||
@@ -1,40 +0,0 @@ | |||
1 | image: chocobozzz/peertube-ci:14 | ||
2 | |||
3 | stages: | ||
4 | - clients | ||
5 | - docker-nightly | ||
6 | |||
7 | cache: | ||
8 | key: yarn | ||
9 | paths: | ||
10 | - .yarn-cache | ||
11 | - cached-fixtures | ||
12 | |||
13 | # build-openapi-clients: | ||
14 | # stage: clients | ||
15 | # only: | ||
16 | # refs: | ||
17 | # - master | ||
18 | # - schedules | ||
19 | # changes: | ||
20 | # - support/doc/api/openapi.yaml | ||
21 | # script: | ||
22 | # - apt-get update -qq | ||
23 | # - apt-get -yqqq install openjdk-8-jre | ||
24 | # - yarn install --pure-lockfile | ||
25 | # - scripts/openapi-peertube-version.sh | ||
26 | # - scripts/openapi-clients.sh | ||
27 | |||
28 | build-nightly: | ||
29 | stage: docker-nightly | ||
30 | only: | ||
31 | - schedules | ||
32 | script: | ||
33 | - yarn install --pure-lockfile --cache-folder .yarn-cache | ||
34 | - npm run nightly | ||
35 | - mkdir "${HOME}/.ssh" | ||
36 | - chmod 700 "${HOME}/.ssh" | ||
37 | - if [ ! -z ${DEPLOYEMENT_KNOWN_HOSTS+x} ]; then echo -e "${DEPLOYEMENT_KNOWN_HOSTS}" > ${HOME}/.ssh/known_hosts; fi | ||
38 | - eval `ssh-agent -s` | ||
39 | - if [ ! -z ${DEPLOYEMENT_KEY+x} ]; then ssh-add <(echo "${DEPLOYEMENT_KEY}"); fi | ||
40 | - if [ ! -z ${DEPLOYEMENT_KEY+x} ]; then scp ./peertube-nightly-* ${DEPLOYEMENT_USER}@${DEPLOYEMENT_HOST}:../../web/nightly; fi | ||
diff --git a/support/doc/development/ci.md b/support/doc/development/ci.md new file mode 100644 index 000000000..7d6eef197 --- /dev/null +++ b/support/doc/development/ci.md | |||
@@ -0,0 +1,40 @@ | |||
1 | # Continuous integration | ||
2 | |||
3 | PeerTube uses Github Actions as a CI platform. | ||
4 | CI tasks are described in `.github/workflows`. | ||
5 | |||
6 | ## benchmark.yml | ||
7 | |||
8 | *Scheduled* | ||
9 | |||
10 | Run various benchmarks (build, API etc) and upload results on https://builds.joinpeertube.org/peertube-stats/ to be publicly consumed. | ||
11 | |||
12 | ## codeql.yml | ||
13 | |||
14 | *Scheduled, on push on develop and on pull request* | ||
15 | |||
16 | Run CodeQL task to throw code security issues in Github. https://lgtm.com/projects/g/Chocobozzz/PeerTube can also be used. | ||
17 | |||
18 | ## docker.yml | ||
19 | |||
20 | *Scheduled and on push on master* | ||
21 | |||
22 | Build `chocobozzz/peertube-webserver:latest`, `chocobozzz/peertube:production-...`, `chocobozzz/peertube:v-...` (only latest PeerTube tag) and `chocobozzz/peertube:develop-...` Docker images. Scheduled to automatically upgrade image software (Debian security issues etc). | ||
23 | |||
24 | ## nightly.yml | ||
25 | |||
26 | *Scheduled* | ||
27 | |||
28 | Build PeerTube nightly build (`develop` branch) and upload the release on https://builds.joinpeertube.org/nightly. | ||
29 | |||
30 | ## stats.yml | ||
31 | |||
32 | *On push on develop* | ||
33 | |||
34 | Create various PeerTube stats (line of codes, build size, lighthouse report) and upload results on https://builds.joinpeertube.org/peertube-stats/ to be publicly consumed. | ||
35 | |||
36 | ## test.yml | ||
37 | |||
38 | *Scheduled, on push and pull request* | ||
39 | |||
40 | Run PeerTube lint and tests. | ||