Skip to content
This repository has been archived by the owner on Mar 7, 2022. It is now read-only.

Commit

Permalink
Merge pull request #4 from mazgi/setup-github-actions
Browse files Browse the repository at this point in the history
Set up GitHub Actions
  • Loading branch information
mazgi authored Feb 5, 2020
2 parents 9716333 + 4a53b16 commit 135e59b
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 2 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/build-production-images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: build-production-images

on:
push:
branches:
- master
tags:
- v*

jobs:
prepare:
runs-on: ubuntu-latest
env:
CARGO_MAKE_VERSION: 0.26.1
steps:
- name: Download cargo-make
run: |
curl -o /tmp/cargo-make.zip -sL https://github.com/sagiegurari/cargo-make/releases/download/${CARGO_MAKE_VERSION}/cargo-make-v${CARGO_MAKE_VERSION}-x86_64-unknown-linux-musl.zip
unzip /tmp/cargo-make.zip cargo-make-v${CARGO_MAKE_VERSION}-x86_64-unknown-linux-musl/cargo-make -d /tmp/
mv /tmp/cargo-make-v${CARGO_MAKE_VERSION}-x86_64-unknown-linux-musl/cargo-make /tmp/
- name: Save downloaded binary as an artifact
uses: actions/upload-artifact@v1
with:
name: cargo-make-bin
path: /tmp/cargo-make
build:
needs: prepare
runs-on: ubuntu-latest
strategy:
matrix:
service: [bff, frontend]
steps:
- uses: actions/checkout@v2
- name: Get cargo-make binary
uses: actions/download-artifact@v1
with:
name: cargo-make-bin
path: bin/
# See:
# - https://github.com/actions/upload-artifact/issues/38
# - https://github.com/actions/download-artifact/issues/14
- name: Restore the permissions
run: chmod +x bin/cargo-make
- name: make
run: bin/cargo-make make --makefile tasks/build-production-images.toml ${{ matrix.service }}
23 changes: 23 additions & 0 deletions .github/workflows/test-all.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: test-all-services

on:
push:

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
service: [bff, frontend]
node-version: [12.x]
env:
working-directory: ${{ matrix.service }}
steps:
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- uses: actions/checkout@v2
- run: npm install
working-directory: ${{ matrix.service }}
- run: npm run test:coverage
working-directory: ${{ matrix.service }}
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# console

![GitHub Actions status for "test-all-services"](https://github.com/mazgi/console/workflows/test-all-services/badge.svg)

## How to run

### Download cargo-make
Expand Down
2 changes: 1 addition & 1 deletion bff/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"typeorm": "ts-node -r tsconfig-paths/register ./node_modules/typeorm/cli.js",
"lint": "eslint \"src/**\"",
"test": "jest",
"coverage": "jest --coverage",
"test:coverage": "jest --coverage",
"build": "webpack",
"build:debug": "webpack --mode development",
"start": "node dist/main.js",
Expand Down
7 changes: 7 additions & 0 deletions frontend/__mocks__/next/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// This mock function is important when using Jest with Next.js.
// See https://spectrum.chat/next-js/general/how-to-setup-jest-tests-to-use-publicruntimeconfig~27f8cee1-d4a4-4b68-bb62-ea6562a77544
export default (): {} => ({
env: {},
publicRuntimeConfig: {},
serverRuntimeConfig: {}
})
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"dev": "next",
"lint": "eslint \"src/**\"",
"test": "jest",
"coverage": "jest --coverage",
"test:coverage": "jest --coverage",
"build": "next build",
"start": "next start"
},
Expand Down

0 comments on commit 135e59b

Please sign in to comment.