⬆️ Bump isort from 6.0.0 to 6.0.1 #973
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: DuckBot CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python Environment | |
id: venv | |
uses: ./.github/actions/setup-python-venv | |
with: | |
extras: dev | |
- name: Run Tests | |
run: | | |
. ${{ steps.venv.outputs.path }}/bin/activate | |
pytest --cov=duckbot --cov-branch --cov-report xml --cov-report term-missing:skip-covered | |
- name: Report Code Coverage | |
if: ${{ always() }} | |
uses: codecov/codecov-action@v5 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
- name: Run Linter | |
run: | | |
. ${{ steps.venv.outputs.path }}/bin/activate | |
flake8 duckbot tests *.py && mdformat --check duckbot tests wiki *.md | |
sanity: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Test Connection to Discord | |
run: | | |
docker compose run --rm \ | |
-e 'DUCKBOT_ARGS=connection-test' \ | |
-e "DISCORD_TOKEN=$(cat .github/workflows/test-token.txt | base64 --decode)" \ | |
duckbot | |
synthesize: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up CDK | |
id: cdk | |
uses: ./.github/actions/setup-aws-cdk | |
- name: Synthesize CDK Stack | |
working-directory: .aws | |
run: | | |
. ../${{ steps.cdk.outputs.venv-path }}/bin/activate | |
cdk synth | |
deploy: | |
needs: | |
- test | |
- sanity | |
- synthesize | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' && github.repository == 'duck-dynasty/duckbot' | |
concurrency: deploy | |
environment: prod | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build and Push Docker Image | |
id: image | |
uses: ./.github/actions/build-push-docker-image | |
with: | |
docker-pass: ${{ secrets.DOCKER_PASS }} | |
- name: Publish Wiki Documentation | |
uses: SwiftDocOrg/github-wiki-publish-action@v1 | |
with: | |
path: wiki | |
env: | |
GH_PERSONAL_ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} | |
WIKI_COMMIT_MESSAGE: ${{ github.event.commits[0].message }} | |
GITHUB_ACTOR: ${{ github.event.commits[0].author.name }} | |
- name: Set up CDK | |
id: cdk | |
uses: ./.github/actions/setup-aws-cdk | |
- name: Configure AWS Credentials | |
uses: aws-actions/[email protected] | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-east-1 | |
- name: Synthesize CDK Stack | |
env: | |
SECRETS: ${{ toJson(secrets) }} | |
working-directory: .aws | |
run: | | |
. ../${{ steps.cdk.outputs.venv-path }}/bin/activate | |
export $(jq -r 'to_entries | .[] | "\(.key)=\(.value)"' <<< "$SECRETS" | xargs) | |
echo "::group::cdk synth" | |
cdk synth --context duckbot_image=${{ steps.image.outputs.commit }} | |
echo "::endgroup::" | |
echo "::group::cdk diff" | |
cdk diff --context duckbot_image=${{ steps.image.outputs.commit }} || true | |
echo "::endgroup::" | |
echo "::group::cdk deploy" | |
cdk deploy \ | |
--force --all \ | |
--context duckbot_image=${{ steps.image.outputs.commit }} \ | |
--context write_secrets=true \ | |
--require-approval never \ | |
--progress events | |
echo "::endgroup::" |