111 lines
3.1 KiB
YAML
111 lines
3.1 KiB
YAML
name: "Test on main branch push"
|
|
|
|
# These jobs can be tested with nektos/act tool
|
|
# https://github.com/nektos/act
|
|
#
|
|
# Look for "!env.ACT" in the DRY_RUN expression below
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- '202[2-9].[39].x'
|
|
|
|
env:
|
|
BUILD_OS: linux
|
|
BUILD_ARCH: amd64
|
|
|
|
GO_VERSION: 1.19
|
|
GOFLAGS: -mod=readonly
|
|
|
|
NODE_VERSION: 16
|
|
|
|
jobs:
|
|
lib-test:
|
|
name: "Library test (${{ matrix.lib }})"
|
|
runs-on: ubuntu-20.04
|
|
strategy:
|
|
matrix:
|
|
lib: [ "js", "vue" ]
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-node@v3
|
|
- uses: actions/cache@v3
|
|
if: ${{ !env.ACT }}
|
|
with:
|
|
path: ~/.npm
|
|
key: ${{ runner.OS }}-node-${{ hashFiles('**/yarn.lock') }}
|
|
restore-keys: ${{ runner.OS }}-node-${{ matrix.lib }}
|
|
- name: "Setup YARN"
|
|
run: npm install -g yarn @vue/cli-service
|
|
- name: "Install dependencies"
|
|
working-directory: lib/${{ matrix.lib }}
|
|
run: yarn install
|
|
- name: "Run all tests"
|
|
working-directory: lib/${{ matrix.lib }}
|
|
run: yarn test:unit
|
|
|
|
client-web-test:
|
|
name: "Web client test (${{ matrix.app }})"
|
|
runs-on: ubuntu-20.04
|
|
strategy:
|
|
matrix: { app: [ admin, compose, discovery, privacy, reporter, one, workflow ] }
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-node@v3
|
|
with: { node-version: "${{ env.NODE_VERSION }}" }
|
|
- name: "Setup YARN"
|
|
working-directory: client/web/${{ matrix.app }}
|
|
run: npm install -g yarn @vue/cli-service
|
|
- name: "Cache"
|
|
uses: actions/cache@v3
|
|
if: ${{ !env.ACT }}
|
|
with:
|
|
path: ~/.npm
|
|
key: ${{ runner.OS }}-node-${{ hashFiles('**/yarn.lock') }}
|
|
restore-keys: ${{ runner.OS }}-node-
|
|
- name: "Dependencies"
|
|
working-directory: client/web/${{ matrix.app }}
|
|
run: make dep
|
|
- name: "Tests"
|
|
working-directory: client/web/${{ matrix.app }}
|
|
run: make test
|
|
|
|
server-test:
|
|
name: "Server tests"
|
|
runs-on: ubuntu-20.04
|
|
env:
|
|
GOFLAGS: -mod=readonly
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-go@v3
|
|
with: { go-version: "${{ env.GO_VERSION }}" }
|
|
- name: "Copy language files"
|
|
working-directory: server/pkg/locale
|
|
run: make src/en
|
|
- name: "Unit"
|
|
working-directory: server
|
|
run: make test.unit
|
|
- name: "Store"
|
|
working-directory: server
|
|
run: make test.store
|
|
- name: "Integration"
|
|
working-directory: server
|
|
run: make test.integration
|
|
|
|
notify:
|
|
if: failure()
|
|
name: "Send matrix testing notification"
|
|
runs-on: ubuntu-20.04
|
|
needs: [ server-test, client-web-test, lib-test ]
|
|
steps:
|
|
- name: "Send message via Matrix on failed tests"
|
|
if: ${{ !env.ACT && failure() }}
|
|
id: matrix-chat-tests-failed
|
|
uses: fadenb/matrix-chat-message@v0.0.6
|
|
with:
|
|
homeserver: ${{ secrets.MATRIX_HOME_SERVER }}
|
|
token: ${{ secrets.MATRIX_ACCESS_TOKEN }}
|
|
channel: ${{ secrets.MATRIX_ROOM_ID }}
|
|
message: |
|
|
# Corteza **${GITHUB_REF##*/}** tests have failed
|