Add test-docker-release ci #34
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: Test Release | |
on: | |
pull_request: | |
branches: | |
- develop | |
- main | |
paths: | |
- "apps/cargo-scout-audit/**" | |
- "scout-audit-dylint-linting/**" | |
- "scout-audit-clippy-utils/**" | |
- "scout-audit-clippy-config/**" | |
env: | |
PYTHONUNBUFFERED: 1 | |
REGISTRY: coinfabrik | |
IMAGE_NAME: scout | |
jobs: | |
filter-paths: | |
name: Filter modified paths by PR | |
runs-on: ubuntu-latest | |
outputs: | |
scout-audit: ${{ steps.filter.outputs.scout_audit }} | |
dylint-linting: ${{ steps.filter.outputs.dylint_linting }} | |
clippy-utils: ${{ steps.filter.outputs.clippy_utils }} | |
clippy-config: ${{ steps.filter.outputs.clippy_config }} | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Filter Paths | |
uses: dorny/paths-filter@v3 | |
id: filter | |
with: | |
filters: | | |
scout_audit: | |
- 'apps/cargo-scout-audit/**' | |
dylint_linting: | |
- 'scout-audit-dylint-linting/**' | |
clippy_utils: | |
- 'scout-audit-clippy-utils/**' | |
clippy_config: | |
- 'scout-audit-clippy-config/**' | |
test-release: | |
name: Test dry-run release | |
needs: filter-paths | |
runs-on: ubuntu-latest | |
outputs: | |
scout-audit: ${{ steps.scout-audit.outputs.result }} | |
dylint-linting: ${{ steps.dylint-linting.outputs.result }} | |
clippy-utils: ${{ steps.clippy-utils.outputs.result }} | |
clippy-config: ${{ steps.clippy-config.outputs.result }} | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install requests toml | |
- name: Test Scout Audit | |
id: scout-audit | |
if: ${{ needs.filter-paths.outputs.scout-audit == 'true' }} | |
run: | | |
python scripts/publish-to-crates-io.py --crate-path apps/cargo-scout-audit --dry-run | |
echo "result=success" >> $GITHUB_OUTPUT | |
- name: Test Dylint Linting | |
id: dylint-linting | |
if: ${{ needs.filter-paths.outputs.dylint-linting == 'true' }} | |
run: | | |
python scripts/publish-to-crates-io.py --crate-path scout-audit-dylint-linting --dry-run | |
echo "result=success" >> $GITHUB_OUTPUT | |
- name: Test Clippy Utils | |
id: clippy-utils | |
if: ${{ needs.filter-paths.outputs.clippy-utils == 'true' }} | |
run: | | |
python scripts/publish-to-crates-io.py --crate-path scout-audit-clippy-linting --dry-run | |
echo "result=success" >> $GITHUB_OUTPUT | |
- name: Test Clippy Config | |
id: clippy-config | |
if: ${{ needs.filter-paths.outputs.clippy-config == 'true' }} | |
run: | | |
python scripts/publish-to-crates-io.py --crate-path scout-audit-clippy-config --dry-run | |
echo "result=success" >> $GITHUB_OUTPUT | |
test-docker-release: | |
name: Test docker release | |
runs-on: ubuntu-latest | |
needs: filter-paths | |
if: ${{ needs.filter-paths.outputs.scout-audit == 'true' }} | |
permissions: | |
packages: write | |
contents: read | |
attestations: write | |
id-token: write | |
outputs: | |
docker-release: ${{ steps.test-docker-release.outputs.result }} | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Get scout version | |
id: scout-version | |
run: | | |
version=$(cat apps/cargo-scout-audit/Cargo.toml | grep '^version' | head -1 | awk -F '"' '{print $2}') | |
echo "Version extracted: $version" | |
echo "version=$version" >> $GITHUB_OUTPUT | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build Docker image | |
id: push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./Dockerfile | |
cache-from: type=gha | |
cache-to: type=gha | |
push: false | |
tags: | | |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}:${{ steps.scout-version.outputs.version }}, | |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}:latest | |
- name: Set Docker release status | |
id: test-docker-release | |
run: echo "result=success" >> $GITHUB_OUTPUT | |
comment-on-pr: | |
name: Comment on PR about release status | |
runs-on: ubuntu-latest | |
if: ${{ always() }} | |
needs: [filter-paths, test-release, test-docker-release] | |
steps: | |
- name: Find existing comment | |
id: find_comment | |
uses: peter-evans/find-comment@v3 | |
with: | |
issue-number: ${{ github.event.pull_request.number }} | |
body-includes: "🚀 Release Dry-Run Summary" | |
- name: Create or Update PR Comment | |
uses: peter-evans/create-or-update-comment@v4.0.0 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
comment-id: ${{ steps.find_comment.outputs.comment-id }} | |
edit-mode: replace | |
issue-number: ${{ github.event.pull_request.number }} | |
body: | | |
## 🚀 Release Dry-Run Summary | |
| Crate | Release Status | Dry Run Status | | |
| --- | --- | --- | | |
| [cargo-scout-audit](https://crates.io/crates/cargo-scout-audit) | ${{ needs.filter-paths.outputs.scout-audit == 'true' && '🟢 Releasing' || '🔴 Not Releasing' }} | ${{ needs.filter-paths.outputs.scout-audit == 'true' && (needs.test-release.outputs.scout-audit == 'success' && '✅ Successful' || '❌ Failed') || 'N/A' }} | | |
| [scout-audit-dylint-linting](https://crates.io/crates/scout-audit-dylint-linting) | ${{ needs.filter-paths.outputs.dylint-linting == 'true' && '🟢 Releasing' || '🔴 Not Releasing' }} | ${{ needs.filter-paths.outputs.dylint-linting == 'true' && (needs.test-release.outputs.dylint-linting == 'success' && '✅ Successful' || '❌ Failed') || 'N/A' }} | | |
| [scout-audit-clippy-utils](https://crates.io/crates/scout-audit-clippy-utils) | ${{ needs.filter-paths.outputs.clippy-utils == 'true' && '🟢 Releasing' || '🔴 Not Releasing' }} | ${{ needs.filter-paths.outputs.clippy-utils == 'true' && (needs.test-release.outputs.clippy-utils == 'success' && '✅ Successful' || '❌ Failed') || 'N/A' }} | | |
| [scout-audit-clippy-config](https://crates.io/crates/scout-audit-clippy-config) | ${{ needs.filter-paths.outputs.clippy-config == 'true' && '🟢 Releasing' || '🔴 Not Releasing' }} | ${{ needs.filter-paths.outputs.clippy-config == 'true' && (needs.test-release.outputs.clippy-config == 'success' && '✅ Successful' || '❌ Failed') || 'N/A' }} | | |
| [scout-docker](https://hub.docker.com/repository/docker/coinfabrik/scout/general) | ${{ needs.filter-paths.outputs.scout-audit == 'true' && '🟢 Releasing' || '🔴 Not Releasing' }} | ${{ needs.filter-paths.outputs.scout-audit == 'true' && (needs.test-docker-release.outputs.docker-release == 'success' && '✅ Successful' || '❌ Failed') || 'N/A' }} | |