| 1 | on: [push, pull_request] |
| 2 | |
| 3 | name: CI |
| 4 | |
| 5 | jobs: |
| 6 | check: |
| 7 | name: Check |
| 8 | runs-on: ubuntu-latest |
| 9 | steps: |
| 10 | - uses: actions/checkout@v4 |
| 11 | - uses: actions-rs/toolchain@v1 |
| 12 | with: |
| 13 | profile: minimal |
| 14 | toolchain: stable |
| 15 | override: true |
| 16 | - uses: actions-rs/cargo@v1 |
| 17 | with: |
| 18 | command: check |
| 19 | |
| 20 | test: |
| 21 | name: Test Suite |
| 22 | runs-on: ${{ matrix.os }} |
| 23 | strategy: |
| 24 | matrix: |
| 25 | os: [ubuntu-latest, macos-latest, windows-latest] |
| 26 | steps: |
| 27 | - uses: actions/checkout@v4 |
| 28 | - uses: actions-rs/toolchain@v1 |
| 29 | with: |
| 30 | profile: minimal |
| 31 | toolchain: stable |
| 32 | override: true |
| 33 | - name: Cache cargo build |
| 34 | uses: Swatinem/rust-cache@v2 |
| 35 | - uses: actions-rs/cargo@v1 |
| 36 | with: |
| 37 | command: test |
| 38 | - name: Install LLVM |
| 39 | if: matrix.os == 'ubuntu-latest' |
| 40 | run: sudo apt-get install -y llvm |
| 41 | - name: Install LLVM |
| 42 | if: matrix.os == 'macos-latest' |
| 43 | run: | |
| 44 | brew install llvm |
| 45 | echo "$(brew --prefix llvm)/bin" >> $GITHUB_PATH |
| 46 | - name: Run llvm-dlltool |
| 47 | run: | |
| 48 | llvm-dlltool -m i386:x86-64 -d tests/python39.def -l llvm-amd64-python39.lib |
| 49 | llvm-dlltool -m i386 -d tests/python39.def -l llvm-i386-python39.lib |
| 50 | if: matrix.os != 'windows-latest' |
| 51 | - name: Compare with llvm-dlltool |
| 52 | if: matrix.os != 'windows-latest' |
| 53 | shell: bash |
| 54 | run: | |
| 55 | set -e |
| 56 | if cmp -s -- amd64-python39.lib llvm-amd64-python39.lib; then |
| 57 | echo "Success!"; |
| 58 | else |
| 59 | echo "Fail!"; |
| 60 | exit 1; |
| 61 | fi |
| 62 | |
| 63 | if cmp -s -- i386-python39.lib llvm-i386-python39.lib; then |
| 64 | echo "Success!"; |
| 65 | else |
| 66 | echo "Fail!"; |
| 67 | exit 1; |
| 68 | fi |
| 69 | |
| 70 | fuzz: |
| 71 | name: Fuzz Test |
| 72 | runs-on: ubuntu-latest |
| 73 | steps: |
| 74 | - uses: actions/checkout@v4 |
| 75 | - uses: actions-rs/toolchain@v1 |
| 76 | with: |
| 77 | profile: minimal |
| 78 | toolchain: nightly |
| 79 | override: true |
| 80 | - name: Cache cargo build |
| 81 | uses: Swatinem/rust-cache@v2 |
| 82 | - name: Cache fuzz corpus - Step 1 |
| 83 | uses: actions/cache@v4 |
| 84 | with: |
| 85 | path: fuzz/corpus |
| 86 | key: ${{ runner.os }}-fuzz-corpus |
| 87 | - name: Cache fuzz corpus - Step 2 |
| 88 | uses: actions/cache@v4 |
| 89 | with: |
| 90 | path: fuzz/corpus |
| 91 | key: ${{ runner.os }}-fuzz-corpus-${{ hashFiles('fuzz/corpus/**/*') }} |
| 92 | restore-keys: | |
| 93 | ${{ runner.os }}-fuzz-corpus-${{ hashFiles('fuzz/corpus/**/*') }} |
| 94 | ${{ runner.os }}-fuzz-corpus- |
| 95 | - uses: dtolnay/install@master |
| 96 | with: |
| 97 | crate: cargo-fuzz |
| 98 | - name: cargo fuzz |
| 99 | run: cargo fuzz run fuzz_implib -- -runs=100000 -max_len=10485760 -dict=fuzz/dict.txt |
| 100 | |
| 101 | fmt: |
| 102 | name: Rustfmt |
| 103 | runs-on: ubuntu-latest |
| 104 | steps: |
| 105 | - uses: actions/checkout@v4 |
| 106 | - uses: actions-rs/toolchain@v1 |
| 107 | with: |
| 108 | profile: minimal |
| 109 | toolchain: stable |
| 110 | override: true |
| 111 | - run: rustup component add rustfmt |
| 112 | - uses: actions-rs/cargo@v1 |
| 113 | with: |
| 114 | command: fmt |
| 115 | args: --all -- --check |