Skip to content

Add base for metric tests #38

Add base for metric tests

Add base for metric tests #38

Workflow file for this run

name: CI
on:
pull_request:
paths:
- "src/**"
- "!src/site/**"
jobs:
gen-matrix:
name: Find recipes to test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get changed files
id: diff
uses: tj-actions/changed-files@v43
with:
json: true
dir_names: true
dir_names_exclude_current_dir: true
- name: List all changed files
run: echo '${{ steps.diff.outputs.all_changed_files }}'
- name: Generate testing matrix for modified recipes
uses: actions/github-script@v7
id: generator
with:
script: |
const script = require('.github/scripts/find-recipes-to-test.js')
return script(
'${{ steps.diff.outputs.all_changed_files }}'
);
outputs:
matrix: ${{ steps.generator.outputs.result }}
matrix-job:
name: Build and Test
runs-on: ubuntu-latest
needs: gen-matrix
strategy:
fail-fast: false
max-parallel: 4
matrix:
file: ${{ fromJson(needs.gen-matrix.outputs.matrix) }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: "1.22.1"
- name: Start compose file
working-directory: ${{ matrix.file }}
run: |
docker-compose up -d --build
- name: Run tests
working-directory: ${{ matrix.file }}/test
run: go test -v