Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 91 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# DSpace Continuous Integration/Build via GitHub Actions
# Concepts borrowed from
# https://docs.github.com/en/free-pro-team@latest/actions/guides/building-and-testing-nodejs
name: Build

# Run this Build only for pushes / PRs to main branch
on:
push:
branches: main
pull_request:
branches: main

jobs:
tests:
runs-on: ubuntu-latest
env:
# The ci step will test the dspace-angular code against DSpace REST.
# Direct that step to utilize a DSpace REST service that has been started in docker.
DSPACE_REST_HOST: localhost
DSPACE_REST_PORT: 8080
DSPACE_REST_NAMESPACE: '/server'
DSPACE_REST_SSL: false
strategy:
# Create a matrix of Node versions to test against (in parallel)
matrix:
node-version: [10.x, 12.x]
# Do NOT exit immediately if one matrix job fails
fail-fast: false
# These are the actual CI steps to perform per job
steps:
# https://github.com/actions/checkout
- name: Checkout codebase
uses: actions/checkout@v1

# https://github.com/actions/setup-node
- name: Install Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Install latest Chrome (for e2e tests)
run: |
sudo apt-get update
sudo apt-get --only-upgrade install google-chrome-stable -y
google-chrome --version

# https://github.com/actions/cache/blob/main/examples.md#node---yarn
- name: Get Yarn cache directory
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache Yarn dependencies
uses: actions/cache@v2
with:
# Cache entire Yarn cache directory (see previous step)
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
# Cache key is hash of yarn.lock. Therefore changes to yarn.lock will invalidate cache
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.os }}-yarn-

- name: Install Yarn dependencies
run: yarn install --frozen-lockfile

- name: Run lint
run: yarn run lint

- name: Run build
run: yarn run build:prod

- name: Run specs (unit tests)
run: yarn run test:headless

# Using docker-compose start backend using CI configuration
# and load assetstore from a cached copy
- name: Start DSpace REST Backend via Docker (for e2e tests)
run: |
docker-compose -f ./docker/docker-compose-ci.yml up -d
docker-compose -f ./docker/cli.yml -f ./docker/cli.assetstore.yml run --rm dspace-cli
docker container ls

- name: Run e2e tests (integration tests)
run: yarn run e2e:ci

- name: Shutdown Docker containers
run: docker-compose -f ./docker/docker-compose-ci.yml down

# NOTE: Angular CLI only supports code coverage for specs. See https://github.com/angular/angular-cli/issues/6286
# Upload coverage reports to Codecov (for Node v12 only)
# https://github.com/codecov/codecov-action
- name: Upload coverage to Codecov.io
uses: codecov/codecov-action@v1
if: matrix.node-version == '12.x'
66 changes: 0 additions & 66 deletions .travis.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Docker Compose for running the DSpace backend for e2e testing in CI
networks:
dspacenet:
services:
Expand Down