Fix two nasty bugs #178
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Build And Test | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
env: | |
CARGO_TERM_COLOR: always | |
PUBLIC_SIMICS_PKGS_URL: "https://registrationcenter-download.intel.com/akdlm/IRC_NAS/881ee76a-c24d-41c0-af13-5d89b2a857ff/simics-6-packages-2023-31-linux64.ispm" | |
PUBLIC_SIMICS_ISPM_URL: "https://registrationcenter-download.intel.com/akdlm/IRC_NAS/881ee76a-c24d-41c0-af13-5d89b2a857ff/intel-simics-package-manager-1.7.5-linux64.tar.gz" | |
PUBLIC_SIMICS_PKGS_URL_WINDOWS: "https://registrationcenter-download.intel.com/akdlm/IRC_NAS/881ee76a-c24d-41c0-af13-5d89b2a857ff/simics-6-packages-2023-31-win64.ispm" | |
PUBLIC_SIMICS_ISPM_URL_WINDOWS: "https://registrationcenter-download.intel.com/akdlm/IRC_NAS/881ee76a-c24d-41c0-af13-5d89b2a857ff/intel-simics-package-manager-1.7.5-win64.exe" | |
PUBLIC_SIMICS_PACKAGE_VERSION_1000: "6.0.169" | |
MINGW_URL: "https://github.com/brechtsanders/winlibs_mingw/releases/download/13.2.0-16.0.6-11.0.0-ucrt-r1/winlibs-x86_64-posix-seh-gcc-13.2.0-llvm-16.0.6-mingw-w64ucrt-11.0.0-r1.7z" | |
MINGW_VERSION: "13.2.0-16.0.6-11.0.0-ucrt-r1" | |
jobs: | |
build_test_artifacts: | |
name: Build Test Artifacts | |
runs-on: ubuntu-latest | |
steps: | |
- name: Add ISPM to PATH | |
run: | | |
echo "${HOME}/simics/ispm/" >> "${GITHUB_PATH}" | |
- name: Install Dependencies | |
run: | | |
sudo apt-get -y update && \ | |
sudo apt-get -y install \ | |
clang libclang-dev cmake curl dosfstools g++ gcc git llvm make \ | |
mtools ninja-build openssl libssl-dev python3 python3-pip | |
- name: Cache SIMICS Dependencies | |
id: cache-simics-packages | |
uses: actions/cache@v3 | |
with: | |
path: ~/simics | |
key: simics-linux-${{ env.PUBLIC_SIMICS_PACKAGE_VERSION_1000 }} | |
- name: Install SIMICS (External) | |
if: ${{ steps.cache-simics-packages.outputs.cache-hit != 'true' }} | |
run: | | |
mkdir -p "${HOME}/simics/ispm/" && \ | |
curl --noproxy -L -o "${HOME}/simics/ispm.tar.gz" \ | |
"${{ env.PUBLIC_SIMICS_ISPM_URL }}" && \ | |
curl --noproxy -L -o "${HOME}/simics/simics.ispm" \ | |
"${{ env.PUBLIC_SIMICS_PKGS_URL }}" && \ | |
tar -C "${HOME}/simics/ispm" --strip-components=1 \ | |
-xvf "${HOME}/simics/ispm.tar.gz" | |
- name: Set up SIMICS Install Directory | |
run: | | |
ispm settings install-dir "${HOME}/simics" | |
- name: Install SIMICS Packages | |
if: ${{ steps.cache-simics-packages.outputs.cache-hit != 'true' }} | |
run: | | |
ispm packages --install-bundle "${HOME}/simics/simics.ispm" \ | |
--non-interactive --trust-insecure-packages | |
- uses: actions/checkout@v4 | |
with: | |
lfs: true | |
- name: Cache Test Artifacts | |
id: cache-test-artifacts | |
uses: actions/cache@v3 | |
with: | |
path: examples/tests | |
key: cache-test-artifacts-${{ hashFiles('examples/tests/**/*') }} | |
- name: Build Test Artifacts | |
if: ${{ steps.cache-test-artifacts.outputs.cache-hit != 'true' }} | |
run: | | |
cd examples/tests/ | |
./build.sh | |
- name: Upload Test Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: test-artifacts | |
path: examples/tests/ | |
build_and_test: | |
name: Build and Test (Linux) | |
container: fedora:38 | |
runs-on: ubuntu-latest | |
needs: build_test_artifacts | |
steps: | |
- name: Add ISPM to PATH | |
run: | | |
echo "${HOME}/simics/ispm/" >> "${GITHUB_PATH}" | |
- name: Install Dependencies | |
run: | | |
dnf -y update && \ | |
dnf -y install \ | |
alsa-lib atk clang clang-libs clang-resource-filesystem \ | |
clang-tools-extra cmake cups curl dosfstools g++ gcc git \ | |
git-lfs glibc-devel glibc-devel.i686 glibc-static \ | |
glibc-static.i686 gtk3 lld lld-devel lld-libs llvm llvm-libs \ | |
llvm-static make mesa-libgbm mtools ninja-build openssl \ | |
openssl-devel openssl-libs python3 python3-pip yamllint | |
- uses: actions/checkout@v4 | |
with: | |
lfs: true | |
- name: Delete Un-Built Test Dependencies | |
run: | | |
rm -rf examples/tests/ | |
- name: Download Test Dependencies | |
uses: actions/download-artifact@v3 | |
with: | |
name: test-artifacts | |
path: examples/tests/ | |
- name: Take Ownership of Test Dependencies | |
run: | | |
ls -lahR examples/tests/ | |
chown -R "${USER}:${USER}" examples/tests/ | |
chmod -R 0755 examples/tests/ | |
- uses: dtolnay/rust-toolchain@nightly | |
with: | |
toolchain: nightly | |
components: rustfmt,clippy,miri | |
- name: Cache SIMICS Dependencies | |
id: cache-simics-packages | |
uses: actions/cache@v3 | |
with: | |
path: ~/simics | |
key: simics-linux-${{ env.PUBLIC_SIMICS_PACKAGE_VERSION_1000 }} | |
- name: Install SIMICS (External) | |
if: ${{ steps.cache-simics-packages.outputs.cache-hit != 'true' }} | |
run: | | |
mkdir -p "${HOME}/simics/ispm/" && \ | |
curl --noproxy -L -o "${HOME}/simics/ispm.tar.gz" \ | |
"${{ env.PUBLIC_SIMICS_ISPM_URL }}" && \ | |
curl --noproxy -L -o "${HOME}/simics/simics.ispm" \ | |
"${{ env.PUBLIC_SIMICS_PKGS_URL }}" && \ | |
tar -C "${HOME}/simics/ispm" --strip-components=1 \ | |
-xvf "${HOME}/simics/ispm.tar.gz" | |
- name: Set up SIMICS Install Directory | |
run: | | |
ispm settings install-dir "${HOME}/simics" | |
- name: Install SIMICS Packages | |
if: ${{ steps.cache-simics-packages.outputs.cache-hit != 'true' }} | |
run: | | |
ispm packages --install-bundle "${HOME}/simics/simics.ispm" \ | |
--non-interactive --trust-insecure-packages | |
- name: Build and Install TSFFS SIMICS Package | |
run: | | |
ispm projects "$(pwd)" --create --ignore-existing-files \ | |
--non-interactive | |
bin/project-setup --force | |
./build.rs | |
ispm packages \ | |
-i linux64/packages/simics-pkg-31337-*-linux64.ispm \ | |
--non-interactive --trust-insecure-packages | |
- name: Build Project | |
run: | | |
SIMICS_BASE=${HOME}/simics/simics-${{ env.PUBLIC_SIMICS_PACKAGE_VERSION_1000 }} cargo build | |
- name: CT39 - Clippy Check Project | |
run: | | |
SIMICS_BASE=${HOME}/simics/simics-${{ env.PUBLIC_SIMICS_PACKAGE_VERSION_1000 }} cargo clippy \ | |
|| ( echo "❗ [CT39 (1/2)] Failed clippy static analysis checks" && exit 1 ) | |
echo "✅ [CT39 (1/2)] Passed clippy static analysis checks" | |
- name: Test Project | |
run: | | |
TSFFS_TEST_CLEANUP_EACH=1 SIMICS_BASE=${HOME}/simics/simics-${{ env.PUBLIC_SIMICS_PACKAGE_VERSION_1000 }} cargo test -p command-ext -p raw-cstr -p version-tools -p tests -- --nocapture || ( echo "❗ Tests failed" && exit 1 ) | |
echo "✅ Tests passed" | |
- name: Build Docs | |
run: | | |
SIMICS_BASE=${HOME}/simics/simics-${{ env.PUBLIC_SIMICS_PACKAGE_VERSION_1000 }} cargo doc --workspace --no-deps | |
- name: Test Docs | |
run: | | |
SIMICS_BASE=${HOME}/simics/simics-${{ env.PUBLIC_SIMICS_PACKAGE_VERSION_1000 }} cargo test --doc | |
- name: CT39 - MIRI Check Project | |
run: | | |
SIMICS_BASE=${HOME}/simics/simics-${{ env.PUBLIC_SIMICS_PACKAGE_VERSION_1000 }} \ | |
MIRIFLAGS="-Zmiri-backtrace=full -Zmiri-disable-isolation -Zmiri-panic-on-unsupported" \ | |
cargo miri test -p command-ext -p raw-cstr -p version-tools \ | |
|| ( echo "❗ [CT39 (2/2)] Failed MIRI static analysis checks" && exit 1 ) | |
echo "✅ [CT39 (2/2)] Passed MIRI static analysis checks" | |
build_windows: | |
name: Build and Test (Windows) | |
runs-on: windows-latest | |
steps: | |
- name: Add ISPM and MinGW to PATH | |
run: | | |
set PATH $env:PATH | |
"C:\MinGW\bin" | Out-File -FilePath $env:GITHUB_PATH | |
"C:\ISPM\" | Out-File -FilePath $env:GITHUB_PATH -Append | |
"$PATH" | Out-File -FilePath $env:GITHUB_PATH -Append | |
echo "Current PATH: " $env:GITHUB_PATH | |
- name: Cache MinGW | |
id: cache-mingw | |
uses: actions/cache@v3 | |
with: | |
path: C:\MinGW\ | |
key: mingw-${{ env.MINGW_VERSION }} | |
- name: Download and Extract MinGW-w64 | |
if: ${{ steps.cache-mingw.outputs.cache-hit != 'true' }} | |
run: | | |
Invoke-WebRequest -URI ${{ env.MINGW_URL }} -OutFile mingw.7z | |
7z x mingw.7z -oC:\mingw-w64\ | |
mv C:\mingw-w64\mingw64\ C:\MinGW\ | |
- name: Download and Install Rust | |
run: | | |
Invoke-WebRequest -URI https://win.rustup.rs/x86_64 -o C:\rustup-init.exe | |
C:\rustup-init.exe --default-toolchain nightly --default-host x86_64-pc-windows-gnu -y | |
- name: Cache SIMICS | |
id: cache-simics-packages-windows | |
uses: actions/cache@v3 | |
with: | |
path: | | |
C:\ISPM\ | |
C:\SIMICS\ | |
key: simics-windows-${{ env.PUBLIC_SIMICS_PACKAGE_VERSION_1000 }} | |
# ispm-installer.exe is a NSIS installer for the elctron build. We want the | |
# default options, so we pass /S to install silently: | |
# https://nsis.sourceforge.io/Docs/Chapter3.html#installerusage | |
# | |
# NOTE: We use | Out-Null on the installer command to make powershell wait for it | |
# to actually finish instead of forking it to the background | |
- name: Download and Install ISPM | |
if: ${{ steps.cache-simics-packages-windows.outputs.cache-hit != 'true' }} | |
run: | | |
Invoke-WebRequest -URI ${{ env.PUBLIC_SIMICS_ISPM_URL_WINDOWS }} -o C:\ispm-installer.exe | |
C:\ispm-installer.exe /S /D='C:\ISPM\' | Out-Null | |
- name: Set SIMICS Install Directory | |
run: | | |
ispm.exe settings install-dir C:\SIMICS\ | |
- name: Download and Install SIMICS Packages | |
if: ${{ steps.cache-simics-packages-windows.outputs.cache-hit != 'true' }} | |
run: | | |
Invoke-WebRequest -URI ${{ env.PUBLIC_SIMICS_PKGS_URL_WINDOWS }} -o C:\simics-6-packages.ispm | |
ispm.exe packages --install-bundle C:\simics-6-packages.ispm --non-interactive --trust-insecure-packages | |
- uses: actions/checkout@v4 | |
with: | |
lfs: true | |
- name: Setup, Build, and Install TSFFS | |
run: | | |
ispm.exe projects $(pwd) --create --non-interactive --ignore-existing-files | |
./bin/project-setup.bat --mingw-dir C:\MinGW\ --ignore-existing-files --force | |
cargo -Zscript build.rs | |
- name: Upload Distribution Package | |
uses: actions/upload-artifact@v3 | |
with: | |
name: simics-pkg-31337-win64 | |
path: win64/packages/simics-pkg-31337-*-win64.ispm | |
build_dist: | |
name: Build for Distribution | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
lfs: true | |
- name: Cache Builder Dependencies | |
id: cache-builder-dependencies | |
uses: actions/cache@v3 | |
with: | |
path: .github/builder/rsrc | |
key: cache-builder-dependencies | |
- name: Download Builder Dependencies | |
if: ${{ steps.cache-builder-dependencies.outputs.cache-hit != 'true' }} | |
run: | | |
mkdir -p .github/builder/rsrc | |
curl -L -o .github/builder/rsrc/ispm.tar.gz \ | |
"${{ env.PUBLIC_SIMICS_ISPM_URL }}" && \ | |
curl -L -o .github/builder/rsrc/simics.ispm \ | |
"${{ env.PUBLIC_SIMICS_PKGS_URL }}" | |
- name: Build Distribution Package | |
run: | | |
docker build -t tsffs-dist -f .github/builder/Dockerfile . | |
docker create --name tsffs-dist tsffs-dist bash | |
docker cp tsffs-dist:/tsffs/linux64/packages/ packages/ | |
docker rm -f tsffs-dist | |
- name: Upload Distribution Package | |
uses: actions/upload-artifact@v3 | |
with: | |
name: simics-pkg-31337-linux64 | |
path: packages/simics-pkg-31337-*-linux64.ispm | |
fuzz_tests: | |
name: Run Fuzz Tests | |
container: fedora:38 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install Dependencies | |
run: | | |
dnf -y update && \ | |
dnf -y install \ | |
alsa-lib atk clang clang-libs clang-resource-filesystem \ | |
clang-tools-extra cmake cups curl dosfstools g++ gcc git \ | |
git-lfs glibc-devel glibc-devel.i686 glibc-static \ | |
glibc-static.i686 gtk3 lld lld-devel lld-libs llvm llvm-libs \ | |
llvm-static make mesa-libgbm mtools ninja-build openssl \ | |
openssl-devel openssl-libs python3 python3-pip yamllint | |
- uses: actions/checkout@v4 | |
with: | |
lfs: true | |
- uses: dtolnay/rust-toolchain@nightly | |
with: | |
toolchain: nightly | |
components: rustfmt,clippy,miri | |
- name: Install Cargo-Fuzz | |
run: | | |
cargo install cargo-fuzz | |
- name: CT632 (E/C) - Perform fuzz testing | |
run: | | |
cd modules/tsffs/src/util/version-tools | |
cargo fuzz build | |
timeout --preserve-status 600 cargo fuzz run \ | |
fuzz_version_constraint_parse || exit 0 | |
echo "Done fuzzing!" | |
if [ -d ./fuzz/artifacts ]; then | |
if find ./fuzz/artifacts -mindepth 1 -maxdepth 1 2> /dev/null | read -r; then | |
echo "❗ [CT632] Fuzz test found an issue" | |
exit 1 | |
fi | |
fi | |
cd ../../../../../ | |
cd modules/tsffs/src/util/util/raw-cstr | |
cargo fuzz build | |
timeout --preserve-status 600 cargo fuzz run \ | |
fuzz_raw_cstr || exit 0 | |
echo "Done fuzzing!" | |
if [ -d ./fuzz/artifacts ]; then | |
if find ./fuzz/artifacts -mindepth 1 -maxdepth 1 2> /dev/null | read -r; then | |
echo "❗ [CT632] Fuzz test found an issue" | |
exit 1 | |
fi | |
fi | |
cd ../../../../../ | |
echo "✅ [CT632] Fuzz test completed" | |
exit 0 |