Skip to content

Commit a358bbb

Browse files
committed
ci(ansible): split artifacts health check into its own workflow
Signed-off-by: Mete Fatih Cırıt <mfc@autoware.org>
1 parent 54adcea commit a358bbb

2 files changed

Lines changed: 104 additions & 23 deletions

File tree

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

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

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,12 @@ 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

15+
permissions:
16+
contents: read
17+
1518
jobs:
1619
changed-files:
1720
runs-on: ubuntu-latest
@@ -29,6 +32,8 @@ jobs:
2932
ansible/**
3033
ansible-galaxy-requirements.yaml
3134
.github/workflows/health-check-ansible.yaml
35+
files_ignore: |
36+
ansible/roles/artifacts/**
3237
3338
require-label:
3439
needs: changed-files
@@ -39,8 +44,8 @@ jobs:
3944

4045
install-dev-env:
4146
needs: require-label
42-
if: ${{ needs.require-label.outputs.result == 'true' }}
43-
runs-on: [self-hosted, Linux, X64]
47+
if: needs.require-label.outputs.result == 'true'
48+
runs-on: ubuntu-latest
4449
strategy:
4550
fail-fast: false
4651
matrix:
@@ -50,15 +55,16 @@ jobs:
5055
container:
5156
image: ${{ matrix.image }}
5257
steps:
53-
- name: Check out repository
58+
- name: 🛒 Check out repository
5459
uses: actions/checkout@v6
5560

56-
- name: Show disk space
57-
if: always()
61+
- name: 💾 Show disk space (before install)
62+
id: disk-before
5863
run: |
5964
df -h
65+
echo "used_bytes=$(df -B1 --output=used / | tail -1 | tr -d ' ')" >> "$GITHUB_OUTPUT"
6066
61-
- name: Configure apt retries and mirror fallback
67+
- name: 🌐 Configure apt and debconf
6268
run: |
6369
echo 'Acquire::Retries "5";' > /etc/apt/apt.conf.d/99-retries
6470
echo 'Acquire::http::Timeout "30";' >> /etc/apt/apt.conf.d/99-retries
@@ -69,24 +75,24 @@ jobs:
6975
sed -E -i 's|http://archive\.ubuntu\.com/ubuntu/?|mirror+file:///etc/apt/ubuntu-mirrors.list|g' "$f"
7076
fi
7177
done
78+
echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
7279
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
80+
- name: 🔧 Install dev environment via ansible
8881
run: |
8982
bash ansible/scripts/install-ansible.sh
9083
export PATH="$HOME/.local/bin:$PATH"
9184
ansible-galaxy collection install -f -r ansible-galaxy-requirements.yaml
92-
ansible-playbook autoware.dev_env.install_dev_env -v
85+
ansible-playbook autoware.dev_env.install_dev_env --skip-tags artifacts -v
86+
87+
- name: 📊 Report installation disk footprint
88+
run: |
89+
df -h
90+
used_bytes_after=$(df -B1 --output=used / | tail -1 | tr -d ' ')
91+
delta=$(( used_bytes_after - ${{ steps.disk-before.outputs.used_bytes }} ))
92+
delta_gb=$(awk -v b="${delta}" 'BEGIN { printf "%.2f", b/1e9 }')
93+
echo "📦 Installation disk usage: ${delta_gb} GB"
94+
{
95+
echo "## 📦 Installation disk usage (\`${{ matrix.image }}\`)"
96+
echo ""
97+
echo "Root filesystem grew by **${delta_gb} GB** during the install."
98+
} >> "$GITHUB_STEP_SUMMARY"

0 commit comments

Comments
 (0)