Skip to content

Commit bfc7c2d

Browse files
authored
update readme with updated asdf-instructions (#13)
* update readme with update asdf-instructions * fix readme * fix installation script * add shfmt script
1 parent 29b53aa commit bfc7c2d

16 files changed

+81
-41
lines changed

.github/workflows/ci.yaml

+22-8
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@ jobs:
1010
- name: Install asdf
1111
uses: "asdf-vm/actions/[email protected]"
1212
- name: Install asdf plugins
13-
run: scripts/ci/asdf-add-plugins.sh
13+
run: scripts/asdf-add-plugins.sh
1414
- name: Install asdf tools versions
1515
run: scripts/ci/asdf-install.sh
16+
- name: Install node packages
17+
run: yarn install
1618
- name: "Check that 'docs' folder is up to date"
1719
run: scripts/ci/check-rendered-site-up-to-date.sh
1820
checkPipeline:
@@ -25,9 +27,11 @@ jobs:
2527
- name: Install asdf
2628
uses: "asdf-vm/actions/[email protected]"
2729
- name: Install asdf plugins
28-
run: scripts/ci/asdf-add-plugins.sh
30+
run: scripts/asdf-add-plugins.sh
2931
- name: Install asdf tools versions
3032
run: scripts/ci/asdf-install.sh
33+
- name: Install node packages
34+
run: yarn install
3135
- name: Check that the CI pipeline definition is up-to-date with the dhall configuration
3236
run: scripts/ci/check-rendered-pipeline-up-to-date.sh
3337
dhallFormat:
@@ -40,9 +44,11 @@ jobs:
4044
- name: Install asdf
4145
uses: "asdf-vm/actions/[email protected]"
4246
- name: Install asdf plugins
43-
run: scripts/ci/asdf-add-plugins.sh
47+
run: scripts/asdf-add-plugins.sh
4448
- name: Install asdf tools versions
4549
run: scripts/ci/asdf-install.sh
50+
- name: Install node packages
51+
run: yarn install
4652
- env:
4753
CHECK: 'true'
4854
name: Check that dhall files are formatted
@@ -57,9 +63,11 @@ jobs:
5763
- name: Install asdf
5864
uses: "asdf-vm/actions/[email protected]"
5965
- name: Install asdf plugins
60-
run: scripts/ci/asdf-add-plugins.sh
66+
run: scripts/asdf-add-plugins.sh
6167
- name: Install asdf tools versions
6268
run: scripts/ci/asdf-install.sh
69+
- name: Install node packages
70+
run: yarn install
6371
- env:
6472
CHECK: 'true'
6573
name: Check that dhall files are linted properly
@@ -74,9 +82,11 @@ jobs:
7482
- name: Install asdf
7583
uses: "asdf-vm/actions/[email protected]"
7684
- name: Install asdf plugins
77-
run: scripts/ci/asdf-add-plugins.sh
85+
run: scripts/asdf-add-plugins.sh
7886
- name: Install asdf tools versions
7987
run: scripts/ci/asdf-install.sh
88+
- name: Install node packages
89+
run: yarn install
8090
- name: Check Prettier formatting
8191
run: scripts/ci/check-prettier.sh
8292
shellcheck:
@@ -89,9 +99,11 @@ jobs:
8999
- name: Install asdf
90100
uses: "asdf-vm/actions/[email protected]"
91101
- name: Install asdf plugins
92-
run: scripts/ci/asdf-add-plugins.sh
102+
run: scripts/asdf-add-plugins.sh
93103
- name: Install asdf tools versions
94104
run: scripts/ci/asdf-install.sh
105+
- name: Install node packages
106+
run: yarn install
95107
- name: Lint shell scripts
96108
run: scripts/ci/shellcheck.sh
97109
shfmt:
@@ -104,11 +116,13 @@ jobs:
104116
- name: Install asdf
105117
uses: "asdf-vm/actions/[email protected]"
106118
- name: Install asdf plugins
107-
run: scripts/ci/asdf-add-plugins.sh
119+
run: scripts/asdf-add-plugins.sh
108120
- name: Install asdf tools versions
109121
run: scripts/ci/asdf-install.sh
122+
- name: Install node packages
123+
run: yarn install
110124
- name: Check that scripts are formatted consistently
111-
run: scripts/ci/shfmt.sh
125+
run: scripts/ci/shfmt-check.sh
112126
name: CI
113127
on:
114128
push: {}

.tool-versions

+1
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ dhall 1.33.1
55
shellcheck 0.7.1
66
shfmt 3.1.1
77
fd 7.4.0
8+
just 0.8.1

README.md

+5-10
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,13 @@ This project relies on [Hugo](https://gohugo.io/), [Yarn](https://classic.yarnpk
77
## Basic Dev Instructions
88

99
1. Run `git submodule update --init --recursive` if you haven't already done so
10+
1. Install GNU parallel via 'brew install parallel' (macOS) or from https://savannah.gnu.org/projects/parallel/. 🚨 Do not install the version of 'parallel' provided by 'moreutils'! 🚨
1011
1. Install [asdf](https://asdf-vm.com/#/core-manage-asdf-vm?id=install) (make sure to follow the "Add to your Shell" instructions in the installation guide)
11-
1. Install the following [asdf](https://github.com/asdf-vm/asdf) plugins:
12-
13-
- [asdf-hugo](https://github.com/beardix/asdf-hugo)
14-
- [asdf-nodejs](https://github.com/asdf-vm/asdf-nodejs) (remember to follow the guide's instructions to import the Node team's PGP keys)
15-
- [asdf-yarn](https://github.com/twuni/asdf-yarn)
16-
- [asdf-dhall](https://github.com/aaaaninja/asdf-dhall)
17-
18-
1. Install [the `just` command runner](https://github.com/casey/just) using the instructions located at https://github.com/casey/just#installation
19-
1. Run `just install` to install all the tools specified in [.tool-versions](./tool-versions) and [package.json](./package.json)
12+
1. Run [scripts/asdf-add-plugins.sh](.scripts/asdf-add-plugins.sh) to [install all the asdf plugins](./scripts/asdf-add-plugins.sh) specified in [.tool-versions](./tool-versions)
13+
1. Run `asdf install` to install all the tool versions specified in [.tool-versions](./tool-versions)
14+
1. Run `just install` to install of the packages specified in [package.json](./package.json)
2015
1. Run `just serve` to locally serve the site and automatically reload on file changes
21-
1. Run `just build` (or just `just`) to
16+
1. Run `just all` (or just `just`) to
2217
1. Format and lint all the files in the repository
2318
1. Render the site to the `docs/` folder
2419
1. Render the CI pipeline to `.github/workflows/ci.yaml`

justfile

+11-6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
all: build format lint
2+
13
build: render-hugo render-ci
24

35
render-hugo: format lint
@@ -6,7 +8,7 @@ render-hugo: format lint
68
render-ci: dhall-format dhall-lint
79
./scripts/ci/render-ci-pipeline.sh
810

9-
format: dhall-format prettier
11+
format: dhall-format prettier shfmt
1012

1113
lint: dhall-lint
1214

@@ -19,13 +21,16 @@ dhall-format:
1921
dhall-lint:
2022
./scripts/dhall-lint.sh
2123

24+
shfmt:
25+
./scripts/shfmt.sh
26+
2227
serve:
2328
hugo serve -D
2429

25-
install: yarn-install asdf-install
30+
asdf-add-plugins:
31+
./scripts/ci/asdf-add-plugins.sh
2632

27-
asdf-install:
28-
asdf install
33+
install: yarn-install
2934

30-
yarn-install: asdf-install
31-
yarn
35+
yarn-install:
36+
yarn install

scripts/ci/asdf-add-plugins.sh scripts/asdf-add-plugins.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
cd "$(dirname "${BASH_SOURCE[0]}")"/../..
3+
cd "$(dirname "${BASH_SOURCE[0]}")"/..
44
set -euxo pipefail
55

66
asdf plugin-add hugo https://github.com/beardix/asdf-hugo.git
@@ -15,6 +15,7 @@ OTHER_PACKAGES=(
1515
"shellcheck"
1616
"shfmt"
1717
"fd"
18+
"just"
1819
)
1920

2021
for package in "${OTHER_PACKAGES[@]}"; do

scripts/ci/check-prettier.sh

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
cd "$(dirname "${BASH_SOURCE[0]}")"/../..
44
set -euxo pipefail
55

6-
yarn
76
if ! yarn run prettier-check; then
87
echo "The files listed above aren't correctly formatted. Please run 'yarn prettier' and commit the result."
98
exit 1

scripts/ci/check-rendered-pipeline-up-to-date.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
cd "$(dirname "${BASH_SOURCE[0]}")"/../..
44
set -euxo pipefail
55

6-
scripts/ci/render-ci-pipeline.sh
6+
just all
77

88
git diff --exit-code .github/workflows/ci.yaml

scripts/ci/check-rendered-site-up-to-date.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
cd "$(dirname "${BASH_SOURCE[0]}")"/../..
44
set -euxo pipefail
55

6-
hugo
6+
just all
77

88
git diff --exit-code docs/

scripts/ci/dhall/jobs/shfmt.dhall

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ in Job::{
1212
SetupSteps
1313
# [ GitHubActions.Step::{
1414
, name = Some "Check that scripts are formatted consistently"
15-
, run = Some "scripts/ci/shfmt.sh"
15+
, run = Some "scripts/ci/shfmt-check.sh"
1616
}
1717
]
1818
}

scripts/ci/dhall/setup.dhall

+5-1
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,16 @@ let ASDFSteps =
77
}
88
, GitHubActions.Step::{
99
, name = Some "Install asdf plugins"
10-
, run = Some "scripts/ci/asdf-add-plugins.sh"
10+
, run = Some "scripts/asdf-add-plugins.sh"
1111
}
1212
, GitHubActions.Step::{
1313
, name = Some "Install asdf tools versions"
1414
, run = Some "scripts/ci/asdf-install.sh"
1515
}
16+
, GitHubActions.Step::{
17+
, name = Some "Install node packages"
18+
, run = Some "yarn install"
19+
}
1620
]
1721

1822
let Checkout =

scripts/ci/shfmt-check.sh

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
3+
echo "--- shfmt (ensure shell-scripts are formatted consistently)"
4+
5+
set -ex
6+
7+
cd "$(dirname "${BASH_SOURCE[0]}")"/../..
8+
9+
if ! shfmt -d .; then
10+
echo "The scripts listed above aren't correctly formatted. Please run 'just format' from the repository root and commit the result."
11+
exit 1
12+
fi

scripts/ci/shfmt.sh

-9
This file was deleted.

scripts/dhall-format.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ export -f format
3535

3636
echo 'will cite' | parallel --citation &>/dev/null
3737

38-
parallel --keep-order --line-buffer format {} ::: "${DHALL_FILES[@]}"
38+
./scripts/parallel_run.sh format {} ::: "${DHALL_FILES[@]}"

scripts/dhall-lint.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ export -f lint
3535

3636
echo 'will cite' | parallel --citation &>/dev/null
3737

38-
parallel --keep-order --line-buffer lint {} ::: "${DHALL_FILES[@]}"
38+
./scripts/parallel_run.sh lint {} ::: "${DHALL_FILES[@]}"

scripts/parallel_run.sh

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
3+
if ! command -v parallel &>/dev/null; then
4+
echo "'GNU parallel' is not installed. Please install 'parallel' via 'brew install parallel' or from https://savannah.gnu.org/projects/parallel/."
5+
echo "🚨 Do not install the version of 'parallel' provided by 'moreutils'!"
6+
exit 1
7+
fi
8+
9+
# Remove parallel citation log spam.
10+
echo 'will cite' | parallel --citation &>/dev/null
11+
12+
parallel --keep-order --line-buffer "$@"

scripts/shfmt.sh

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
3+
cd "$(dirname "${BASH_SOURCE[0]}")"/..
4+
set -eu pipefail
5+
6+
shfmt -w .

0 commit comments

Comments
 (0)