Files
CommunitySolidServer/.github/workflows/ci.yml
Thomas 65d1eeb0a2 chore: Build and push official docker image in CI
* docker job added to ci.yml

* removed temporary manual build stuff

* updated readme for new docker image

* updated changelog

* Revert "updated changelog"

This reverts commit 20d99a2e27.

Co-authored-by: Thomas Dupont <thomas.dupont@intec.ugent.be>
2022-01-21 11:00:48 +01:00

216 lines
5.5 KiB
YAML

name: CI
on:
push:
branches:
- 'main'
- 'versions/*'
tags:
- 'v*'
pull_request:
branches:
- '**'
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '16.x'
- run: npm ci --ignore-scripts
- run: npm run lint
validate-components:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '16.x'
- run: npm ci
- run: npm run validate
test-unit:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system:
- ubuntu-latest
- windows-latest
node-version:
- '12.17'
- '12.x'
- '14.2'
- '14.x'
- '16.0'
- '16.x'
- '17.x'
timeout-minutes: 10
steps:
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Ensure line endings are consistent
run: git config --global core.autocrlf input
- name: Check out repository
uses: actions/checkout@v2
- name: Install dependencies and run build scripts
run: npm ci
- name: Type-check tests
run: npm run test:ts
- name: Run unit tests
run: npm run test:unit
- name: Submit unit test coverage
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.github_token }}
flag-name: test-unit-${{ matrix.node-version }}-${{ matrix.operating-system }}
parallel: true
- name: Run deployment tests
run: npm run test:deploy
test-integration:
runs-on: ubuntu-latest
strategy:
matrix:
node-version:
- '12.x'
- '14.x'
- '16.x'
env:
TEST_DOCKER: true
services:
sparql-endpoint:
image: tenforce/virtuoso
env:
SPARQL_UPDATE: true
ports:
- 4000:8890
redis:
image: redis
ports:
- 6379:6379
timeout-minutes: 10
steps:
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Check out repository
uses: actions/checkout@v2
- name: Install dependencies and run build scripts
run: npm ci
- name: Run integration tests
run: npm run test:integration
test-integration-windows:
runs-on: windows-latest
strategy:
matrix:
node-version:
- '12.x'
- '14.x'
- '16.x'
timeout-minutes: 10
steps:
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Ensure line endings are consistent
run: git config --global core.autocrlf input
- name: Check out repository
uses: actions/checkout@v2
- name: Install dependencies and run build scripts
run: npm ci
- name: Run integration tests
run: npm run test:integration
coveralls:
needs: test-unit
runs-on: ubuntu-latest
steps:
- name: Consolidate test coverage from different jobs
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.github_token }}
parallel-finished: true
docker:
needs:
- lint
- test-unit
- test-integration
- test-integration-windows
- validate-components
# Only run on tags starting with v prefix for now -- extra push need for triggering CI again
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: |
solidproject/community-server
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
github-token: ${{ secrets.github_token }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '16.x'
- run: npm ci --ignore-scripts
- run: npm run docs
- name: Save docs
uses: actions/upload-artifact@v2
with:
name: docs
path: docs
retention-days: 1
publish-docs:
needs:
- docs
- lint
- test-unit
- test-integration
- validate-components
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/download-artifact@v2
with:
name: docs
path: docs
- uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: .