-
Notifications
You must be signed in to change notification settings - Fork 1
126 lines (117 loc) · 5.08 KB
/
UbuntuGH.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
name: Ubuntu GH
on:
schedule:
# weekly, randomly chosen time
# Runs at 03:17, only on Wednesday
- cron: "17 3 * * 3"
push:
branches: [ "devel", "testing", "stable", "LTS" ]
paths:
- '*.sh'
- 'CommonInitScripts/**.sh*'
- 'UbuntuCLI/**.sh'
- 'Ubuntu_22.04/**.sh'
- 'Ubuntu_22.04/RootDotfiles/**'
- '.github/workflows/UbuntuGH.yml'
pull_request:
branches: [ "devel", "testing", "stable", "LTS" ]
jobs:
build:
if: |
!endsWith(github.event.head_commit.message, 'Add a TODO') &&
!endsWith(github.event.head_commit.message, 'Add TODOs') &&
!endsWith(github.event.head_commit.message, 'Remove a completed TODO')
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, ubuntu-24.04]
gui: [GNOME, CLI] # TODO Add GNOME test to containers.yml
name: ${{ matrix.os }}_${{ matrix.gui }}
runs-on: ${{ matrix.os }}
steps:
- name: Check disk space on the GitHub runner (before)
run: df -ha
- name: List tools in $AGENT_TOOLSDIRECTORY (Free Disk Space removes it)
run: echo $AGENT_TOOLSDIRECTORY && ls $AGENT_TOOLSDIRECTORY
# Note: Free Disk Space was added because the idempotency test
# i.e. copying home to /tmp was running out of disk space on
# Ubuntu 22.04 with GNOME. This only needs to be run for branches
# of the matrix that fail because of low disk space (otherwise
# this step should be skipped).
# Note2: Also running Free Disk Space on Ubuntu 24.04 with GNOME
# as it only has 5GB of disk space left.
- name: Free Disk Space (Ubuntu)
if: matrix.gui == 'GNOME'
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: true
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: false # swap is on a separate partition anyway
- name: Update APT & upgrade (needed to install GNOME)
if: matrix.gui == 'GNOME'
run: sudo apt-get update -y && sudo apt-get upgrade -y
- name: Install GNOME Desktop (if needed)
if: matrix.gui == 'GNOME'
run: sudo apt-get install -y ubuntu-desktop-minimal
- uses: actions/checkout@v4
- name: Checked out to `github.ref=${{ github.ref }}` and `github.sha=${{ github.sha }}`
run: "echo Ref: ${{ github.ref }}, SHA: ${{ github.sha }}" # this is printing the vars twice... TODO try improving
- name: Running iniPC script for the 1st time should not fail.
run: ./run_init.sh --noninteractive
- name: Print default paths
run: |
echo GITHUB_WORKSPACE = $GITHUB_WORKSPACE
echo RUNNER_TOOL_CACHE = $RUNNER_TOOL_CACHE
echo RUNNER_TEMP = $RUNNER_TEMP
# TODO research on what is the /mnt partition on GitHub runners for
# and whether it is a better place to store the old_home directory
# (it probably does not count to the root file system limit)
# See the Check disk space step for more info
# TODO confirm that /mnt can be used this way
# MNT is so-called "temporary disk"
# https://learn.microsoft.com/en-us/azure/virtual-machines/managed-disks-overview#disk-roles
# but it is not documented well...
# EXPERIMENT RESULT: I get `cp: cannot create directory '/mnt/old_home/': Permission denied`
# when I try to use /mnt instead of /tmp
# Copying to /mnt with sudo works ok, however - it, therefore, could be used...
# but it is not needed for now...
# Also old_home is just around 1.5GB, hence if I am out of space
# using /mnt not save me. What could save me is this GitHub action:
# https://github.com/marketplace/actions/maximize-build-disk-space
# - name: List /mnt
# run: ls /mnt && echo . && cat /mnt/DATALOSS_WARNING_README.txt
- name: save ~/ for idempotency test
run: cp -r ~/ /tmp/old_home/
- name: Print /tmp/old_home/ size
run: du -sh /tmp/old_home/
- name: Running iniPC script for the 2nd time should not fail.
run: ./run_init.sh --noninteractive
# TODO split this command to multiple lines
# TODO also test that the first run of initPC script does change the state of home dir
# TODO - test whether the test works as expected
# TODO - add more paths e.g. /etc/ a.s.o.
# TODO - be more specific in work/_temp/ path
# TODO also add other config style directories such as /etc
- name: The initPC script should be idempotent on ~/ directory (WIP - needs testing & tuning)
run: |
cd ~
pwd
find . -type f \( \
! -path "./.cargo/.global-cache" \
! -path "./.cache/*" \
! -path "./.dotfiles/logs/HEAD" \
! -path "*work/_temp/*" \
! -path "./runners/*" \
! -path "./x/helix/.git/*" \
! -iname "*.log" \
! -name ".wget-hsts" \
\) -print0 |
xargs -0 -I{} bash -c 'if ! diff "$1" "/tmp/old_home/$1"; then echo "diff failed for: $1"; exit 1; fi' bash {}
- name: Check disk space on the GitHub runner (after)
run: df -ha