-
-
Notifications
You must be signed in to change notification settings - Fork 22
/
toast.yml
152 lines (136 loc) · 3.83 KB
/
toast.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
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
image: ubuntu:24.04
default: check
user: user
command_prefix: |
# Make not silently ignore errors.
set -euo pipefail
# Load the NVM startup file, if it exists.
if [ -f "$HOME/.nvm/nvm.sh" ]; then
export NVM_DIR="$HOME/.nvm"
. "$HOME/.nvm/nvm.sh"
fi
# Make Bash log commands.
set -x
tasks:
install_packages:
description: Install system packages.
user: root
command: |
# Install the following packages:
#
# - ca-certificates - Used for installing Node.js
# - curl - Used for installing Node.js and Tagref
# - gnupg - Used for installing Node.js
# - ripgrep - Used for various linting tasks
# - zip - Used for producing the production release
apt-get update
apt-get install --yes ca-certificates curl gnupg ripgrep zip
install_tagref:
description: Install Tagref, a reference checking tool.
dependencies:
- install_packages
user: root
command: |
# Install Tagref using the official installer script.
curl https://raw.githubusercontent.com/stepchowfun/tagref/main/install.sh -LSfs | sh
create_user:
description: Create a user who doesn't have root privileges.
user: root
command: |
# Create a user named `user` with a home directory and with Bash as the login shell.
useradd user --create-home --shell /bin/bash
install_node:
description: Install Node.js, a JavaScript runtime environment.
dependencies:
- install_packages
- create_user
command: |
# Install Node.js.
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
export NVM_DIR="$HOME/.nvm"
. "$NVM_DIR/nvm.sh"
nvm install 18.17.0
install_tools:
description: Install the tools needed to build and validate the extension.
dependencies:
- create_user
- install_node
- install_tagref
repository:
description: Import the repository.
dependencies:
- install_tools
input_paths:
- .
excluded_input_paths:
- .git
# [tag:excluded_input_paths] Keep this in sync with [file:.gitignore].
- website/
- dist/
- hashpass.zip
- node_modules/
build:
description: Build the extension.
dependencies:
- repository
input_paths:
- src
command: |
# Build the extension.
npm ci
npm run build-production # [tag:build_production]
check:
description: Run the tests and linters.
dependencies:
- build
command: |
# Validate the source code.
npm run check
# Check references with Tagref.
tagref
# Enforce that lines span no more than 100 columns.
if rg --line-number --type ts '.{101}' src; then
echo 'There are lines spanning more than 100 columns.' >&2
exit 1
fi
release:
description: Build the production release.
dependencies:
- check # [ref:build_production]
input_paths:
- images
- index.html
- manifest.json
output_paths:
- website
- hashpass.zip
command: |
# Create a directory containing the relevant files for the website.
mkdir website
cp -R \
HEROICONS-LICENSE.md \
LICENSE.md \
dist \
images \
index.html \
website
# Create a ZIP file containing the relevant files for the Chrome extension.
zip -r hashpass.zip \
HEROICONS-LICENSE.md \
LICENSE.md \
dist \
images \
index.html \
manifest.json \
src
# Inform the user of where the artifact is.
echo 'Generated `website` and `hashpass.zip`.'
format:
description: Format the source code.
dependencies:
- build
output_paths:
- .
command: |
# Format the source code.
npm run format