This repository has been archived by the owner on Jan 19, 2025. It is now read-only.
fix: version #19
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: Generate Images Pipeline | |
on: | |
push: | |
branches: | |
- 'master' | |
jobs: | |
generate-images: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18.x' | |
- name: Install XVFB | |
run: sudo apt-get update && sudo apt-get install -y xvfb | |
- name: Start XVFB | |
run: | | |
Xvfb :99 -screen 0 1024x768x24 & | |
export DISPLAY=:99 | |
export XVFB_PID=$! | |
- name: Install diagrams package | |
run: npm install -g diagrams | |
- name: Install dependencies | |
run: | | |
sudo apt update | |
sudo apt install -y graphviz | |
pip install pylint pyflowchart graphviz | |
- name: Cleanup old schemes | |
run: | | |
rm -rf diagrams/* | |
- name: Run Python scripts | |
run: | | |
pyreverse --output-directory diagrams/ -f ALL immunity_agent/ | |
find diagrams/ -name '*.dot' -exec sed -i 's/green/black/g' {} + | |
dot -Tpng diagrams/classes.dot -o diagrams/classes.png | |
dot -Tpng diagrams/packages.dot -o diagrams/packages.png | |
- name: Generate flowcharts as txt | |
run: | | |
python3 generate_flowcharts.py | |
- name: Flowcharts to png | |
run: | | |
for file in diagrams/*.txt; do DISPLAY=:99 diagrams flowchart "$file" "${file%.txt}.svg"; done | |
- name: Generate Dockerfile diagram | |
run: | | |
sudo docker run --rm --user "$(id -u):$(id -g)" --workdir /workspace --volume "$(pwd)":/workspace ghcr.io/patrickhoefler/dockerfilegraph:alpine -o png -f Dockerfile --layers --legend | |
mv Dockerfile.png diagrams/. | |
- name: Stage new files | |
run: git add . | |
- name: Commit changes | |
run: | | |
git config user.name ${{ secrets.GIT_NAME }} | |
git config user.email ${{ secrets.GIT_EMAIL }} | |
git commit -m "auto: generated schemes" || echo "No changes to commit" | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} |