diff --git a/.github/workflows/github_action_build_docs.yml b/.github/workflows/github_action_build_docs.yml new file mode 100644 index 0000000000..5b085b9f3b --- /dev/null +++ b/.github/workflows/github_action_build_docs.yml @@ -0,0 +1,59 @@ +# This github-Evennia workflow will build the docs. + +name: documentation + +on: + push: + branches: [ master, develop ] + paths: + - 'docs/**' + pull_request: + branches: [ master, develop ] + paths: + - 'docs/**' + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + python-version: [3.7] + + steps: + - uses: actions/checkout@v2 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Install doc-building dependencies + run: | + python -m pip install --upgrade pip + cd docs/ + make install + + # fail early here, run quickstrict with aborts also on warnings + - name: Quick-test docs (no autodocs) + run: | + cd docs/ + make quickstrict + + # full game dir needed for mv-local + - name: Set up evennia game dir + run: | + pip install -e . + cd .. + evennia --init gamedir + cd gamedir + evennia migrate + + - name: Deploy docs (only from master/develop branch) + if: ${{ github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master'}} + run: | + git config --global user.email "docbuilder@evennia.com" + git config --global user.name "Doc builder mechanism" + cd docs + make mv-local + echo "Would deploy here!" diff --git a/.github/workflows/github_action_test_suite.yml b/.github/workflows/github_action_test_suite.yml new file mode 100644 index 0000000000..bcc65fb47d --- /dev/null +++ b/.github/workflows/github_action_test_suite.yml @@ -0,0 +1,109 @@ +# This Evennia workflow will install Python dependencies, run tests with a variety of Python versions +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions + +name: test-suite + +on: + push: + branches: [ master, develop ] + paths-ignore: + - 'docs/**' + pull_request: + branches: [ master, develop ] + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + python-version: [3.7, 3.8] + TESTING_DB: ['sqlite3', 'postgresql', 'mysql'] + + steps: + + - uses: actions/checkout@v2 + + - name: Set up PostgreSQL server + uses: harmon758/postgresql-action@v1 + if: ${{ matrix.TESTING_DB == 'postgresql' }} + with: + postgresql version: '10.7' + postgresql db: 'evennia' + postgresql user: 'evennia' + postgresql password: 'password' + - name: Set up MySQL server + uses: mirromutth/mysql-action@v1.1 + if: ${{ matrix.TESTING_DB == 'mysql'}} + with: + host port: 3306 + character set server: 'utf8mb4' + collation server: 'utf8mb4_unicode_ci' + mysql database: 'evennia' + mysql user: 'evennia' + mysql password: 'password' + + # wait for db to activage, get logs from their start + - name: Wait / sleep + uses: jakejarvis/wait-action@v0.1.0 + if: ${{ matrix.TESTING_DB == 'postgresql' || matrix.TESTING_DB == 'mysql' }} + with: + time: '10s' + - name: Database container logs + uses: jwalton/gh-docker-logs@v1.0.0 + - name: Check running containers + run: docker ps -a + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Install package dependencies + run: | + python -m pip install --upgrade pip + pip install wheel + pip install psycopg2-binary + pip install mysqlclient + pip install coveralls + pip install codacy-coverage + pip install -e . + + - name: Install extra dependencies # Only develop branch right now + if: ${{ github.ref == 'refs/heads/develop' }} + run: pip install -r requirements_extra.txt + + - name: Initialize evennia + run: | + evennia --init testing_mygame + cp .github/workflows/${{ matrix.TESTING_DB }}_settings.py testing_mygame/server/conf/settings.py + cd testing_mygame + evennia migrate + evennia collectstatic --noinput + + - name: Run test suite + run: | + cd testing_mygame + coverage run --source=../evennia --omit=*/migrations/*,*/urls.py,*/test*.py,*.sh,*.txt,*.md,*.pyc,*.service ../bin/unix/evennia test --settings=settings --keepdb evennia + coverage xml + + # we only want to run coverall/codacy once, so we only do it for one of the matrix combinations + # it's also not critical if pushing to either service fails (happens for PRs since env is not + # available outside of the evennia org) + - name: Send data to Coveralls + if: ${{ matrix.TESTING_DB == 'sqlite3' && matrix.python-version == 3.7 }} + continue-on-error: true + env: + COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} + run: | + cd testing_mygame + coveralls + + - name: Send data to Codacy + if: ${{ matrix.TESTING_DB == 'sqlite3' && matrix.python-version == 3.7 }} + continue-on-error: true + uses: codacy/codacy-coverage-reporter-action@master + with: + project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} + coverage-reports: ./testing_mygame/coverage.xml