Skip to content

add permissions restriction to github workflows #81

add permissions restriction to github workflows

add permissions restriction to github workflows #81

Workflow file for this run

name: Build & Test
on: [pull_request, push]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build builder image
run: |
builder/build_docker_image
- name: Build svr-info
run: |
builder/build
- name: Upload build
uses: actions/upload-artifact@v3
with:
name: svr-info
path: dist/svr-info*.tgz
- name: Upload oss package
uses: actions/upload-artifact@v3
with:
name: oss_source
path: dist/oss_source.tgz
test:
needs: [build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: download svr-info
uses: actions/download-artifact@v3
with:
name: svr-info
- name: install jq
run: sudo apt-get install -y jq
- name: run test
run: |
tar -xf svr-info*
cd svr-info
# exercise as many options as possible
mkdir extras
cp ../.github/mock_mlc extras/mlc
mkdir output
mkdir temp
mkdir targettemp
./svr-info -temp temp -targettemp targettemp -output output -benchmark all -profile all -profile_duration 5 -profile_interval 1 -analyze all -analyze_duration 5 -analyze_frequency 5 -format all -megadata -cmd_timeout 30
# verify that the megadata directory exists
if [ ! -d output/*_megadata ]; then
echo "FAIL -- megadata directory was not created in output"
exit 1
fi
# verify that mock_mlc was run by svr-info
if [ "$( jq --raw-output '.Performance.Summary[0]."Memory Minimum Latency"' output/*.json )" != "105.5 ns" ]; then
echo "FAIL -- Memory Minimum Latency != 105.5 ns"
exit 1
fi
# TODO: add more tests here
- name: upload report
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.runner }} report
path: svr-info/output/