Skip to content

Commit 18183c9

Browse files
committed
ci(health-check): split ansible artifacts into dedicated workflow
Separate the heavy artifacts download from the ansible install health-check. The main workflow now skips the artifacts tag and runs on ubuntu-latest, while a new workflow runs only the artifacts role and reports its size. Signed-off-by: Mete Fatih Cırıt <mfc@autoware.org>
1 parent 9883bc1 commit 18183c9

2 files changed

Lines changed: 98 additions & 23 deletions

File tree

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: health-check-ansible-artifacts
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- synchronize
8+
- reopened
9+
- labeled
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
changed-files:
17+
runs-on: ubuntu-latest
18+
outputs:
19+
should-run: ${{ steps.check.outputs.any_changed }}
20+
steps:
21+
- uses: actions/checkout@v6
22+
with:
23+
fetch-depth: 0
24+
25+
- id: check
26+
uses: step-security/changed-files@v47
27+
with:
28+
files: |
29+
ansible/roles/artifacts/**
30+
ansible/playbooks/install_dev_env.yaml
31+
ansible/scripts/install-ansible.sh
32+
ansible-galaxy-requirements.yaml
33+
.github/workflows/health-check-ansible-artifacts.yaml
34+
35+
require-label:
36+
needs: changed-files
37+
if: needs.changed-files.outputs.should-run == 'true'
38+
uses: autowarefoundation/autoware-github-actions/.github/workflows/require-label.yaml@v1
39+
with:
40+
label: run:health-check
41+
42+
install-artifacts:
43+
needs: require-label
44+
if: needs.require-label.outputs.result == 'true'
45+
runs-on: ubuntu-latest
46+
steps:
47+
- name: 🛒 Check out repository
48+
uses: actions/checkout@v6
49+
50+
- name: 💾 Show disk space (before install)
51+
run: df -h
52+
53+
- name: 🔧 Install ansible
54+
run: bash ansible/scripts/install-ansible.sh
55+
56+
- name: 📦 Download artifacts via ansible
57+
run: |
58+
export PATH="$HOME/.local/bin:$PATH"
59+
ansible-galaxy collection install -f -r ansible-galaxy-requirements.yaml
60+
ansible-playbook autoware.dev_env.install_dev_env --tags artifacts -v
61+
62+
- name: 📊 Report artifacts size and disk space
63+
run: |
64+
df -h
65+
size_bytes=$(du -sb "$HOME/autoware_data" 2>/dev/null | awk '{print $1+0}')
66+
size_gb=$(awk -v b="${size_bytes:-0}" 'BEGIN { printf "%.2f", b/1e9 }')
67+
echo "📦 Artifacts directory size: ${size_gb} GB"
68+
{
69+
echo "## 📦 Artifacts download"
70+
echo ""
71+
echo "Total size of \`$HOME/autoware_data\`: **${size_gb} GB**"
72+
} >> "$GITHUB_STEP_SUMMARY"

.github/workflows/health-check-ansible.yaml

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
- labeled
1010

1111
concurrency:
12-
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
12+
group: ${{ github.workflow }}-${{ github.ref }}
1313
cancel-in-progress: true
1414

1515
jobs:
@@ -29,6 +29,8 @@ jobs:
2929
ansible/**
3030
ansible-galaxy-requirements.yaml
3131
.github/workflows/health-check-ansible.yaml
32+
files_ignore: |
33+
ansible/roles/artifacts/**
3234
3335
require-label:
3436
needs: changed-files
@@ -39,8 +41,8 @@ jobs:
3941

4042
install-dev-env:
4143
needs: require-label
42-
if: ${{ needs.require-label.outputs.result == 'true' }}
43-
runs-on: [self-hosted, Linux, X64]
44+
if: needs.require-label.outputs.result == 'true'
45+
runs-on: ubuntu-latest
4446
strategy:
4547
fail-fast: false
4648
matrix:
@@ -50,15 +52,16 @@ jobs:
5052
container:
5153
image: ${{ matrix.image }}
5254
steps:
53-
- name: Check out repository
55+
- name: 🛒 Check out repository
5456
uses: actions/checkout@v6
5557

56-
- name: Show disk space
57-
if: always()
58+
- name: 💾 Show disk space (before install)
59+
id: disk-before
5860
run: |
5961
df -h
62+
echo "used_bytes=$(df -B1 --output=used / | tail -1 | tr -d ' ')" >> "$GITHUB_OUTPUT"
6063
61-
- name: Configure apt retries and mirror fallback
64+
- name: 🌐 Configure apt and debconf
6265
run: |
6366
echo 'Acquire::Retries "5";' > /etc/apt/apt.conf.d/99-retries
6467
echo 'Acquire::http::Timeout "30";' >> /etc/apt/apt.conf.d/99-retries
@@ -69,27 +72,27 @@ jobs:
6972
sed -E -i 's|http://archive\.ubuntu\.com/ubuntu/?|mirror+file:///etc/apt/ubuntu-mirrors.list|g' "$f"
7073
fi
7174
done
75+
echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
7276
73-
- name: Install dependencies
74-
run: |
75-
apt-get update
76-
apt-get install -y git sudo curl ca-certificates apt-utils
77-
78-
- name: Install tzdata non-interactively
79-
run: |
80-
DEBIAN_FRONTEND=noninteractive apt-get install -y tzdata
81-
82-
- name: Set git config
83-
uses: autowarefoundation/autoware-github-actions/set-git-config@v1
84-
with:
85-
token: ${{ secrets.GITHUB_TOKEN }}
86-
87-
- name: Install dev environment via ansible
77+
- name: 🔧 Install dev environment via ansible
8878
run: |
8979
bash ansible/scripts/install-ansible.sh
9080
export PATH="$HOME/.local/bin:$PATH"
9181
ansible-galaxy collection install -f -r ansible-galaxy-requirements.yaml
92-
ansible-playbook autoware.dev_env.install_dev_env -v
82+
ansible-playbook autoware.dev_env.install_dev_env --skip-tags artifacts -v
83+
84+
- name: 📊 Report installation disk footprint
85+
run: |
86+
df -h
87+
used_bytes_after=$(df -B1 --output=used / | tail -1 | tr -d ' ')
88+
delta=$(( used_bytes_after - ${{ steps.disk-before.outputs.used_bytes }} ))
89+
delta_gb=$(awk -v b="${delta}" 'BEGIN { printf "%.2f", b/1e9 }')
90+
echo "📦 Installation disk usage: ${delta_gb} GB"
91+
{
92+
echo "## 📦 Installation disk usage (\`${{ matrix.image }}\`)"
93+
echo ""
94+
echo "Root filesystem grew by **${delta_gb} GB** during the install."
95+
} >> "$GITHUB_STEP_SUMMARY"
9396
9497
install-dev-env-required:
9598
needs: install-dev-env

0 commit comments

Comments
 (0)