Repository navigation
Expand file tree
/
Copy pathaction.yml
More file actions
157 lines (148 loc) · 5.85 KB
/
Copy pathaction.yml
File metadata and controls
157 lines (148 loc) · 5.85 KB
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
name: "Setup nix"
inputs:
setup-magic-nix-cache:
description: "whether to set up magic-nix-cache"
default: true
required: false
type: boolean
setup-cachix:
description: "whether to set up cachix"
default: true
required: false
type: boolean
cachix-push-filter:
description: "push filter for cachix (fitler out upload for those outputs)"
required: false
type: string
cachix-name:
description: "cachix name"
required: false
type: string
free-disk-space:
description: "whether to free disk space"
default: false
required: false
type: boolean
setup-qemu:
description: "whether to set up qemu"
default: true
required: false
type: boolean
system-features:
description: "list of system features to enable (strings separated by ,)"
required: false
type: string
extra-platforms:
description: "list of extra platforms to enable (strings separated by ,)"
required: false
type: string
nix-systems:
description: "DEPRECATED use extra-platforms, list of extra platforms to enable (strings separated by ,)"
required: false
type: string
cachix-auth-token:
description: "auth token for cachix"
required: false
type: string
runs:
using: "composite"
steps:
- name: Install nix
uses: cachix/install-nix-action@v26
with:
extra_nix_config: |
experimental-features = nix-command flakes
access-tokens = github.com=${{ github.token }}
substituters = https://cache.nixos.org
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
- name: Setup magic-nix-cache
if: format('{0}', inputs.setup-cachix) == 'true'
uses: DeterminateSystems/magic-nix-cache-action@v2
with:
diagnostic-endpoint: ""
- name: Setup cachix
# What the fuck is this shit? See https://github.com/actions/runner/issues/1483
if: format('{0}', inputs.setup-cachix) == 'true'
uses: cachix/cachix-action@v13
with:
name: ${{ inputs.cachix-name == '' && github.repository_owner || inputs.cachix-name }}
pushFilter: ${{ inputs.cachix-push-filter }}
authToken: ${{ inputs.cachix-auth-token }}
- name: Change nix configuration
shell: bash
run: |
mkdir -p ~/.config/nix/
cat <<EOF | tee -a ~/.config/nix/nix.conf
sandbox = false
EOF
declare -a extra_platforms=($(echo "${{ inputs.extra-platforms }}" | tr ',' '\n' | xargs))
extra_platforms+=($(echo "${{ inputs.nix-systems }}" | tr ',' '\n' | xargs))
if (( ${#extra_platforms[@]} )); then
cat <<EOF | tee -a ~/.config/nix/nix.conf
extra-platforms = ${extra_platforms[*]}
EOF
fi
declare -a system_features=($(echo "${{ inputs.system-features }}" | tr ',' '\n' | xargs))
if (( ${#system_features[@]} )); then
cat <<EOF | tee -a ~/.config/nix/nix.conf
system-features = ${system_features[*]}
EOF
fi
# https://github.com/actions/virtual-environments/issues/2840#issuecomment-790492173
# https://github.com/actions/virtual-environments/issues/709
- name: Free some disk space
if: format('{0}', inputs.free-disk-space) == 'true' && runner.os == 'Linux'
shell: bash
run: |
set +e
echo "=============================================================================="
echo "Listing 100 largest packages"
echo "=============================================================================="
dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n | tail -n 100
echo "=============================================================================="
echo "Removing large packages"
echo "=============================================================================="
sudo snap remove chromium
sudo snap remove gnome
sudo snap remove lxd
sudo apt-get remove -y '^ghc-.*'
sudo apt-get remove -y '^adoptopenjdk-.*'
sudo apt-get remove -y '^dotnet-.*'
sudo apt-get remove -y '^llvm-.*'
sudo apt-get remove -y 'libllvm.*'
sudo apt-get remove -y 'libclang.*'
sudo apt-get remove -y 'php.*'
sudo apt-get remove -y '^mysql-server.*'
sudo apt-get remove -y '^mongodb.*'
sudo apt-get remove -y azure-cli
sudo apt-get remove -y google-cloud-sdk
sudo apt-get remove -y hhvm
sudo apt-get remove -y google-chrome-stable
sudo apt-get remove -y firefox
sudo apt-get remove -y libgl1-mesa-dri
sudo apt-get remove -y powershell
sudo apt-get remove -y snapd
sudo apt-get clean
echo "=============================================================================="
echo "Removing large directories"
echo "=============================================================================="
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf /root/.nuget
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
sudo rm -rf /usr/local/lib/android
sudo rm -rf /usr/share/rust
sudo rm -rf /usr/share/swift
sudo rm -rf /var/lib/snapd
sudo rm -rf /usr/local/graalvm
sudo rm -rf /home/linuxbrew/.linuxbrew
sudo rm -rf /usr/local/.ghcup/ghc
echo "=============================================================================="
echo "Showing disk usage"
echo "=============================================================================="
df -h
# github actions does not support virtualization yet https://github.com/actions/virtual-environments/issues/183
- name: Install qemu
if: format('{0}', inputs.setup-qemu) == 'true' && runner.os == 'Linux'
uses: docker/setup-qemu-action@v3