Skip to content

🐛 ensure release job blocks PRs, fix broken markdown format #4679

🐛 ensure release job blocks PRs, fix broken markdown format

🐛 ensure release job blocks PRs, fix broken markdown format #4679

Workflow file for this run

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@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Run Linter
run: |
. ${{ steps.venv.outputs.path }}/bin/activate
flake8 duckbot tests
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
release:
needs:
- test
- sanity
- synthesize
runs-on: ubuntu-latest
if: ${{ always() }}
steps:
- run: exit 1
if: ${{ contains(needs.*.result, 'failure') }}
- run: echo all checks passed
deploy:
needs:
- release
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.repository == 'duck-dynasty/duckbot'
concurrency: deploy
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/configure-aws-credentials@v4.0.2
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::"