Files
gem5/.github/workflows/ci-tests.yaml
Melissa Jost 424350f446 misc: Update CI test workflow (#88)
* misc: Update CI test workflow

This updates our CI tests to clean the runners after every
workflow, to make sure no hanging files cause problems for
future tests

Change-Id: Iff6a702bbc2e86a31e4c18ef9764a3cfd3af2f7d

* misc: Update scheduled workflows to clean runners

This updates our scheduled tests to clean up any remaining
files after running tests to avoid anything hanging for
future runs.

Change-Id: Icfdd5a0559337ad0e62d108a47f4e5a12e0db677

* misc: Fix spacing in workflow files

Some commands were incorrectly spaced

Change-Id: Id340dc77bfb5c5d579b5f1e5b3ddeabea4a35ea8
2023-07-18 10:27:32 -07:00

111 lines
4.1 KiB
YAML

# This workflow runs after a pull-request has been approved by a reviewer.
name: CI Tests
on:
pull_request:
types: [opened, edited, synchronize, ready_for_review]
jobs:
pre-commit:
# runs on github hosted runner
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: pre-commit/action@v3.0.0
# ensures we have a change-id in every commit, needed for gerrit
check-for-change-id:
# runs on github hosted runner
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Check for Change-Id
run: |
# loop through all the commits in the pull request
for commit in $(git rev-list ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}); do
git checkout $commit
if (git log -1 --pretty=format:"%B" | grep -q "Change-Id: ")
then
# passes as long as at least one change-id exists in the pull request
exit 0
fi
done
# if we reach this part, none of the commits had a change-id
echo "None of the commits in this pull request contains a Change-ID, which we require for any changes made to gem5. "\
"To automatically insert one, run the following:\n f=`git rev-parse --git-dir`/hooks/commit-msg ; mkdir -p $(dirname $f) ; "\
"curl -Lo $f https://gerrit-review.googlesource.com/tools/hooks/commit-msg ; chmod +x $f\n Then amend the commit with git commit --amend --no-edit, and update your pull request."
exit 1
build-gem5:
runs-on: [self-hosted, linux, x64, build]
container: gcr.io/gem5-test/ubuntu-22.04_all-dependencies:latest
needs: [pre-commit, check-for-change-id] # only runs if pre-commit and change-id passes
outputs:
artifactname: ${{ steps.name.outputs.test }}
steps:
- uses: actions/checkout@v3
- id: name
run: echo "test=$(date +"%Y-%m-%d_%H.%M.%S")-artifact" >> $GITHUB_OUTPUT
- name: Build gem5
run: |
scons build/ALL/gem5.opt -j $(nproc)
- uses: actions/upload-artifact@v3
with:
name: ${{ steps.name.outputs.test }}
path: build/ALL/gem5.opt
- run: echo "This job's status is ${{ job.status }}."
unittests-all-opt:
runs-on: [self-hosted, linux, x64, run]
container: gcr.io/gem5-test/ubuntu-22.04_all-dependencies:latest
needs: [pre-commit, check-for-change-id] # only runs if pre-commit and change-id passes
timeout-minutes: 60
steps:
- uses: actions/checkout@v3
- name: CI Unittests
working-directory: ${{ github.workspace }}
run: scons build/ALL/unittests.opt -j $(nproc)
- run: echo "This job's status is ${{ job.status }}."
testlib-quick:
runs-on: [self-hosted, linux, x64, run]
container: gcr.io/gem5-test/ubuntu-22.04_all-dependencies:latest
needs: [pre-commit, build-gem5, check-for-change-id]
timeout-minutes: 360 # 6 hours
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: ${{needs.build-gem5.outputs.artifactname}}
path: build/ALL
- run: chmod u+x build/ALL/gem5.opt
- name: The TestLib CI Tests
working-directory: ${{ github.workspace }}/tests
run: ./main.py run --skip-build -vv
- name: create zip of results
if: success() || failure()
run: |
apt-get -y install zip
zip -r output.zip tests/testing-results
- name: upload zip
if: success() || failure()
uses: actions/upload-artifact@v3
env:
MY_STEP_VAR: ${{github.job}}_COMMIT.${{github.sha}}_RUN.${{github.run_id}}_ATTEMPT.${{github.run_attempt}}
with:
name: ${{ env.MY_STEP_VAR }}
path: output.zip
retention-days: 7
- name: Clean runner
run:
rm -rf ./* || true
rm -rf ./.??* || true
rm -rf ~/.cache || true
- run: echo "This job's status is ${{ job.status }}."