feat(github): add github integration #387
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: CI | |
on: | |
pull_request: | |
branches: [master] | |
types: [opened, synchronize, reopened] | |
push: | |
branches: [master] | |
workflow_dispatch: | |
concurrency: | |
group: "${{ github.workflow }}-${{ github.ref }}" | |
cancel-in-progress: true | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup Release | |
id: setup-release | |
uses: LizardByte/setup-release-action@v2024.919.143601 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
- name: Install Python Dependencies | |
run: | | |
python -m pip install --upgrade pip setuptools wheel | |
python -m pip install --upgrade -r requirements.txt | |
python -m pip install --upgrade -r requirements-dev.txt | |
- name: Test with pytest | |
id: test | |
env: | |
CI_EVENT_ID: ${{ github.event.number || github.sha }} | |
GITHUB_PYTEST: "true" | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
DISCORD_BOT_TOKEN: ${{ secrets.DISCORD_TEST_BOT_TOKEN }} | |
DISCORD_GITHUB_STATUS_CHANNEL_ID: ${{ vars.DISCORD_GITHUB_STATUS_CHANNEL_ID }} | |
DISCORD_REDDIT_CHANNEL_ID: ${{ vars.DISCORD_REDDIT_CHANNEL_ID }} | |
DISCORD_SPONSORS_CHANNEL_ID: ${{ vars.DISCORD_SPONSORS_CHANNEL_ID }} | |
GRAVATAR_EMAIL: ${{ secrets.GRAVATAR_EMAIL }} | |
IGDB_CLIENT_ID: ${{ secrets.TWITCH_CLIENT_ID }} | |
IGDB_CLIENT_SECRET: ${{ secrets.TWITCH_CLIENT_SECRET }} | |
PRAW_CLIENT_ID: ${{ secrets.REDDIT_CLIENT_ID }} | |
PRAW_CLIENT_SECRET: ${{ secrets.REDDIT_CLIENT_SECRET }} | |
REDDIT_USERNAME: ${{ secrets.REDDIT_USERNAME }} | |
REDDIT_PASSWORD: ${{ secrets.REDDIT_PASSWORD }} | |
shell: bash | |
run: | | |
python -m pytest \ | |
-rxXs \ | |
--tb=native \ | |
--verbose \ | |
--color=yes \ | |
--cov=src \ | |
tests | |
- name: Upload coverage | |
# any except canceled or skipped | |
if: >- | |
always() && | |
(steps.test.outcome == 'success' || steps.test.outcome == 'failure') && | |
startsWith(github.repository, 'LizardByte/') | |
uses: codecov/codecov-action@v4 | |
with: | |
fail_ci_if_error: true | |
token: ${{ secrets.CODECOV_TOKEN }} | |
- name: Create/Update GitHub Release | |
if: >- | |
(github.event_name == 'push' && github.ref == 'refs/heads/master') && | |
steps.setup-release.outputs.publish_release == 'true' | |
uses: LizardByte/create-release-action@v2024.919.143026 | |
with: | |
allowUpdates: true | |
artifacts: '' | |
body: ${{ steps.setup-release.outputs.release_body }} | |
generateReleaseNotes: ${{ steps.setup-release.outputs.release_generate_release_notes }} | |
name: ${{ steps.setup-release.outputs.release_tag }} | |
prerelease: true | |
tag: ${{ steps.setup-release.outputs.release_tag }} | |
token: ${{ secrets.GH_BOT_TOKEN }} |