This repository was archived by the owner on Aug 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
Prepare copy-workflow for setting up unified CI for JS repos #239
Merged
Merged
Changes from 18 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
526400f
move config*.json files to configs directory
galargh f727003
rename configs/*.json
galargh f434f15
make checks aware of all the configs/*.json
galargh 496348f
turn configs into objects with repositories key
galargh 67da4b2
make files part of the config
galargh b9aaa52
move language specific copy-workflow setup to actions
galargh 02436cf
make dispatch workflow support more than one config json
galargh 0d71b9e
create fewer batches if possible
galargh 0828267
set up copy-workflow actions properly
galargh 1dfeb94
extract defaults from config separately
galargh 16e4ca8
bring back double toJson
galargh dbe2f9c
use copy-workflow actions from same branch
galargh f5cf5ab
use compact json representation for storing FILES
galargh 6955318
fix files and local actions
galargh c95cbff
run actions from template repo
galargh 5c86ae0
add missing shell property to actions
galargh 0b3c5cb
add configs README
galargh 07f9202
set deploy_versioning=true for go repositories
galargh 9fdc4eb
address review comments
galargh 60d1f29
restore hardcoded template-repo reference
galargh a71f87a
add section on config testing
galargh 0f34080
fix batches creation
galargh b2c1dd9
fix command that produces batches
galargh 664f8b7
fix needs update logic
galargh 34022b2
Merge remote-tracking branch 'origin/master' into testing-js
galargh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,15 @@ | ||
| #!/bin/bash | ||
|
|
||
| tmp=$(mktemp) | ||
| git show :config.json > $tmp | ||
| status=0 | ||
| if ! output=$(.github/workflows/check-config.sh $tmp); then | ||
| echo "$output" | ||
| status=1 | ||
| fi | ||
| rm $tmp | ||
| for config in configs/*.json; do | ||
| tmp=$(mktemp) | ||
| git show :$config > $tmp | ||
| status=0 | ||
| if ! output=$(.github/workflows/check-config.sh $tmp); then | ||
| echo "$tmp contains git show :$config output." | ||
| echo "$output" | ||
| status=1 | ||
| fi | ||
| rm $tmp | ||
| done | ||
|
|
||
| exit $status | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| name: copy workflow go | ||
| description: Copy workflow steps specific to go | ||
|
|
||
| runs: | ||
| using: "composite" | ||
| steps: | ||
| - uses: actions/setup-go@v2 | ||
| with: | ||
| # This should be the same Go version we use in the go-check workflow. | ||
| # go mod tidy, go vet, staticcheck and gofmt might behave differently depending on the version. | ||
| go-version: "1.17.x" | ||
| - name: bump go.mod go version if needed | ||
| uses: protocol/multiple-go-modules@v1.2 | ||
| with: | ||
| working-directory: ${{ env.TARGET_REPO_DIR }} | ||
| run: | | ||
| # We want our modules to support two Go versions at a time. | ||
| # As of August 2021, Go 1.17 is the latest stable. | ||
| # go.mod's Go version declares the language version being used. | ||
| # As such, it has to be the minimum of all Go versions supported. | ||
| # Bump this every six months, as new Go versions come out. | ||
| TARGET_VERSION=1.16 | ||
|
|
||
| # Note that the "<" comparison doesn't understand semver, | ||
| # but it should be good enough for the foreseeable future. | ||
| CURRENT_VERSION=$(go list -m -f {{.GoVersion}}) | ||
|
|
||
| if [[ $CURRENT_VERSION < $TARGET_VERSION ]]; then | ||
| echo "GO_VERSION_BUMP=1" >> $GITHUB_ENV | ||
|
|
||
| # Update the version in go.mod. This alone ensures there's a diff. | ||
| go mod edit -go $TARGET_VERSION | ||
|
|
||
| # In the future, "go fix" may make changes to Go code, | ||
| # such as to adapt to language changes or API deprecations. | ||
| # This is largely a no-op as of Go 1.17, and that's fine. | ||
| go fix ./... | ||
| git add . | ||
|
|
||
| # We don't tidy, because the next step does that. | ||
| # Separate commits also help with reviews. | ||
| git commit -m "bump go.mod to Go $TARGET_VERSION and run go fix" | ||
| fi | ||
| - name: go mod tidy (on initial workflow deployment and on new Go version) | ||
| if: ${{ env.INITIAL_WORKFLOW_DEPLOYMENT == 1 || env.GO_VERSION_BUMP == 1}} | ||
| uses: protocol/multiple-go-modules@v1.2 | ||
| with: | ||
| working-directory: ${{ env.TARGET_REPO_DIR }} | ||
| run: | | ||
| go mod tidy | ||
| if ! git diff --quiet; then | ||
| git add . | ||
| git commit -m "run go mod tidy" | ||
| fi | ||
| - name: gofmt -s (on initial workflow deployment and on new Go version) | ||
| if: ${{ env.INITIAL_WORKFLOW_DEPLOYMENT == 1 || env.GO_VERSION_BUMP == 1}} | ||
| working-directory: ${{ env.TARGET_REPO_DIR }} | ||
| shell: bash | ||
| run: | | ||
| gofmt -s -w . | ||
| if ! git diff --quiet; then | ||
| git add . | ||
| git commit -m "run gofmt -s" | ||
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| name: copy workflow versioning | ||
| description: Copy workflow steps specific to versioning | ||
|
|
||
| runs: | ||
| using: "composite" | ||
| steps: | ||
| - name: add version.json file (in order to deploy versioning workflows) | ||
| if: hashFiles(format('{0}/version.json', env.TARGET_REPO_DIR)) == '' | ||
| working-directory: ${{ env.TARGET_REPO_DIR }} | ||
| shell: bash | ||
| run: | | ||
| git fetch origin --unshallow # we need the entire commit history | ||
| version=$(git describe --tags --abbrev=0 || true) # highest released version on current branch | ||
| if [[ -n "$version" ]]; then # only deply version.json if there's at least one release | ||
| printf '{"version": "%s"}' "$version" | jq . > version.json | ||
| git add version.json | ||
| git commit -m "add version.json file" | ||
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.