Skip to content

Commit

Permalink
Pull request workflow
Browse files Browse the repository at this point in the history
Runs tests and ensures code can compile

Fixes #5
  • Loading branch information
andrew-codes committed Nov 18, 2023
1 parent edac838 commit d2cfc4f
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/pull-request-master.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: "Test"

on:
pull_request:
branches:
- main

jobs:
run_tests:
name: Verify PR - Tests
runs-on: self-hosted
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Read .nvmrc
run: echo "##[set-output name=NODE_VERSION;]$(cat package.json | jq .engines.node | sed -e 's/"//g' | sed -e 's/>=//g')"
id: nvm
- name: Save version
run: echo "latest" > version
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: "${{ steps.nvm.outputs.NODE_VERSION }}"
- name: Install deps
run: yarn
- name: Prepare
run: yarn nx run-many --target=prepare --parallel --all
env:
ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }}
ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }}
ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }}
- name: Run all unit tests
run: yarn nx run-many --target=test/unit --all --parallel

build:
name: Verify PR - Buildable
runs-on: self-hosted
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Read .nvmrc
run: echo "##[set-output name=NODE_VERSION;]$(cat package.json | jq .engines.node | sed -e 's/"//g' | sed -e 's/>=//g')"
id: nvm
- name: Save version
run: echo "latest" > version
- name: Use Node.js (.nvmrc)
uses: actions/setup-node@v3
with:
node-version: "${{ steps.nvm.outputs.NODE_VERSION }}"
- name: Install deps
run: yarn
- name: Prepare
run: yarn nx run-many --target=prepare --parallel --all
env:
ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }}
ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }}
ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }}
- name: Compile affected apps
run: yarn nx affected --target=compile --parallel --base=HEAD~ --head=HEAD --verbose
env:
ONEPASSWORD_TOKEN: ${{ secrets.ONEPASSWORD_TOKEN }}
ONEPASSWORD_SERVER_URL: ${{ secrets.ONEPASSWORD_SERVER_URL }}
ONEPASSWORD_VAULT_ID: ${{ secrets.ONEPASSWORD_VAULT_ID }}
NODE_ENV: production
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
"name": "playnite-web",
"packageManager": "yarn@4.0.2",
"private": true,
"engines": {
"node": ">=20.9.0",
"yarn": ">=4.0.0"
},
"workspaces": [
"apps/*",
"libs/**/*"
Expand Down

0 comments on commit d2cfc4f

Please sign in to comment.