Update GitHub Actions workflow to enhance testing and building process
This commit is contained in:
31
.github/workflows/build.yml
vendored
31
.github/workflows/build.yml
vendored
@ -1,13 +1,15 @@
|
|||||||
---
|
---
|
||||||
name: Test code
|
name: Test and build Docker image
|
||||||
on:
|
on:
|
||||||
schedule:
|
|
||||||
- cron: "27 6 * * *"
|
|
||||||
push:
|
push:
|
||||||
pull_request:
|
pull_request:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
schedule:
|
||||||
|
- cron: "0 6 * * *"
|
||||||
|
|
||||||
env:
|
env:
|
||||||
TEST_WEBHOOK_URL: ${{ secrets.TEST_WEBHOOK_URL }}
|
TEST_WEBHOOK_URL: ${{ secrets.TEST_WEBHOOK_URL }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@ -16,9 +18,20 @@ jobs:
|
|||||||
- uses: actions/setup-python@v5
|
- uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: 3.12
|
python-version: 3.12
|
||||||
- run: pipx install poetry
|
- uses: astral-sh/setup-uv@v5
|
||||||
- run: poetry install
|
with:
|
||||||
- run: poetry run pytest
|
version: "latest"
|
||||||
|
- run: uv sync --all-extras --all-groups
|
||||||
|
- run: uv run pytest
|
||||||
|
ruff:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: astral-sh/ruff-action@v3
|
||||||
|
with:
|
||||||
|
version: "latest"
|
||||||
|
- run: ruff check --exit-non-zero-on-fix --verbose
|
||||||
|
- run: ruff format --check --verbose
|
||||||
|
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@ -29,9 +42,12 @@ jobs:
|
|||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
needs: test
|
needs: [test, ruff]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
- uses: docker/setup-qemu-action@v3
|
||||||
|
with:
|
||||||
|
platforms: all
|
||||||
- uses: docker/setup-buildx-action@v3
|
- uses: docker/setup-buildx-action@v3
|
||||||
- uses: docker/login-action@v3
|
- uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
@ -41,6 +57,7 @@ jobs:
|
|||||||
- uses: docker/build-push-action@v6
|
- uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
|
platforms: linux/amd64, linux/arm64
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
tags: |
|
tags: |
|
||||||
ghcr.io/thelovinator1/discord-rss-bot:latest
|
ghcr.io/thelovinator1/discord-rss-bot:latest
|
||||||
|
Reference in New Issue
Block a user