Skip to content

Function CI for gem5 Simulator #329

Function CI for gem5 Simulator

Function CI for gem5 Simulator #329

Workflow file for this run

# MIT License
#
# Copyright (c) 2022 EASE lab, University of Edinburgh
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
# Authors: David Schall
name: Function CI for gem5 Simulator
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
schedule:
- cron: "0 7 * * 1"
push:
branches: [main]
paths:
- "test/**"
- "gem5utils/**"
pull_request:
branches: [main]
paths:
- "test/**"
- "gem5utils/**"
env:
WORKING_DIR: wkdir/test/
MAKEFILE: test/Makefile
ARTIFACTS_DIR: artifacts/
KERNEL: artifacts/kernel
DISK: artifacts/disk-image.qcow2
DISK2: artifacts/disk.qcow2
CLIENT: artifacts/test-client
jobs:
### We want to use the cache from the build stage
## Check if the cache exist otherwise download it from the artifacts
prepare-artifacts:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Use the cache from the build workflow
id: build-artifacts
uses: actions/cache@v4
with:
path: artifacts/
key: ${{ runner.os }}-${{ github.sha }}-func-ci-base
- name: Download latest kernel
if: steps.build-artifacts.outputs.cache-hit != 'true'
uses: dawidd6/action-download-artifact@v7
with:
workflow: build_kernel.yml
name: vmlinux-amd64
path: tmp
- name: Download latest test client
if: steps.build-artifacts.outputs.cache-hit != 'true'
uses: dawidd6/action-download-artifact@v7
with:
workflow: test_client.yml
name: test-client
path: tmp
- name: Download latest base image
if: steps.build-artifacts.outputs.cache-hit != 'true'
uses: dawidd6/action-download-artifact@v7
with:
workflow: create_base_image.yml
name: disk-image-amd64
# workflow_conclusion: success
run_id: 2477855216
path: disktmp
- name: Copy Artifacts
if: steps.build-artifacts.outputs.cache-hit != 'true'
run: |
mkdir -p ${{ env.ARTIFACTS_DIR }}
cp tmp/kernel ${{ env.KERNEL }}
cp tmp/test-client ${{ env.CLIENT }}
./resources/artifacts.sh decompress-split disktmp/disk-image.qcow2
cp temp/disk-image.qcow2 ${{ env.DISK }}
emulator-function-test:
name: Test functions on emulator
# For running the qe
# runs-on: ubuntu-20.04
runs-on: [self-hosted, gem5-test]
needs: prepare-artifacts
outputs:
function_matrix: ${{ steps.set-matrix.outputs.function_matrix }}
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Setup Functions for testing
id: set-matrix
shell: bash
run: |
FUTS=$(cat .github/configs/functions-under-test.txt)
FUTS=${FUTS//$'\n'/ }
echo "$FUTS"
matrix=$(printf '%s\n' $(cat .github/configs/functions-under-test.txt) | jq -ncR [inputs])
echo $matrix
echo "FUNCTIONS_UNDER_TEST=$FUTS" >> $GITHUB_ENV
echo "::set-output name=function_matrix::$matrix"
## Use the artifact cache from the build stage
- name: Cache Build Artifacts
uses: actions/cache@v4
with:
path: artifacts/
key: ${{ runner.os }}-${{ github.sha }}-func-ci-base
##### Setup Test #####
# - name: Install dependencies
# run: |
# make -f ${{ env.MAKEFILE }} dep_install
- name: Install dependencies
run: |
make -f ${{ env.MAKEFILE }} dep_check_qemu
- name: Create the working directory to run the test.
env:
KERNEL: ${{ env.KERNEL }}
DISK: ${{ env.DISK }}
TEST_CLIENT: ${{ env.CLIENT }}
run: |
make -f ${{ env.MAKEFILE }} build
- name: Run the actual test of the emulator.
timeout-minutes: 30
run: |
make -f ${{ env.MAKEFILE }} run_emu_test
- name: Check the results file.
run: |
make -f ${{ env.MAKEFILE }} check_emu
## Once the Test completed successfully
## cache the working directory for the later simulator test jobs
- name: Cache test disk image
id: wkdir-cache
uses: actions/cache@v4
with:
path: ${{ env.WORKING_DIR }}
key: ${{ runner.os }}-${{ github.run_number }}-func-ci-test
simulator-function-test:
name: Test function on Simulator
# For running the qe
runs-on: [self-hosted, gem5-test]
needs: emulator-function-test
strategy:
fail-fast: false
max-parallel: 7
matrix:
function: ${{ fromJson(needs.emulator-function-test.outputs.function_matrix) }}
env:
FUNCTION: ${{ matrix.function }}
steps:
- name: Check out code
uses: actions/checkout@v4
## Use the artifact cache from the build stage
- name: Cache Build Artifacts
uses: actions/cache@v4
with:
path: ${{ env.WORKING_DIR }}
key: ${{ runner.os }}-${{ github.run_number }}-func-ci-test
- name: Check dependencies of the simulator.
run: |
make -f ${{ env.MAKEFILE }} dep_check_gem5
- name: Run the actual test of the simulator.
timeout-minutes: 10
run: |
make -f ${{ env.MAKEFILE }} run_sim_test
- name: Check the results file.
run: |
make -f ${{ env.MAKEFILE }} check_sim