Skip to content

Commit

Permalink
Adding golden file test workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
merschformann committed Mar 5, 2024
1 parent f0dc353 commit 5b3b806
Show file tree
Hide file tree
Showing 2 changed files with 117 additions and 0 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/golden.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: golden
on: [push, workflow_dispatch]
jobs:
create-matrix:
runs-on: ubuntu-latest
outputs:
apps: ${{ steps.apps.outputs.matrix }}
steps:
- name: git clone
uses: actions/checkout@v4
- id: apps
run: |
export MATRIX=$(yq -o json '.' workflow-configuration.yml | jq -c '{"apps": .apps}')
echo "matrix=${MATRIX}" >> $GITHUB_OUTPUT
echo "This is the matrix" >> $GITHUB_STEP_SUMMARY
echo $MATRIX | jq . >> $GITHUB_STEP_SUMMARY
working-directory: .nextmv/golden

golden-file-test:
runs-on: ubuntu-latest
needs: create-matrix
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.create-matrix.outputs.apps) }}
steps:
- name: git clone
uses: actions/checkout@v4

- uses: dorny/paths-filter@v3
id: changes
with:
filters: |
src:
- '.nextmv/golden/${{ matrix.apps.name }}/**'
- '${{ matrix.apps.name }}/**'
- name: Set up Python
if: ${{ matrix.apps.language == 'python' }} && steps.changes.outputs.src == 'true'
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: "pip"

- name: Install Python dependencies
if: ${{ matrix.apps.language == 'python' }} && steps.changes.outputs.src == 'true'
run: |
pip install -r ${{ matrix.apps.name }}/requirements.txt
- name: Set up Go
if: ${{ matrix.apps.language == 'go' }} && steps.changes.outputs.src == 'true'
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}

- name: Set up Java
if: ${{ matrix.apps.language == 'java' }} && steps.changes.outputs.src == 'true'
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.apps.language-version }}
distribution: ${{ matrix.apps.distribution }}

- name: Run tests
if: steps.changes.outputs.src == 'true'
run: |
echo "Running tests for ${{ matrix.apps.name }}"
go test -v ./...
working-directory: .nextmv/golden/${{ matrix.apps.name }}
50 changes: 50 additions & 0 deletions .nextmv/golden/workflow-configuration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
apps:
- name: cost-flow-ortools
language: python
language-version: 3.11
- name: knapsack-ampl
language: python
language-version: 3.11
- name: knapsack-gosdk
language: go
language-version: 1.22
- name: knapsack-gurobi
language: python
language-version: 3.11
- name: knapsack-java-ortools
language: java
language-version: 21
distribution: temurin
- name: knapsack-ortools
language: python
language-version: 3.11
- name: knapsack-pyomo
language: python
language-version: 3.11
- name: nextroute
language: go
language-version: 1.22
- name: order-fulfillment-gosdk
language: go
language-version: 1.22
- name: routing-ortools
language: python
language-version: 3.11
- name: shift-assignment-ortools
language: python
language-version: 3.11
- name: shift-assignment-pyomo
language: python
language-version: 3.11
- name: shift-planning-ortools
language: python
language-version: 3.11
- name: shift-planning-pyomo
language: python
language-version: 3.11
- name: shift-scheduling-gosdk
language: go
language-version: 1.22
- name: xpress
language: python
language-version: 3.11

0 comments on commit 5b3b806

Please sign in to comment.