Merge pull request #49 from intel/dependabot/github_actions/actions/c… #32
This file contains hidden or 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: Deploy Documentation | |
| on: | |
| push: | |
| branches: ["main"] | |
| workflow_dispatch: | |
| env: | |
| PUBLIC_SIMICS_PKGS_URL: "https://registrationcenter-download.intel.com/akdlm/IRC_NAS/ead79ef5-28b5-48c7-8d1f-3cde7760798f/simics-6-packages-2024-05-linux64.ispm" | |
| PUBLIC_SIMICS_ISPM_URL: "https://registrationcenter-download.intel.com/akdlm/IRC_NAS/ead79ef5-28b5-48c7-8d1f-3cde7760798f/intel-simics-package-manager-1.8.3-linux64.tar.gz" | |
| PUBLIC_SIMICS_PACKAGE_VERSION_1000: "6.0.185" | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0 | |
| with: | |
| egress-policy: audit | |
| - 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 curl | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - name: Install mdBook | |
| run: | | |
| cargo install mdbook mdbook-linkcheck | |
| - name: Build mdBook | |
| run: | | |
| pushd docs || exit 1 | |
| mdbook build | |
| popd || exit 1 | |
| - name: Cache SIMICS Dependencies | |
| id: cache-simics-packages | |
| uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | |
| 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 '*.intel.com' -L -o "${HOME}/simics/ispm.tar.gz" \ | |
| "${{ env.PUBLIC_SIMICS_ISPM_URL }}" && \ | |
| curl --noproxy '*.intel.com' -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: Generate SIMICS Documentation | |
| run: | | |
| mkdir "$(pwd)/project" | |
| ispm projects "$(pwd)/project" --create --ignore-existing-files --non-interactive | |
| "$(pwd)/project/documentation" -o docs/book/html/simics --dont-open --project "$(pwd)/project" | |
| - name: Generate Crate Documentation | |
| run: | | |
| # Use /mnt for cargo target directory to avoid filling root filesystem | |
| export CARGO_TARGET_DIR="/mnt/cargo-target" | |
| sudo mkdir -p "$CARGO_TARGET_DIR" | |
| sudo chown -R "$USER:$USER" "$CARGO_TARGET_DIR" | |
| SIMICS_BASE="${HOME}/simics/simics-${{ env.PUBLIC_SIMICS_PACKAGE_VERSION_1000 }}" RUSTDOCFLAGS="--enable-index-page -Zunstable-options" cargo doc --document-private-items --workspace --no-deps | |
| # Ensure the destination directory exists before copying | |
| mkdir -p docs/book/html/crates/ | |
| cp -a "$CARGO_TARGET_DIR/doc/" docs/book/html/crates/ | |
| - name: Set Documentation Permissions | |
| run: | | |
| sudo chown -R "$USER:$USER" docs | |
| sudo chmod -R 755 docs | |
| sudo chmod -c -R +rX docs/ | while read -r line; do | |
| echo "::warning title=Invalid file permissions automatically fixed::$line" | |
| done | |
| - name: Setup Pages | |
| uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0 | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1 | |
| with: | |
| path: "./docs/book/html/" | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5 |