|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - master |
| 8 | + schedule: |
| 9 | + - cron: '0 18 * * *' |
| 10 | + |
| 11 | +concurrency: |
| 12 | + group: CI-tests-${{ github.event.pull_request.number || github.ref }} |
| 13 | + cancel-in-progress: true |
| 14 | + |
| 15 | +jobs: |
| 16 | + changes: |
| 17 | + # Check if any file related to Drain3/ CI behavior is changed |
| 18 | + # set outputs for other jobs to access for if conditions |
| 19 | + name: Check Changes |
| 20 | + runs-on: ubuntu-latest |
| 21 | + # To prevent error when there's no base branch |
| 22 | + if: github.event_name != 'schedule' |
| 23 | + timeout-minutes: 10 |
| 24 | + outputs: |
| 25 | + drain3: ${{ steps.filter.outputs.drain3 }} |
| 26 | + steps: |
| 27 | + - uses: actions/checkout@v3 # required for push event |
| 28 | + - name: Check for file changes |
| 29 | + |
| 30 | + id: filter |
| 31 | + with: |
| 32 | + token: ${{ github.token }} |
| 33 | + # The following filters indicate a category along with |
| 34 | + # the files that should not be ignored by CI when modified. |
| 35 | + filters: | |
| 36 | + drain3: |
| 37 | + - '.github/**/*.yaml' |
| 38 | + - '**/*.py' |
| 39 | + - '**/Dockerfile*' |
| 40 | + - '**/Makefile' |
| 41 | + - 'tests/**' |
| 42 | + - '**/*.bat' |
| 43 | + - '**/*.sh' |
| 44 | + - '**/*.ps1' |
| 45 | + - '**/pyproject.toml' |
| 46 | + - '**/poetry.lock' |
| 47 | + - '**/*.cfg' |
| 48 | + - '**/*.ini' |
| 49 | + list-files: json # logs matched files |
| 50 | + build: |
| 51 | + runs-on: ubuntu-latest |
| 52 | + needs: [changes] |
| 53 | + if: | |
| 54 | + ( always() && ! cancelled() ) && |
| 55 | + ((github.event_name == 'schedule' && github.repository == 'logpai/drain3') || needs.changes.outputs.drain3 == 'true') |
| 56 | + |
| 57 | + strategy: |
| 58 | + matrix: |
| 59 | + python-version: [ "3.7", "3.8", "3.9", "3.10", "3.11" ] |
| 60 | + fail-fast: false |
| 61 | + env: |
| 62 | + PYTHON_VERSION: ${{ matrix.python-version }} |
| 63 | + |
| 64 | + steps: |
| 65 | + - name: Check out Drain3 codebase |
| 66 | + uses: actions/checkout@v3 |
| 67 | + |
| 68 | + - name: Set up Python ${{ matrix.python-version }} |
| 69 | + uses: actions/setup-python@v4 |
| 70 | + with: |
| 71 | + python-version: ${{ matrix.python-version }} |
| 72 | + |
| 73 | + - name: Setup Poetry |
| 74 | + run: | |
| 75 | + python -m pip install --upgrade pip |
| 76 | + python -m pip install --upgrade poetry |
| 77 | +
|
| 78 | + - name: Install dependencies |
| 79 | + run: poetry install |
| 80 | + |
| 81 | + - name: Test with unittest |
| 82 | + run: poetry run python -m unittest discover --verbose --start-directory tests |
0 commit comments