|
| 1 | +name: Basic |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ "main" ] |
| 6 | + |
| 7 | + pull_request: |
| 8 | + branches: [ "main" ] |
| 9 | + |
| 10 | + workflow_dispatch: |
| 11 | + inputs: |
| 12 | + deploy_documentation: |
| 13 | + description: Deploy documentation |
| 14 | + required: false |
| 15 | + type: boolean |
| 16 | + default: false |
| 17 | + |
| 18 | +env: |
| 19 | + CARGO_TERM_COLOR: always |
| 20 | + |
| 21 | +permissions: |
| 22 | + contents: read |
| 23 | + |
| 24 | +jobs: |
| 25 | + build: |
| 26 | + runs-on: ubuntu-latest |
| 27 | + |
| 28 | + steps: |
| 29 | + - uses: actions/checkout@v4 |
| 30 | + |
| 31 | + - name: Check if oneAPI is already installed |
| 32 | + id: check-oneapi |
| 33 | + run: | |
| 34 | + if [ -f /opt/intel/oneapi/setvars.sh ]; then |
| 35 | + echo "installed=true" >> $GITHUB_OUTPUT |
| 36 | + else |
| 37 | + echo "installed=false" >> $GITHUB_OUTPUT |
| 38 | + fi |
| 39 | +
|
| 40 | + - name: Setup oneAPI |
| 41 | + if: steps.check-oneapi.outputs.installed != 'true' |
| 42 | + run: | |
| 43 | + installer="intel-oneapi-toolkit-2026.1.0.192_offline.sh" |
| 44 | + checksum="9d969de9cafbb698bf50f088c4b5174b50fc816f504049e685d6f6d198e10dbc17ef2cd4cfb0bc2b3d2179644a8d77d1" |
| 45 | + curl --fail --location --retry 3 --silent --show-error --output "$installer" \ |
| 46 | + "https://registrationcenter-download.intel.com/akdlm/IRC_NAS/33cb2a22-ddf1-4aa9-8d68-1f5a118acaf2/intel-oneapi-toolkit-2026.1.0.192_offline.sh" |
| 47 | + echo "$checksum $installer" | sha384sum --check |
| 48 | + sudo sh "./$installer" -a --silent --cli --eula accept |
| 49 | +
|
| 50 | + - name: Configure oneAPI environment |
| 51 | + run: | |
| 52 | + source /opt/intel/oneapi/setvars.sh |
| 53 | + # copy envs to github |
| 54 | + printenv | grep -E '^(PATH|LD_LIBRARY_PATH|LIBRARY_PATH|CPATH|C_INCLUDE_PATH|CPLUS_INCLUDE_PATH)=' >> $GITHUB_ENV |
| 55 | + icx --version |
| 56 | + sycl-ls --verbose |
| 57 | + |
| 58 | + - name: Build |
| 59 | + run: cargo build --verbose |
| 60 | + |
| 61 | + - name: Run tests |
| 62 | + run: cargo test --verbose |
| 63 | + |
| 64 | + - name: Generate documentation |
| 65 | + run: | |
| 66 | + cargo doc -p oneapi-rs --no-deps --verbose |
| 67 | + cat > target/doc/index.html <<'HTML' |
| 68 | + <!doctype html> |
| 69 | + <html lang="en"> |
| 70 | + <head> |
| 71 | + <meta charset="utf-8"> |
| 72 | + <meta http-equiv="refresh" content="0; url=oneapi_rs/"> |
| 73 | + <title>oneapi-rs documentation</title> |
| 74 | + </head> |
| 75 | + <body> |
| 76 | + <p><a href="oneapi_rs/">oneapi-rs documentation</a></p> |
| 77 | + </body> |
| 78 | + </html> |
| 79 | + HTML |
| 80 | +
|
| 81 | + - name: Upload documentation artifact |
| 82 | + uses: actions/upload-artifact@v4 |
| 83 | + with: |
| 84 | + name: documentation |
| 85 | + path: target/doc |
| 86 | + |
| 87 | + deploy-documentation: |
| 88 | + if: (github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event_name == 'workflow_dispatch' && inputs.deploy_documentation == 'true') |
| 89 | + needs: build |
| 90 | + runs-on: ubuntu-latest |
| 91 | + |
| 92 | + permissions: |
| 93 | + contents: read |
| 94 | + pages: write |
| 95 | + id-token: write |
| 96 | + |
| 97 | + environment: |
| 98 | + name: github-pages |
| 99 | + url: ${{ steps.deployment.outputs.page_url }} |
| 100 | + |
| 101 | + steps: |
| 102 | + - name: Download documentation artifact |
| 103 | + uses: actions/download-artifact@v4 |
| 104 | + with: |
| 105 | + name: documentation |
| 106 | + path: target/doc |
| 107 | + |
| 108 | + - name: Configure GitHub Pages |
| 109 | + uses: actions/configure-pages@v5 |
| 110 | + |
| 111 | + - name: Upload documentation to GitHub Pages |
| 112 | + uses: actions/upload-pages-artifact@v3 |
| 113 | + with: |
| 114 | + path: target/doc |
| 115 | + |
| 116 | + - name: Deploy documentation to GitHub Pages |
| 117 | + id: deployment |
| 118 | + uses: actions/deploy-pages@v4 |
0 commit comments