|
| 1 | +name: OctoBot-Market-Making-CI |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - 'master' |
| 6 | + - 'dev' |
| 7 | + tags: |
| 8 | + - '*' |
| 9 | + pull_request: |
| 10 | + |
| 11 | +jobs: |
| 12 | + lint: |
| 13 | + name: ${{ matrix.os }}${{ matrix.arch }} - Python ${{ matrix.version }} - lint |
| 14 | + runs-on: ${{ matrix.os }} |
| 15 | + strategy: |
| 16 | + matrix: |
| 17 | + os: [ ubuntu-latest ] |
| 18 | + arch: [ x64 ] |
| 19 | + version: [ "3.10.x" ] |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@v4 |
| 22 | + - name: Set up Python ${{ matrix.version }} |
| 23 | + uses: actions/setup-python@v5 |
| 24 | + with: |
| 25 | + python-version: ${{ matrix.version }} |
| 26 | + architecture: ${{ matrix.arch }} |
| 27 | + |
| 28 | + - name: Install dependencies |
| 29 | + env: |
| 30 | + OCTOBOT_GH_REPO: https://github.com/Drakkar-Software/OctoBot.git |
| 31 | + OCTOBOT_DEFAULT_BRANCH: dev |
| 32 | + run: | |
| 33 | + echo "GITHUB_REF=$GITHUB_REF" |
| 34 | + TARGET_BRANCH=$([ "$GITHUB_HEAD_REF" == "" ] && echo ${GITHUB_REF##*/} || echo "$GITHUB_HEAD_REF") |
| 35 | + git clone -q $OCTOBOT_GH_REPO -b ${TARGET_BRANCH} || git clone -q $OCTOBOT_GH_REPO -b $OCTOBOT_DEFAULT_BRANCH |
| 36 | + cd OctoBot |
| 37 | + git status |
| 38 | + pip install -r dev_requirements.txt |
| 39 | + pip install . |
| 40 | + cd .. |
| 41 | +
|
| 42 | + - name: Pylint |
| 43 | + run: | |
| 44 | + pylint --rcfile=standard.rc octobot_market_making |
| 45 | + if [ $? -ne 1 ]; then exit 0; fi |
| 46 | +
|
| 47 | + tests: |
| 48 | + name: ${{ matrix.os }}${{ matrix.arch }} - Python - ${{ matrix.python }} - tests |
| 49 | + needs: lint |
| 50 | + runs-on: ${{ matrix.os }} |
| 51 | + strategy: |
| 52 | + matrix: |
| 53 | + os: [ macos-13, windows-latest, ubuntu-latest ] |
| 54 | + arch: [ x64 ] |
| 55 | + python: [ '3.10' ] |
| 56 | + |
| 57 | + steps: |
| 58 | + - uses: actions/checkout@v4 |
| 59 | + - name: Set up Python ${{ matrix.python }} |
| 60 | + uses: actions/setup-python@v5 |
| 61 | + with: |
| 62 | + python-version: ${{ matrix.python }} |
| 63 | + architecture: ${{ matrix.arch }} |
| 64 | + |
| 65 | + - name: Install OctoBot on Unix |
| 66 | + if: matrix.os != 'windows-latest' |
| 67 | + env: |
| 68 | + OCTOBOT_GH_REPO: https://github.com/Drakkar-Software/OctoBot.git |
| 69 | + OCTOBOT_DEFAULT_BRANCH: dev |
| 70 | + run: | |
| 71 | + echo "GITHUB_REF=$GITHUB_REF" |
| 72 | + TARGET_BRANCH=$([ "$GITHUB_HEAD_REF" == "" ] && echo ${GITHUB_REF##*/} || echo "$GITHUB_HEAD_REF") |
| 73 | + git clone -q $OCTOBOT_GH_REPO -b ${TARGET_BRANCH} || git clone -q $OCTOBOT_GH_REPO -b $OCTOBOT_DEFAULT_BRANCH |
| 74 | + cd OctoBot |
| 75 | + git status |
| 76 | + pip install -r dev_requirements.txt |
| 77 | + pip install . |
| 78 | + cd .. |
| 79 | +
|
| 80 | + - name: Install OctoBot on Windows |
| 81 | + if: matrix.os == 'windows-latest' |
| 82 | + env: |
| 83 | + OCTOBOT_GH_REPO: https://github.com/Drakkar-Software/OctoBot.git |
| 84 | + OCTOBOT_DEFAULT_BRANCH: dev |
| 85 | + run: | |
| 86 | + echo "GITHUB_REF=$env:GITHUB_REF" |
| 87 | + $env:TARGET_BRANCH = $env:GITHUB_REF |
| 88 | + If ((Test-Path env:GITHUB_HEAD_REF) -and -not ([string]::IsNullOrWhiteSpace($env:GITHUB_HEAD_REF))) { |
| 89 | + echo "using GITHUB_HEAD_REF" |
| 90 | + $env:TARGET_BRANCH = $env:GITHUB_HEAD_REF |
| 91 | + } |
| 92 | + echo "TARGET_BRANCH=$env:TARGET_BRANCH" |
| 93 | + If ($env:TARGET_BRANCH -notcontains "refs/tags/") { |
| 94 | + $env:TENTACLES_URL_TAG = "latest" |
| 95 | + } |
| 96 | + echo "cleaned TARGET_BRANCH=$env:TARGET_BRANCH" |
| 97 | + git clone -q $env:OCTOBOT_GH_REPO -b $env:TARGET_BRANCH.Replace('refs/heads/','') |
| 98 | + if ($LastExitCode -ne 0) { |
| 99 | + git clone -q $env:OCTOBOT_GH_REPO -b $env:OCTOBOT_DEFAULT_BRANCH |
| 100 | + } |
| 101 | + cd OctoBot |
| 102 | + git status |
| 103 | + pip install -r dev_requirements.txt |
| 104 | + pip install . |
| 105 | + cd .. |
| 106 | + shell: powershell |
| 107 | + |
| 108 | + - name: Pytests |
| 109 | + run: | |
| 110 | + pytest --cov=. --cov-config=.coveragerc --durations=0 -rw tests |
| 111 | +
|
| 112 | + publish: |
| 113 | + needs: tests |
| 114 | + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') |
| 115 | + uses: Drakkar-Software/.github/.github/workflows/python3_sdist_workflow.yml@master |
| 116 | + secrets: |
| 117 | + PYPI_OFFICIAL_UPLOAD_URL: ${{ secrets.PYPI_OFFICIAL_UPLOAD_URL }} |
| 118 | + PYPI_USERNAME: __token__ |
| 119 | + PYPI_PASSWORD: ${{ secrets.PYPI_TOKEN }} |
| 120 | + |
| 121 | + notify: |
| 122 | + if: ${{ failure() }} |
| 123 | + needs: |
| 124 | + - lint |
| 125 | + - tests |
| 126 | + - publish |
| 127 | + uses: Drakkar-Software/.github/.github/workflows/failure_notify_workflow.yml@master |
| 128 | + secrets: |
| 129 | + DISCORD_GITHUB_WEBHOOK: ${{ secrets.DISCORD_GITHUB_WEBHOOK }} |
0 commit comments