|
| 1 | +on: |
| 2 | + push: |
| 3 | + branches: [master, release] |
| 4 | + pull_request: |
| 5 | + |
| 6 | +name: CI |
| 7 | + |
| 8 | +jobs: |
| 9 | + rust_tests: |
| 10 | + name: Run rust tests |
| 11 | + runs-on: ${{ matrix.os }} |
| 12 | + strategy: |
| 13 | + matrix: |
| 14 | + os: [macos-latest, ubuntu-latest, windows-latest] |
| 15 | + fail-fast: false |
| 16 | + steps: |
| 17 | + - uses: actions/checkout@master |
| 18 | + - name: Convert symlinks to hardlink (windows only) |
| 19 | + run: powershell.exe scripts/symlinks-to-hardlinks.ps1 |
| 20 | + if: runner.os == 'Windows' |
| 21 | + - name: Cache cargo dependencies |
| 22 | + uses: actions/cache@v1 |
| 23 | + with: |
| 24 | + key: ${{ runner.os }}-rust_tests-${{ hashFiles('Cargo.lock') }} |
| 25 | + path: target |
| 26 | + restore-keys: | |
| 27 | + ${{ runner.os }}-rust_tests- |
| 28 | + - name: run rust tests |
| 29 | + uses: actions-rs/cargo@v1 |
| 30 | + with: |
| 31 | + command: test |
| 32 | + args: --verbose --all |
| 33 | + |
| 34 | + snippets: |
| 35 | + name: Run snippets tests |
| 36 | + runs-on: ${{ matrix.os }} |
| 37 | + strategy: |
| 38 | + matrix: |
| 39 | + os: [macos-latest, ubuntu-latest, windows-latest] |
| 40 | + fail-fast: false |
| 41 | + steps: |
| 42 | + - uses: actions/checkout@master |
| 43 | + - name: Convert symlinks to hardlink (windows only) |
| 44 | + run: powershell.exe scripts/symlinks-to-hardlinks.ps1 |
| 45 | + if: runner.os == 'Windows' |
| 46 | + - name: Cache cargo dependencies |
| 47 | + uses: actions/cache@v1 |
| 48 | + with: |
| 49 | + key: ${{ runner.os }}-snippets-${{ hashFiles('Cargo.lock') }} |
| 50 | + path: target |
| 51 | + restore-keys: | |
| 52 | + ${{ runner.os }}-snippets- |
| 53 | + - name: build rustpython |
| 54 | + uses: actions-rs/cargo@v1 |
| 55 | + with: |
| 56 | + command: build |
| 57 | + args: --release --verbose --all |
| 58 | + - uses: actions/setup-python@v1 |
| 59 | + with: |
| 60 | + python-version: 3.6 |
| 61 | + - name: Install pipenv |
| 62 | + run: | |
| 63 | + python -V |
| 64 | + python -m pip install --upgrade pip |
| 65 | + python -m pip install pipenv |
| 66 | + - run: pipenv install |
| 67 | + working-directory: ./tests |
| 68 | + - name: run snippets |
| 69 | + run: pipenv run pytest -v |
| 70 | + working-directory: ./tests |
| 71 | + |
| 72 | + format: |
| 73 | + name: Check Rust code with rustfmt and clippy |
| 74 | + runs-on: ubuntu-latest |
| 75 | + steps: |
| 76 | + - uses: actions/checkout@master |
| 77 | + - uses: actions-rs/toolchain@v1 |
| 78 | + with: |
| 79 | + profile: minimal |
| 80 | + toolchain: stable |
| 81 | + components: rustfmt |
| 82 | + override: true |
| 83 | + - name: run rustfmt |
| 84 | + uses: actions-rs/cargo@v1 |
| 85 | + with: |
| 86 | + command: fmt |
| 87 | + args: --all -- --check |
| 88 | + - name: run clippy |
| 89 | + uses: actions-rs/cargo@v1 |
| 90 | + with: |
| 91 | + command: clippy |
| 92 | + args: --all -- -Dwarnings |
| 93 | + |
| 94 | + lint: |
| 95 | + name: Lint Python code with flake8 |
| 96 | + runs-on: ubuntu-latest |
| 97 | + steps: |
| 98 | + - uses: actions/checkout@master |
| 99 | + - uses: actions/setup-python@v1 |
| 100 | + with: |
| 101 | + python-version: 3.6 |
| 102 | + - name: install flake8 |
| 103 | + run: python -m pip install flake8 |
| 104 | + - name: run lint |
| 105 | + run: flake8 . --count --exclude=./.*,./Lib,./vm/Lib --select=E9,F63,F7,F82 --show-source --statistics |
| 106 | + |
| 107 | + cpython: |
| 108 | + name: Run CPython test suite |
| 109 | + runs-on: ubuntu-latest |
| 110 | + steps: |
| 111 | + - uses: actions/checkout@master |
| 112 | + - name: build rustpython |
| 113 | + uses: actions-rs/cargo@v1 |
| 114 | + with: |
| 115 | + command: build |
| 116 | + args: --verbose --all |
| 117 | + - name: run tests |
| 118 | + run: | |
| 119 | + export RUSTPYTHONPATH=`pwd`/Lib |
| 120 | + cargo run -- -m test -v |
| 121 | +
|
| 122 | + wasm: |
| 123 | + name: Check the WASM package and demo |
| 124 | + runs-on: ubuntu-latest |
| 125 | + steps: |
| 126 | + - uses: actions/checkout@master |
| 127 | + - name: install wasm-pack |
| 128 | + run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh |
| 129 | + - name: install geckodriver |
| 130 | + run: | |
| 131 | + wget https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-linux32.tar.gz |
| 132 | + mkdir geckodriver |
| 133 | + tar -xzf geckodriver-v0.24.0-linux32.tar.gz -C geckodriver |
| 134 | + - uses: actions/setup-python@v1 |
| 135 | + with: |
| 136 | + python-version: 3.6 |
| 137 | + - name: Install pipenv |
| 138 | + run: | |
| 139 | + python -V |
| 140 | + python -m pip install --upgrade pip |
| 141 | + python -m pip install pipenv |
| 142 | + - run: pipenv install |
| 143 | + working-directory: ./wasm/tests |
| 144 | + - uses: actions/setup-node@v1 |
| 145 | + - name: run test |
| 146 | + run: | |
| 147 | + export PATH=$PATH:`pwd`/../../geckodriver |
| 148 | + npm install |
| 149 | + npm run test |
| 150 | + working-directory: ./wasm/demo |
| 151 | + - name: Deploy demo to Github Pages |
| 152 | + if: success() && github.ref == 'refs/heads/release' |
| 153 | + uses: peaceiris/actions-gh-pages@v2 |
| 154 | + env: |
| 155 | + ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEMO_DEPLOY_KEY }} |
| 156 | + PUBLISH_DIR: ./wasm/demo/dist |
| 157 | + EXTERNAL_REPOSITORY: RustPython/demo |
| 158 | + PUBLISH_BRANCH: master |
| 159 | + |
0 commit comments