Skip to content

Commit

Permalink
Attempt to simplify action
Browse files Browse the repository at this point in the history
  • Loading branch information
kraenhansen committed Jan 16, 2024
1 parent 20056cf commit 36bac27
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 31 deletions.
66 changes: 35 additions & 31 deletions .github/actions/baas-test-server/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,36 +9,40 @@ inputs:
default: master
githash:
description: Specific githash to use when starting the server (this is used instead of branch if provided)
outputs:
container-id:
description: The id of the container created
value: ${{ steps.baasaas-start.outputs.container-id }}
baas-url:
description: The url of the BaaS server created
value: ${{ steps.baasaas-start.outputs.baas-url }}
mongo-url:
description: The url of the MongoDB instance backing the server created
value: ${{ steps.baasaas-start.outputs.mongo-url }}
# outputs:
# container-id:
# description: The id of the container created
# value: ${{ steps.baasaas-start.outputs.container-id }}
# baas-url:
# description: The url of the BaaS server created
# value: ${{ steps.baasaas-start.outputs.baas-url }}
# mongo-url:
# description: The url of the MongoDB instance backing the server created
# value: ${{ steps.baasaas-start.outputs.mongo-url }}

runs:
using: composite
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20
cache: npm
- shell: bash
run: npm ci --ignore-scripts
- shell: bash
run: npx baas-test-server baasaas start ${{ inputs.githash }} --branch ${{ inputs.branch }}
id: baasaas-start
env:
BAASAAS_KEY: ${{ inputs.baasaas-key }}
# Using another action to create a post step, since "composite" actions doesn't support those
# See https://github.com/actions/runner/issues/1478
- name: Stop server
uses: TLizer/action-with-post-step@v1
with:
main: echo 'Nothing to do right now'
post: npx baas-test-server baasaas stop ${{ steps.baasaas-start.outputs.container-id }}
using: node20
main: start-server.js
# runs:
# using: composite
# steps:
# - uses: actions/checkout@v3
# - uses: actions/setup-node@v3
# with:
# node-version: 20
# cache: npm
# - shell: bash
# run: npm ci --ignore-scripts
# - shell: bash
# run: npx baas-test-server baasaas start ${{ inputs.githash }} --branch ${{ inputs.branch }}
# id: baasaas-start
# env:
# BAASAAS_KEY: ${{ inputs.baasaas-key }}
# # Using another action to create a post step, since "composite" actions doesn't support those
# # See https://github.com/actions/runner/issues/1478
# - name: Stop server
# uses: TLizer/action-with-post-step@v1
# with:
# main: echo 'Nothing to do right now'
# post: npx baas-test-server baasaas start ${{ inputs.githash }} --branch ${{ inputs.branch }}

6 changes: 6 additions & 0 deletions .github/actions/baas-test-server/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "@realm/baas-test-server-action",
"type": "module",
"version": "0.1.0",
"private": true
}
3 changes: 3 additions & 0 deletions .github/actions/baas-test-server/start-server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import cp from "child_process";

cp.execSync("ls");

0 comments on commit 36bac27

Please sign in to comment.