Skip to content

Commit

Permalink
fix: binary test workflow builds binary from context branch (#1526)
Browse files Browse the repository at this point in the history
  • Loading branch information
Matte22 authored Feb 11, 2025
1 parent 189fc23 commit 6cebc21
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 11 deletions.
52 changes: 45 additions & 7 deletions .github/workflows/api-binary-tests.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

name: Test Binary Artifacts
name: Build and Test Linux Binary
on:
workflow_dispatch:
pull_request:
Expand All @@ -9,15 +9,14 @@ on:
- "api/source/**"
- "test/api/**"
- ".github/workflows/api-binary-tests.yml"
- ".github/workflows/build-binary-artifacts.yml"
push:
branches:
- main
paths:
- "api/source/**"
- "test/api/**"
- ".github/workflows/api-binary-tests.yml"
- ".github/workflows/build-binary-artifacts.yml"

env:
STIGMAN_API_PORT: 64001
STIGMAN_DB_HOST: localhost
Expand All @@ -32,9 +31,48 @@ env:
STIGMAN_OIDC_PROVIDER: http://127.0.0.1:8080/auth/realms/stigman
jobs:
build-artifacts:
uses: nuwcdivnpt/stig-manager/.github/workflows/build-binary-artifacts.yml@main
secrets:
STIGMAN_PRIVATE_KEY: ${{ secrets.STIGMAN_PRIVATE_KEY }}
name: Build binary artifacts
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18

- name: Get repository metadata
id: repo
uses: actions/github-script@v7
with:
script: |
const repo = await github.rest.repos.get(context.repo)
return repo.data
- name: install uglify
run: |
sudo npm install -g uglify-js
- name: run build script
id: run-the-build-script
working-directory: ./api
run: ./build.sh

- name: Upload builds
if: always()
uses: actions/upload-artifact@v4
with:
name: binary-artifacts
path: ./api/bin/
if-no-files-found: error

- name: Upload archives
if: always()
uses: actions/upload-artifact@v4
with:
name: binary-archives
path: ./api/dist/
if-no-files-found: error

run-test-linux-binary-artifact:
name: Run and test linux artifact
needs: build-artifacts
Expand Down Expand Up @@ -92,7 +130,7 @@ jobs:
- name: Run tests with coverage and log output
working-directory: ./test/api/
run: |
npm test > ../../binary-artifacts/logs/test-output.log 2>&1
npm test 2>&1 | tee ../../binary-artifacts/logs/test-output.log
- name: Stop linux binary
if: always()
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/build-binary-artifacts.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@

name: Build Binary Artifacts and Sign
on:
workflow_call:
secrets:
STIGMAN_PRIVATE_KEY:
required: true
workflow_dispatch:
push:
branches:
Expand Down

0 comments on commit 6cebc21

Please sign in to comment.