--- /dev/null
+name: "Reusable deploy on builds.joinpeertube.org"
+
+description: "Reusable deploy on builds.joinpeertube.org"
+
+inputs:
+ source:
+ required: true
+ description: "Source file/files/directory/directories to deploy"
+ destination:
+ required: true
+ description: "Destination directory on builds.joinpeertube.org"
+ knownHosts:
+ required: true
+ description: "Known hosts"
+ deployKey:
+ required: true
+ description: "Deploy key"
+ deployUser:
+ required: true
+ description: "Deploy user"
+ deployHost:
+ required: true
+ description: "Deploy host"
+
+
+runs:
+ using: "composite"
+
+ steps:
+ - name: "Deploy"
+ shell: bash
+ run: |
+ mkdir -p ~/.ssh
+ chmod 700 ~/.ssh
+
+ echo "Adding ssh key to known hosts"
+ echo -e "${{ inputs.knownHosts }}" > ~/.ssh/known_hosts;
+
+ eval `ssh-agent -s`
+
+ echo "Adding ssh deploy key"
+ ssh-add <(echo "${{ inputs.deployKey }}");
+
+ echo "Uploading files"
+
+ scp ${{ inputs.source }} ${{ inputs.deployUser }}@${{ inputs.deployHost }}:../../web/${{ inputs.destination }};
--- /dev/null
+name: "Reusable prepare PeerTube build"
+
+description: "Reusable prepare PeerTube build"
+
+inputs:
+ node-version:
+ required: true
+ description: 'NodeJS version'
+
+runs:
+ using: "composite"
+
+ steps:
+ - name: Use Node.js
+ uses: actions/setup-node@v1
+ with:
+ node-version: ${{ inputs.node-version }}
+
+ - name: Cache Node.js modules
+ uses: actions/cache@v2
+ with:
+ path: |
+ **/node_modules
+ key: ${{ runner.OS }}-node-${{ hashFiles('**/yarn.lock') }}
+ restore-keys: |
+ ${{ runner.OS }}-node-
+ ${{ runner.OS }}-
+
+ - name: Install dependencies
+ shell: bash
+ run: yarn install --frozen-lockfile
--- /dev/null
+name: "Reusable prepare PeerTube run"
+description: "Reusable prepare PeerTube run"
+
+runs:
+ using: "composite"
+
+ steps:
+ - name: Setup system dependencies
+ shell: bash
+ run: |
+ sudo apt-get install postgresql-client-common redis-tools parallel
+ wget --quiet --no-check-certificate "https://download.cpy.re/ffmpeg/ffmpeg-release-4.3.1-64bit-static.tar.xz"
+ tar xf ffmpeg-release-4.3.1-64bit-static.tar.xz
+ mkdir -p $HOME/bin
+ cp ffmpeg-*/{ffmpeg,ffprobe} $HOME/bin
+ echo "$HOME/bin" >> $GITHUB_PATH
env:
PGUSER: peertube
PGHOST: localhost
- NODE_PENDING_JOB_WAIT: 500
steps:
- uses: actions/checkout@v2
- - name: Use Node.js
- uses: actions/setup-node@v1
+ - uses: './.github/actions/reusable-prepare-peertube-build'
with:
node-version: '12.x'
- - name: Setup system dependencies
- run: |
- sudo apt-get install postgresql-client-common redis-tools parallel
- wget --quiet --no-check-certificate "https://download.cpy.re/ffmpeg/ffmpeg-release-4.3.1-64bit-static.tar.xz"
- tar xf ffmpeg-release-4.3.1-64bit-static.tar.xz
- mkdir -p $HOME/bin
- cp ffmpeg-*/{ffmpeg,ffprobe} $HOME/bin
- echo "$HOME/bin" >> $GITHUB_PATH
-
- - name: Cache Node.js modules
- uses: actions/cache@v2
- with:
- path: |
- **/node_modules
- key: ${{ runner.OS }}-node-${{ hashFiles('**/yarn.lock') }}
- restore-keys: |
- ${{ runner.OS }}-node-
- ${{ runner.OS }}-
-
- - name: Cache fixtures
- uses: actions/cache@v2
- with:
- path: |
- fixtures
- key: ${{ runner.OS }}-fixtures-${{ matrix.test_suite }}-${{ hashFiles('fixtures/*') }}
- restore-keys: |
- ${{ runner.OS }}-fixtures-${{ matrix.test_suite }}-
- ${{ runner.OS }}-fixtures-
- ${{ runner.OS }}-
-
- - name: Install dependencies
- run: yarn install --frozen-lockfile
+ - uses: './.github/actions/reusable-prepare-peertube-run'
- name: Build
run: |
cat benchmark.json build-time.json startup-time.json
- name: Upload benchmark result
- env:
- STATS_DEPLOYEMENT_KNOWN_HOSTS: ${{ secrets.STATS_DEPLOYEMENT_KNOWN_HOSTS }}
- STATS_DEPLOYEMENT_KEY: ${{ secrets.STATS_DEPLOYEMENT_KEY }}
- STATS_DEPLOYEMENT_USER: ${{ secrets.STATS_DEPLOYEMENT_USER }}
- STATS_DEPLOYEMENT_HOST: ${{ secrets.STATS_DEPLOYEMENT_HOST }}
- run: |
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- if [ ! -z ${STATS_DEPLOYEMENT_KNOWN_HOSTS+x} ]; then
- echo "Adding ssh key to known hosts"
- echo -e "${STATS_DEPLOYEMENT_KNOWN_HOSTS}" > ~/.ssh/known_hosts;
- fi
-
- eval `ssh-agent -s`
-
- if [ ! -z ${STATS_DEPLOYEMENT_KEY+x} ]; then
- echo "Adding ssh reployement key"
- ssh-add <(echo "${STATS_DEPLOYEMENT_KEY}");
- fi
-
- if [ ! -z ${STATS_DEPLOYEMENT_KEY+x} ]; then
- echo "Uploading files"
- scp benchmark.json build-time.json startup-time.json ${STATS_DEPLOYEMENT_USER}@${STATS_DEPLOYEMENT_HOST}:../../web/peertube-stats;
- fi
+ uses: './.github/actions/reusable-deploy.yml'
+ with:
+ source: benchmark.json build-time.json startup-time.json
+ destination: peertube-stats
+ knownHosts: ${{ secrets.STATS_DEPLOYEMENT_KNOWN_HOSTS }}
+ deployKey: ${{ secrets.STATS_DEPLOYEMENT_KEY }}
+ deployUser: ${{ secrets.STATS_DEPLOYEMENT_USER }}
+ deployHost: ${{ secrets.STATS_DEPLOYEMENT_HOST }}
on:
push:
- branches: [ next ]
+ branches: [ develop, next ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ next ]
--- /dev/null
+name: Nightly
+
+on:
+ push:
+ branches:
+ - 'next'
+ schedule:
+ - cron: '0 3 * * *'
+
+jobs:
+
+ nightly:
+ runs-on: ubuntu-latest
+
+ steps:
+ -
+ name: Checkout develop
+ uses: actions/checkout@v2
+ with:
+ ref: next
+
+ - uses: './.github/actions/reusable-prepare-peertube-build'
+ with:
+ node-version: '14.x'
+
+ - name: Build
+ run: npm run nightly
+
+ - uses: './.github/actions/reusable-deploy'
+ with:
+ source: ./peertube-nightly-*
+ destination: nightly-test
+ knownHosts: ${{ secrets.STATS_DEPLOYEMENT_KNOWN_HOSTS }}
+ deployKey: ${{ secrets.STATS_DEPLOYEMENT_KEY }}
+ deployUser: ${{ secrets.STATS_DEPLOYEMENT_USER }}
+ deployHost: ${{ secrets.STATS_DEPLOYEMENT_HOST }}
steps:
- uses: actions/checkout@v2
- - name: Use Node.js
- uses: actions/setup-node@v1
+ - uses: './.github/actions/reusable-prepare-peertube-build'
with:
node-version: '14.x'
- - name: Cache Node.js modules
- uses: actions/cache@v2
- with:
- path: |
- **/node_modules
- key: ${{ runner.OS }}-node-${{ hashFiles('**/yarn.lock') }}
- restore-keys: |
- ${{ runner.OS }}-node-
- ${{ runner.OS }}-
-
- - name: Install dependencies
- run: yarn install --frozen-lockfile
-
- name: Angular bundlewatch
uses: jackyef/bundlewatch-gh-action@master
with:
- name: Upload stats
if: github.event_name != 'pull_request'
- env:
- STATS_DEPLOYEMENT_KNOWN_HOSTS: ${{ secrets.STATS_DEPLOYEMENT_KNOWN_HOSTS }}
- STATS_DEPLOYEMENT_KEY: ${{ secrets.STATS_DEPLOYEMENT_KEY }}
- STATS_DEPLOYEMENT_USER: ${{ secrets.STATS_DEPLOYEMENT_USER }}
- STATS_DEPLOYEMENT_HOST: ${{ secrets.STATS_DEPLOYEMENT_HOST }}
- run: |
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- if [ ! -z ${STATS_DEPLOYEMENT_KNOWN_HOSTS+x} ]; then
- echo "Adding ssh key to known hosts"
- echo -e "${STATS_DEPLOYEMENT_KNOWN_HOSTS}" > ~/.ssh/known_hosts;
- fi
-
- eval `ssh-agent -s`
-
- if [ ! -z ${STATS_DEPLOYEMENT_KEY+x} ]; then
- echo "Adding ssh reployement key"
- ssh-add <(echo "${STATS_DEPLOYEMENT_KEY}");
- fi
-
- if [ ! -z ${STATS_DEPLOYEMENT_KEY+x} ]; then
- echo "Uploading files"
- scp lighthouse.json client-build-stats.json scc.json ${STATS_DEPLOYEMENT_USER}@${STATS_DEPLOYEMENT_HOST}:../../web/peertube-stats;
- fi
+ uses: './.github/actions/reusable-deploy'
+ with:
+ source: lighthouse.json client-build-stats.json scc.json
+ destination: peertube-stats
+ knownHosts: ${{ secrets.STATS_DEPLOYEMENT_KNOWN_HOSTS }}
+ deployKey: ${{ secrets.STATS_DEPLOYEMENT_KEY }}
+ deployUser: ${{ secrets.STATS_DEPLOYEMENT_USER }}
+ deployHost: ${{ secrets.STATS_DEPLOYEMENT_HOST }}
steps:
- uses: actions/checkout@v2
- - name: Use Node.js
- uses: actions/setup-node@v1
+ - uses: './.github/actions/reusable-prepare-peertube-build'
with:
node-version: '12.x'
- - name: Setup system dependencies
- run: |
- sudo apt-get install postgresql-client-common redis-tools parallel
- wget --quiet --no-check-certificate "https://download.cpy.re/ffmpeg/ffmpeg-release-4.3.1-64bit-static.tar.xz"
- tar xf ffmpeg-release-4.3.1-64bit-static.tar.xz
- mkdir -p $HOME/bin
- cp ffmpeg-*/{ffmpeg,ffprobe} $HOME/bin
- echo "$HOME/bin" >> $GITHUB_PATH
-
- - name: Cache Node.js modules
- uses: actions/cache@v2
- with:
- path: |
- **/node_modules
- key: ${{ runner.OS }}-node-${{ hashFiles('**/yarn.lock') }}
- restore-keys: |
- ${{ runner.OS }}-node-
- ${{ runner.OS }}-
+ - uses: './.github/actions/reusable-prepare-peertube-run'
- name: Cache fixtures
uses: actions/cache@v2
${{ runner.OS }}-fixtures-
${{ runner.OS }}-
- - name: Install dependencies
- run: yarn install --frozen-lockfile
-
- name: Set env test variable (schedule)
if: github.event_name != 'schedule'
run: |
+++ /dev/null
-image: chocobozzz/peertube-ci:14
-
-stages:
- - clients
- - docker-nightly
-
-cache:
- key: yarn
- paths:
- - .yarn-cache
- - cached-fixtures
-
-# build-openapi-clients:
-# stage: clients
-# only:
-# refs:
-# - master
-# - schedules
-# changes:
-# - support/doc/api/openapi.yaml
-# script:
-# - apt-get update -qq
-# - apt-get -yqqq install openjdk-8-jre
-# - yarn install --pure-lockfile
-# - scripts/openapi-peertube-version.sh
-# - scripts/openapi-clients.sh
-
-build-nightly:
- stage: docker-nightly
- only:
- - schedules
- script:
- - yarn install --pure-lockfile --cache-folder .yarn-cache
- - npm run nightly
- - mkdir "${HOME}/.ssh"
- - chmod 700 "${HOME}/.ssh"
- - if [ ! -z ${DEPLOYEMENT_KNOWN_HOSTS+x} ]; then echo -e "${DEPLOYEMENT_KNOWN_HOSTS}" > ${HOME}/.ssh/known_hosts; fi
- - eval `ssh-agent -s`
- - if [ ! -z ${DEPLOYEMENT_KEY+x} ]; then ssh-add <(echo "${DEPLOYEMENT_KEY}"); fi
- - if [ ! -z ${DEPLOYEMENT_KEY+x} ]; then scp ./peertube-nightly-* ${DEPLOYEMENT_USER}@${DEPLOYEMENT_HOST}:../../web/nightly; fi
--- /dev/null
+# Continuous integration
+
+PeerTube uses Github Actions as a CI platform.
+CI tasks are described in `.github/workflows`.
+
+## benchmark.yml
+
+*Scheduled*
+
+Run various benchmarks (build, API etc) and upload results on https://builds.joinpeertube.org/peertube-stats/ to be publicly consumed.
+
+## codeql.yml
+
+*Scheduled, on push on develop and on pull request*
+
+Run CodeQL task to throw code security issues in Github. https://lgtm.com/projects/g/Chocobozzz/PeerTube can also be used.
+
+## docker.yml
+
+*Scheduled and on push on master*
+
+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).
+
+## nightly.yml
+
+*Scheduled*
+
+Build PeerTube nightly build (`develop` branch) and upload the release on https://builds.joinpeertube.org/nightly.
+
+## stats.yml
+
+*On push on develop*
+
+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.
+
+## test.yml
+
+*Scheduled, on push and pull request*
+
+Run PeerTube lint and tests.