From 77ed56990a098265b13b1596e26abea21023d59c Mon Sep 17 00:00:00 2001 From: Anmol Sethi Date: Tue, 29 Nov 2022 12:37:48 -0800 Subject: [PATCH 1/5] ci: Consolidate github actions into one main job --- .github/workflows/ci.yml | 89 +------------------------------------ .github/workflows/daily.yml | 4 +- Makefile | 6 --- ci/sub | 2 +- 4 files changed, 5 insertions(+), 96 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1157e58e7..b97e10c55 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,17 +5,7 @@ concurrency: cancel-in-progress: true jobs: - assert-linear: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - submodules: recursive - - run: COLOR=1 ./make.sh assert-linear - env: - GITHUB_TOKEN: ${{ secrets._GITHUB_TOKEN }} - DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }} - fmt: + ci: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -25,63 +15,7 @@ jobs: with: go-version-file: ./go.mod cache: true - - run: COLOR=1 ./make.sh fmt - env: - GITHUB_TOKEN: ${{ secrets._GITHUB_TOKEN }} - DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }} - gen: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - submodules: recursive - - uses: actions/setup-go@v3 - with: - go-version-file: ./go.mod - cache: true - - run: COLOR=1 ./make.sh gen - env: - GITHUB_TOKEN: ${{ secrets._GITHUB_TOKEN }} - DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }} - lint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - submodules: recursive - - uses: actions/setup-go@v3 - with: - go-version-file: ./go.mod - cache: true - - run: COLOR=1 ./make.sh lint - env: - GITHUB_TOKEN: ${{ secrets._GITHUB_TOKEN }} - DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }} - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - submodules: recursive - - uses: actions/setup-go@v3 - with: - go-version-file: ./go.mod - cache: true - - run: COLOR=1 ./make.sh build - env: - GITHUB_TOKEN: ${{ secrets._GITHUB_TOKEN }} - DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }} - test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - submodules: recursive - - uses: actions/setup-go@v3 - with: - go-version-file: ./go.mod - cache: true - - run: COLOR=1 ./make.sh test + - run: COLOR=1 ./make.sh all race env: GITHUB_TOKEN: ${{ secrets._GITHUB_TOKEN }} DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }} @@ -90,22 +24,3 @@ jobs: with: name: d2chaos-test path: ./d2chaos/out - race: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - submodules: recursive - - uses: actions/setup-go@v3 - with: - go-version-file: ./go.mod - cache: true - - run: COLOR=1 ./make.sh race - env: - GITHUB_TOKEN: ${{ secrets._GITHUB_TOKEN }} - DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }} - - uses: actions/upload-artifact@v3 - if: always() - with: - name: d2chaos-race - path: ./d2chaos/out diff --git a/.github/workflows/daily.yml b/.github/workflows/daily.yml index 6334923c1..58b485496 100644 --- a/.github/workflows/daily.yml +++ b/.github/workflows/daily.yml @@ -10,7 +10,7 @@ concurrency: cancel-in-progress: true jobs: - all: + ci: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -20,7 +20,7 @@ jobs: with: go-version-file: ./go.mod cache: true - - run: CI_ALL=1 COLOR=1 ./make.sh + - run: COLOR=1 CI_FORCE=1 ./make.sh all race env: GITHUB_TOKEN: ${{ secrets._GITHUB_TOKEN }} DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }} diff --git a/Makefile b/Makefile index 9780b7bc0..d4241d86f 100644 --- a/Makefile +++ b/Makefile @@ -2,9 +2,6 @@ .PHONY: all all: fmt gen lint build test -ifdef CI -all: assert-linear -endif .PHONY: fmt fmt: @@ -24,6 +21,3 @@ test: .PHONY: race race: prefix "$@" ./ci/test.sh --race ./... -.PHONY: assert-linear -assert-linear: - prefix "$@" ./ci/sub/assert_linear.sh diff --git a/ci/sub b/ci/sub index 824046d95..765e3ddc7 160000 --- a/ci/sub +++ b/ci/sub @@ -1 +1 @@ -Subproject commit 824046d952b1442c76a057553591652c889fb7cb +Subproject commit 765e3ddc7bbd669f3605f9f877bc6004c1b80735 From 87b3bcb31d91d9992cc2f4226f59b3f1fdc9bbfd Mon Sep 17 00:00:00 2001 From: Anmol Sethi Date: Tue, 29 Nov 2022 13:54:11 -0800 Subject: [PATCH 2/5] make.sh: Clone submodules automatically --- .github/workflows/ci.yml | 2 -- .github/workflows/daily.yml | 2 -- make.sh | 3 +++ 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b97e10c55..cdd572bc2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,8 +9,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - with: - submodules: recursive - uses: actions/setup-go@v3 with: go-version-file: ./go.mod diff --git a/.github/workflows/daily.yml b/.github/workflows/daily.yml index 58b485496..9fc372532 100644 --- a/.github/workflows/daily.yml +++ b/.github/workflows/daily.yml @@ -14,8 +14,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - with: - submodules: recursive - uses: actions/setup-go@v3 with: go-version-file: ./go.mod diff --git a/make.sh b/make.sh index 29fa6689b..9f6290641 100755 --- a/make.sh +++ b/make.sh @@ -1,5 +1,8 @@ #!/bin/sh set -eu +if [ ! -d "$(dirname "$0")/ci/sub/.git" ]; then + git submodule update --init +fi . "$(dirname "$0")/ci/sub/lib.sh" PATH="$(cd -- "$(dirname "$0")" && pwd)/ci/sub/bin:$PATH" cd "$(dirname "$0")" From ea876e051b3f2669770d6ac8d19ec3641686a179 Mon Sep 17 00:00:00 2001 From: Anmol Sethi Date: Tue, 29 Nov 2022 14:18:52 -0800 Subject: [PATCH 3/5] install.sh: Improve dry run message and add short flag -d --- ci/release/_install.sh | 14 +++++++++----- ci/release/template/scripts/lib.sh | 5 +++-- ci/sub | 2 +- install.sh | 19 ++++++++++++------- 4 files changed, 25 insertions(+), 15 deletions(-) diff --git a/ci/release/_install.sh b/ci/release/_install.sh index 4cd840ca9..a66f2d730 100755 --- a/ci/release/_install.sh +++ b/ci/release/_install.sh @@ -14,7 +14,7 @@ help() { fi cat <&2 + printf '$COLOR must be 0, 1, false or true but got %s\n' "$COLOR" >&2 fi fi @@ -219,8 +219,9 @@ header() { } bigheader() { + set -- "$(echo "$*" | sed "s/^/ * /")" logp "/** - * $1 +$* **/" } diff --git a/ci/sub b/ci/sub index 765e3ddc7..18ad1a278 160000 --- a/ci/sub +++ b/ci/sub @@ -1 +1 @@ -Subproject commit 765e3ddc7bbd669f3605f9f877bc6004c1b80735 +Subproject commit 18ad1a2780f6e9119439a4b015de1ce0b875e0ba diff --git a/install.sh b/install.sh index 678dabfe5..112a76d50 100755 --- a/install.sh +++ b/install.sh @@ -68,7 +68,7 @@ should_color() { _COLOR=1 return 0 else - printf '$COLOR must be 0, 1, false or true but got %s' "$COLOR" >&2 + printf '$COLOR must be 0, 1, false or true but got %s\n' "$COLOR" >&2 fi fi @@ -225,8 +225,9 @@ header() { } bigheader() { + set -- "$(echo "$*" | sed "s/^/ * /")" logp "/** - * $1 +$* **/" } @@ -478,7 +479,7 @@ help() { fi cat < Date: Tue, 29 Nov 2022 14:33:37 -0800 Subject: [PATCH 4/5] changelog: Update --- ci/release/changelogs/next.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ci/release/changelogs/next.md b/ci/release/changelogs/next.md index e669b635f..eb48251c4 100644 --- a/ci/release/changelogs/next.md +++ b/ci/release/changelogs/next.md @@ -6,9 +6,14 @@ - `stroke-dash` on shapes is now supported. [#188](https://github.com/terrastruct/d2/issues/188) - `font-color` is now supported on shapes and connections. [#215](https://github.com/terrastruct/d2/pull/215) - Querying shapes and connections by ID is now supported in renders. [#218](https://github.com/terrastruct/d2/pull/218) +- [install.sh](./install.sh) now accepts `-d` as an alias for `--dry-run`. + [#266](https://github.com/terrastruct/d2/pull/266) #### Improvements 🔧 +- [install.sh](./install.sh) prints the dry run message more visibly. + [#266](https://github.com/terrastruct/d2/pull/266) + #### Bugfixes 🔴 - 3D style was missing border and other styles for its top and right faces. From 27a6e219a4c92726dfc40c05a3837076ed208cea Mon Sep 17 00:00:00 2001 From: Anmol Sethi Date: Tue, 29 Nov 2022 14:57:48 -0800 Subject: [PATCH 5/5] ci/sub: Update --- ci/sub | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/sub b/ci/sub index 18ad1a278..029fdc1c9 160000 --- a/ci/sub +++ b/ci/sub @@ -1 +1 @@ -Subproject commit 18ad1a2780f6e9119439a4b015de1ce0b875e0ba +Subproject commit 029fdc1c9533b5bfb9c76b50bdb6d52eea7ddbeb