diff --git a/.githooks/pre-commit b/.githooks/pre-commit index e4097f58..64b4af90 100755 --- a/.githooks/pre-commit +++ b/.githooks/pre-commit @@ -1,12 +1,14 @@ #!/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 $config); then + echo "$output" + status=1 + fi + rm $tmp +done exit $status diff --git a/.github/actions/copy-workflow-go/action.yml b/.github/actions/copy-workflow-go/action.yml new file mode 100644 index 00000000..cb27a595 --- /dev/null +++ b/.github/actions/copy-workflow-go/action.yml @@ -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 diff --git a/.github/actions/copy-workflow-versioning/action.yml b/.github/actions/copy-workflow-versioning/action.yml new file mode 100644 index 00000000..6acf1714 --- /dev/null +++ b/.github/actions/copy-workflow-versioning/action.yml @@ -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 diff --git a/.github/workflows/check-3rd-party.yml b/.github/workflows/check-3rd-party.yml index 5c848a78..339793df 100644 --- a/.github/workflows/check-3rd-party.yml +++ b/.github/workflows/check-3rd-party.yml @@ -1,8 +1,7 @@ on: pull_request: paths-ignore: - - 'config.json' - - 'config-testing.json' + - 'configs/*.json' name: Check 3rd Party diff --git a/.github/workflows/check-config.sh b/.github/workflows/check-config.sh index 701726d8..c05ace2b 100755 --- a/.github/workflows/check-config.sh +++ b/.github/workflows/check-config.sh @@ -3,14 +3,15 @@ set -e file=$1 +source=${2:-$file} entries=$(mktemp) entries_sorted=$(mktemp) -jq -r ".[].target" $file > $entries +jq -r ".repositories[].target" $file > $entries sort -u $entries > $entries_sorted status=0 if ! output=$(diff -y $entries $entries_sorted); then - echo "Targets in config.json not sorted alphabetically:" + echo "Targets in $source not sorted alphabetically:" echo "$output" status=1 fi diff --git a/.github/workflows/check-config.yml b/.github/workflows/check-config.yml index 64997921..5b3af314 100644 --- a/.github/workflows/check-config.yml +++ b/.github/workflows/check-config.yml @@ -1,7 +1,7 @@ on: pull_request: paths: - - 'config.json' + - 'configs/*.json' name: Check Config @@ -12,5 +12,10 @@ jobs: targets: ${{ steps.set-matrix.outputs.targets }} steps: - uses: actions/checkout@v2 - - name: check if config.json is sorted alphabetically - run: .github/workflows/check-config.sh config.json + - name: check if config files are sorted alphabetically + run: | + for config in configs/*.json; do + echo "::group::$config" + .github/workflows/check-config.sh $config + echo "::endgroup::" + done diff --git a/.github/workflows/copy-workflow.yml b/.github/workflows/copy-workflow.yml index 61cc9f12..af0f407e 100644 --- a/.github/workflows/copy-workflow.yml +++ b/.github/workflows/copy-workflow.yml @@ -8,9 +8,6 @@ on: head_commit_url: description: "github.event.head_commit.url of the dispatcher" required: true - files: - description: "List of files to deploy" - required: true targets: description: "List of repositories to deploy to" required: true @@ -28,7 +25,7 @@ jobs: TEMPLATE_REPO_DIR: "template-repo" TEMPLATE_DIR: "templates" NEEDS_UPDATE: 0 - INITIAL_TEST_DEPLOYMENT: 0 + INITIAL_WORKFLOW_DEPLOYMENT: 0 GO_VERSION_BUMP: 0 FILES: "" GITHUB_USER: "web3-bot" @@ -48,11 +45,6 @@ jobs: uses: actions/checkout@v2 with: path: ${{ env.TEMPLATE_REPO_DIR }} - - 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: determine GitHub default branch working-directory: ${{ env.TARGET_REPO_DIR }} run: | @@ -63,105 +55,58 @@ jobs: run: | git config user.name ${{ env.GITHUB_USER }} git config user.email ${{ env.GITHUB_EMAIL }} - - name: is initial test workflow deployment + - name: determine files to add + # By setting the environment variable, it's possible to programmatically add / modify this list. + # See https://github.com/protocol/.github/blob/38135c75e47839623bf9b2748275d8c6167a8fa8/.github/workflows/copy-workflow.yml#L163-L168 for an example, how we used to make use of this. run: | - if [[ ! -f $TARGET_REPO_DIR/.github/workflows/go-test.yml ]]; then - echo "INITIAL_TEST_DEPLOYMENT=1" >> $GITHUB_ENV - fi - - name: remove Travis (on initial deployment) - if: ${{ env.INITIAL_TEST_DEPLOYMENT == 1 }} + files=${{ toJson(toJson(matrix.cfg.files)) }} + files=$(echo -e "$files" | jq -c '.') + echo "FILES=$files" >> $GITHUB_ENV + - name: is initial workflow deployment + # INITIAL_WORKFLOW_DEPLOYMENT=1 iff none of the files in the target repository exist yet + run: | + initial_workflow_deployment=1 + for f in $(jq -r '.[]' <<< ${{ toJson(env.FILES) }}); do + if [[ -f $TARGET_REPO_DIR/$f ]]; then + initial_workflow_deployment=0 + break + fi + done + echo "INITIAL_WORKFLOW_DEPLOYMENT=$initial_workflow_deployment" >> $GITHUB_ENV + - name: remove Travis (on initial workflow deployment) + if: ${{ env.INITIAL_WORKFLOW_DEPLOYMENT == 1 }} working-directory: ${{ env.TARGET_REPO_DIR }} run: | if [[ -f .travis.yml ]]; then git rm .travis.yml git commit -m "disable Travis" fi - - name: remove CircleCI (on initial deployment) - if: ${{ env.INITIAL_TEST_DEPLOYMENT == 1 }} + - name: remove CircleCI (on initial workflow deployment) + if: ${{ env.INITIAL_WORKFLOW_DEPLOYMENT == 1 }} working-directory: ${{ env.TARGET_REPO_DIR }} run: | if [[ -d .circleci ]]; then git rm -r .circleci git commit -m "disable CircleCI" fi - - name: remove gx (on initial deployment) - if: ${{ env.INITIAL_TEST_DEPLOYMENT == 1 }} + - name: remove gx (on initial workflow deployment) + if: ${{ env.INITIAL_WORKFLOW_DEPLOYMENT == 1 }} working-directory: ${{ env.TARGET_REPO_DIR }} run: | if [[ -d .gx ]]; then git rm -r .gx git commit -m "remove .gx" fi - - 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 }} - 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 - - 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 deployment and on new Go version) - if: ${{ env.INITIAL_TEST_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 deployment and on new Go version) - if: ${{ env.INITIAL_TEST_DEPLOYMENT == 1 || env.GO_VERSION_BUMP == 1}} - working-directory: ${{ env.TARGET_REPO_DIR }} - run: | - gofmt -s -w . - if ! git diff --quiet; then - git add . - git commit -m "run gofmt -s" - fi - - name: determine files to add - # By setting the environment variable, it's possible to programmatically add / modify this list. - # See https://github.com/protocol/.github/blob/38135c75e47839623bf9b2748275d8c6167a8fa8/.github/workflows/copy-workflow.yml#L163-L168 for an example, how we used to make use of this. - run: echo "FILES=${{ toJson(github.event.inputs.files) }}" >> $GITHUB_ENV + - name: Run steps specific to go + if: matrix.cfg.deploy_go + # use of ${{ env.TEMPATE_REPO_DIR }} is not allowed here + uses: ./template-repo/.github/actions/copy-workflow-go + - name: Run steps specific to versioning + if: matrix.cfg.deploy_versioning + uses: ./template-repo/.github/actions/copy-workflow-versioning - name: Add files run: | - for f in $(jq -r ".[]" <<< ${{ toJson(env.FILES) }}); do + for f in $(jq -r '.[]' <<< ${{ toJson(env.FILES) }}); do echo -e "\nProcessing $f." # add DO NOT EDIT header tmp=$(mktemp) @@ -194,9 +139,9 @@ jobs: done - name: Check if we need to create a PR working-directory: ${{ env.TARGET_REPO_DIR }} - run: echo "NEEDS_UPDATE=$(git rev-list HEAD...origin/$(git rev-parse --abbrev-ref HEAD) --ignore-submodules --count)" >> $GITHUB_ENV + run: echo "NEEDS_UPDATE=$(git rev-list HEAD...origin/$(git rev-parse --abbrev-ref HEAD) --ignore-submodules --count 2> /dev/null || echo 1)" >> $GITHUB_ENV - name: Create Pull Request - if: ${{ env.NEEDS_UPDATE }} + if: ${{ env.NEEDS_UPDATE != 0 }} uses: peter-evans/create-pull-request@83dbed188f76ab04433c639ec214df65e26bc15c # https://github.com/peter-evans/create-pull-request/pull/856 with: path: ${{ env.TARGET_REPO_DIR }} diff --git a/.github/workflows/dispatch.yml b/.github/workflows/dispatch.yml index d7e78e02..59c0eba0 100644 --- a/.github/workflows/dispatch.yml +++ b/.github/workflows/dispatch.yml @@ -12,24 +12,34 @@ env: # With ~180 repos, this means we'll run around 9 instances of the copy workflow in parallel. # This is (hopefully) sufficient to prevent us from triggering GitHub Action's abuse detection mechanism. MAX_REPOS_PER_WORKFLOW: 20 - FILES: '[ ".github/workflows/automerge.yml", ".github/workflows/go-test.yml", ".github/workflows/go-check.yml", ".github/workflows/releaser.yml", ".github/workflows/release-check.yml", ".github/workflows/tagpush.yml" ]' # a JSON array of the files to distribute jobs: matrix: name: Trigger copy workflows runs-on: ubuntu-latest outputs: - targets: ${{ steps.set-matrix.outputs.targets }} + batches: ${{ steps.set-matrix.outputs.batches }} steps: - uses: actions/checkout@v2 - id: set-matrix run: | - CONFIG=config.json - if [[ $GITHUB_REF == refs/heads/testing ]]; then - CONFIG=config-testing.json - fi - TARGETS=$(jq '. | _nwise(${{ env.MAX_REPOS_PER_WORKFLOW }})' $CONFIG | jq -sc '. | to_entries') - echo "::set-output name=targets::$TARGETS" + targets=() + for config in configs/*.json; do + echo "::group::$config" + if [[ $GITHUB_REF == refs/heads/testing && $config != configs/testing.json ]]; then + continue + fi + if [[ $GITHUB_REF != refs/heads/testing && $config == configs/testing.json ]]; then + continue + fi + defaults=$(jq -c '.defaults' $config) + # values defined in the repository object will override the default values + # e.g. { "files": ["a", "b"] } + { "files": ["c"] } = { "files": ["c"] } + targets+=($(jq -c ".repositories[] | $defaults + ." $config)) + echo "::endgroup::" + done + batches=$(jq -sc '[. | _nwise(${{ env.MAX_REPOS_PER_WORKFLOW }})] | to_entries' <<< "${targets[@]}") + echo "::set-output name=batches::$batches" dispatch: needs: [ matrix ] runs-on: ubuntu-latest @@ -37,18 +47,22 @@ jobs: fail-fast: false matrix: # We end up with multiple "dispatch" jobs, - # one per TARGETS "key" chunk above with a "value" array. + # one per BATCHES "key" chunk above with a "value" array. # For each "dispatch" job, matrix.cfg.value is an array, like: # - # [{"target": "repo1", "target": "repo2"}] + # [ + # {"target": "repo1", "files": [".github/workflows/go-check.yml"]}, + # {"target": "repo2", "files": [".github/workflows/go-check.yml", ".github/workflows/go-test.yml"]} + # ] # # The triggered copy-workflow jobs use that final array as their matrix. # As such, we'll end up with one copy-workflow parallel job per target. - cfg: ${{ fromJson(needs.matrix.outputs.targets) }} + cfg: ${{ fromJson(needs.matrix.outputs.batches) }} name: Start copy workflow (batch ${{ matrix.cfg.key }}) steps: - uses: benc-uk/workflow-dispatch@4c044c1613fabbe5250deadc65452d54c4ad4fc7 # v1.1.0 with: workflow: "Deploy" # "name" attribute of copy-workflow.yml token: ${{ secrets.WEB3BOT_GITHUB_TOKEN }} - inputs: '{ "head_commit_url": ${{ toJson(github.event.head_commit.url) }}, "files": ${{ toJson(env.FILES) }}, "targets": ${{ toJson(toJson(matrix.cfg.value)) }} }' + # double toJson on matrix.cfg.value is here on purpose + inputs: '{ "head_commit_url": ${{ toJson(github.event.head_commit.url) }}, "targets": ${{ toJson(toJson(matrix.cfg.value)) }} }' diff --git a/.github/workflows/stale-repos.yml b/.github/workflows/stale-repos.yml index bae027ba..c70a42df 100644 --- a/.github/workflows/stale-repos.yml +++ b/.github/workflows/stale-repos.yml @@ -11,18 +11,21 @@ jobs: - name: find deleted / archived repositories run: | status=0 - for repo in $(jq -r '.[].target' config.json); do - exists=true - output=$(curl -s -f -H "Accept: application/vnd.github.v3+json" -H "authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/$repo") || exists=false - if ! $exists; then - echo "Repository $repo does not exist." - status=1 - continue - fi - if [[ $(echo "$output" | jq ".archived") == "true" ]]; then - echo "Repository $repo is archived." - status=1 - fi + for config in configs/*.json; do + echo "::group::$config" + for repo in $(jq -r '.repositories[].target' $config); do + exists=true + output=$(curl -s -f -H "Accept: application/vnd.github.v3+json" -H "authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/$repo") || exists=false + if ! $exists; then + echo "Repository $repo does not exist." + status=1 + continue + fi + if [[ $(echo "$output" | jq ".archived") == "true" ]]; then + echo "Repository $repo is archived." + status=1 + fi + done + echo "::endgroup::" done exit $status - diff --git a/README.md b/README.md index d5a61602..9159f46c 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ In order to help with the distribution of these workflows, this repository defin ## Usage -Workflows are distributed to all repositories listed in [config.json](config.json). +Workflows are distributed to all repositories listed in [configs/go.json](configs/go.json). If you want your project to participle, please send a PR! diff --git a/config-testing.json b/config-testing.json deleted file mode 100644 index c438f770..00000000 --- a/config-testing.json +++ /dev/null @@ -1,3 +0,0 @@ -[ - { "target": "protocol/.github-test-target" } -] diff --git a/config.json b/config.json deleted file mode 100644 index 9a412466..00000000 --- a/config.json +++ /dev/null @@ -1,175 +0,0 @@ -[ - { "target": "filecoin-project/go-amt-ipld" }, - { "target": "filecoin-project/go-bitfield" }, - { "target": "filecoin-project/go-commp-utils" }, - { "target": "filecoin-project/go-fil-commp-hashhash" }, - { "target": "filecoin-project/go-hamt-ipld" }, - { "target": "filecoin-project/go-indexer-core" }, - { "target": "filecoin-project/go-legs" }, - { "target": "filecoin-project/indexer-reference-provider" }, - { "target": "filecoin-project/storetheindex" }, - { "target": "filecoin-shipyard/js-lotus-client-schema" }, - { "target": "ipfs-shipyard/dnslink-dnsimple" }, - { "target": "ipfs-shipyard/git-remote-ipld" }, - { "target": "ipfs-shipyard/ipfs-counter" }, - { "target": "ipfs-shipyard/w3rc" }, - { "target": "ipfs/bbloom" }, - { "target": "ipfs/go-bitfield" }, - { "target": "ipfs/go-bitswap" }, - { "target": "ipfs/go-block-format" }, - { "target": "ipfs/go-blockservice" }, - { "target": "ipfs/go-bs-sqlite3" }, - { "target": "ipfs/go-cid" }, - { "target": "ipfs/go-cidutil" }, - { "target": "ipfs/go-dagwriter" }, - { "target": "ipfs/go-datastore" }, - { "target": "ipfs/go-detect-race" }, - { "target": "ipfs/go-dnslink" }, - { "target": "ipfs/go-ds-badger" }, - { "target": "ipfs/go-ds-badger2" }, - { "target": "ipfs/go-ds-bitcask" }, - { "target": "ipfs/go-ds-flatfs" }, - { "target": "ipfs/go-ds-leveldb" }, - { "target": "ipfs/go-ds-measure" }, - { "target": "ipfs/go-ds-pebble" }, - { "target": "ipfs/go-ds-redis" }, - { "target": "ipfs/go-ds-s3" }, - { "target": "ipfs/go-ds-sql" }, - { "target": "ipfs/go-fetcher" }, - { "target": "ipfs/go-filestore" }, - { "target": "ipfs/go-fs-lock" }, - { "target": "ipfs/go-graphsync" }, - { "target": "ipfs/go-ipfs-api" }, - { "target": "ipfs/go-ipfs-blockstore" }, - { "target": "ipfs/go-ipfs-blocksutil" }, - { "target": "ipfs/go-ipfs-chunker" }, - { "target": "ipfs/go-ipfs-cmds" }, - { "target": "ipfs/go-ipfs-config" }, - { "target": "ipfs/go-ipfs-delay" }, - { "target": "ipfs/go-ipfs-ds-help" }, - { "target": "ipfs/go-ipfs-example-plugin" }, - { "target": "ipfs/go-ipfs-exchange-interface" }, - { "target": "ipfs/go-ipfs-exchange-offline" }, - { "target": "ipfs/go-ipfs-files" }, - { "target": "ipfs/go-ipfs-http-client" }, - { "target": "ipfs/go-ipfs-keystore" }, - { "target": "ipfs/go-ipfs-pinner" }, - { "target": "ipfs/go-ipfs-posinfo" }, - { "target": "ipfs/go-ipfs-pq" }, - { "target": "ipfs/go-ipfs-provider" }, - { "target": "ipfs/go-ipfs-routing" }, - { "target": "ipfs/go-ipfs-util" }, - { "target": "ipfs/go-ipld-cbor" }, - { "target": "ipfs/go-ipld-format" }, - { "target": "ipfs/go-ipld-git" }, - { "target": "ipfs/go-ipld-legacy" }, - { "target": "ipfs/go-ipns" }, - { "target": "ipfs/go-log" }, - { "target": "ipfs/go-merkledag" }, - { "target": "ipfs/go-metrics-interface" }, - { "target": "ipfs/go-metrics-prometheus" }, - { "target": "ipfs/go-mfs" }, - { "target": "ipfs/go-namesys" }, - { "target": "ipfs/go-path" }, - { "target": "ipfs/go-peertaskqueue" }, - { "target": "ipfs/go-qringbuf" }, - { "target": "ipfs/go-todocounter" }, - { "target": "ipfs/go-unixfs" }, - { "target": "ipfs/go-unixfsnode" }, - { "target": "ipfs/go-verifcid" }, - { "target": "ipfs/hang-fds" }, - { "target": "ipfs/interface-go-ipfs-core" }, - { "target": "ipfs/ipfs-ds-convert" }, - { "target": "ipfs/ipfs-update" }, - { "target": "ipfs/ipget" }, - { "target": "ipfs/iptb" }, - { "target": "ipfs/iptb-plugins" }, - { "target": "ipfs/pinbot-irc" }, - { "target": "ipfs/tar-utils" }, - { "target": "ipld/codec-fixtures" }, - { "target": "ipld/go-car" }, - { "target": "ipld/go-codec-dagpb" }, - { "target": "ipld/go-ipld-adl-hamt" }, - { "target": "ipld/go-ipld-btc" }, - { "target": "ipld/go-ipld-graphql" }, - { "target": "ipld/go-ipld-prime-proto" }, - { "target": "ipld/go-ipld-schema" }, - { "target": "ipld/go-ipld-selector-text-lite" }, - { "target": "ipld/go-ipldtool" }, - { "target": "ipld/go-storethehash" }, - { "target": "libp2p/dht-tracer1" }, - { "target": "libp2p/dht-utils" }, - { "target": "libp2p/go-buffer-pool" }, - { "target": "libp2p/go-cidranger" }, - { "target": "libp2p/go-composable-routing" }, - { "target": "libp2p/go-conn-security-multistream" }, - { "target": "libp2p/go-doh-resolver" }, - { "target": "libp2p/go-eventbus" }, - { "target": "libp2p/go-flow-metrics" }, - { "target": "libp2p/go-libp2p" }, - { "target": "libp2p/go-libp2p-asn-util" }, - { "target": "libp2p/go-libp2p-backoff" }, - { "target": "libp2p/go-libp2p-blankhost" }, - { "target": "libp2p/go-libp2p-circuit" }, - { "target": "libp2p/go-libp2p-connmgr" }, - { "target": "libp2p/go-libp2p-consensus" }, - { "target": "libp2p/go-libp2p-core" }, - { "target": "libp2p/go-libp2p-daemon" }, - { "target": "libp2p/go-libp2p-discovery" }, - { "target": "libp2p/go-libp2p-gorpc" }, - { "target": "libp2p/go-libp2p-gostream" }, - { "target": "libp2p/go-libp2p-http" }, - { "target": "libp2p/go-libp2p-introspector" }, - { "target": "libp2p/go-libp2p-kad-dht" }, - { "target": "libp2p/go-libp2p-kbucket" }, - { "target": "libp2p/go-libp2p-loggables" }, - { "target": "libp2p/go-libp2p-mplex" }, - { "target": "libp2p/go-libp2p-nat" }, - { "target": "libp2p/go-libp2p-noise" }, - { "target": "libp2p/go-libp2p-peerstore" }, - { "target": "libp2p/go-libp2p-pnet" }, - { "target": "libp2p/go-libp2p-pubsub-router" }, - { "target": "libp2p/go-libp2p-pubsub-tracer" }, - { "target": "libp2p/go-libp2p-quic-transport" }, - { "target": "libp2p/go-libp2p-raft" }, - { "target": "libp2p/go-libp2p-record" }, - { "target": "libp2p/go-libp2p-relay-daemon" }, - { "target": "libp2p/go-libp2p-resource-manager" }, - { "target": "libp2p/go-libp2p-routing-helpers" }, - { "target": "libp2p/go-libp2p-swarm" }, - { "target": "libp2p/go-libp2p-testing" }, - { "target": "libp2p/go-libp2p-tls" }, - { "target": "libp2p/go-libp2p-transport-upgrader" }, - { "target": "libp2p/go-libp2p-webrtc-direct" }, - { "target": "libp2p/go-libp2p-xor" }, - { "target": "libp2p/go-libp2p-yamux" }, - { "target": "libp2p/go-mplex" }, - { "target": "libp2p/go-msgio" }, - { "target": "libp2p/go-nat" }, - { "target": "libp2p/go-netroute" }, - { "target": "libp2p/go-openssl" }, - { "target": "libp2p/go-reuseport" }, - { "target": "libp2p/go-reuseport-transport" }, - { "target": "libp2p/go-routing-language" }, - { "target": "libp2p/go-smart-record" }, - { "target": "libp2p/go-sockaddr" }, - { "target": "libp2p/go-socket-activation" }, - { "target": "libp2p/go-stream-muxer-multistream" }, - { "target": "libp2p/go-tcp-transport" }, - { "target": "libp2p/go-ws-transport" }, - { "target": "libp2p/go-yamux" }, - { "target": "libp2p/hydra-booster" }, - { "target": "libp2p/repl" }, - { "target": "libp2p/zeroconf" }, - { "target": "multiformats/go-base32" }, - { "target": "multiformats/go-base36" }, - { "target": "multiformats/go-multiaddr" }, - { "target": "multiformats/go-multiaddr-dns" }, - { "target": "multiformats/go-multiaddr-fmt" }, - { "target": "multiformats/go-multibase" }, - { "target": "multiformats/go-multicodec" }, - { "target": "multiformats/go-multihash" }, - { "target": "multiformats/go-multistream" }, - { "target": "multiformats/go-varint" }, - { "target": "multiformats/ma-pipe" } -] diff --git a/configs/README.md b/configs/README.md new file mode 100644 index 00000000..9d51d514 --- /dev/null +++ b/configs/README.md @@ -0,0 +1,39 @@ +# Workflow Dispatch Configs + +This directory contains config files used for workflow dispatch. + +| name | description | +| --- | --- | +| go | repositories containing Go code | +| testing | repositories used for testing unified CI workflows | + +## Adding new repository to existing config file + +To add a new repository to an existing config file, add a new JSON object to the `repositories` key in the file. + +_**IMPORTANT**: Please remember to keep `repositories` sorted alphabetically by `target` value._ + +*JSON object example:* +```json +{ "target": "NEW REPOSITORY NAME" } +``` + +After the PR with your change is merged, a copy workflow that runs in this repository will copy files(as defined by the `defaults.files` key of the config file or an overriden `files` key of your newly added object) to your repository. + +## Adding new config file + +When adding a new JSON config file, please follow the structure of other config files. In particular, `defaults.files` array and `repositories` array are required fields. + +*JSON config file example:* +```json +{ + "defaults": { "files": [] }, + "repositories": [] +} +``` + +To customise the copy workflow further, you can add more fields to the `defaults` object. See `deploy_versioning` or `deploy_go` in [go.json](go.json) and how they are used in [copy-workflow.yml](../.github/workflows/copy-workflow.yml) for example. + +## Testing + +You can use [testing](https://github.com/protocol/.github/tree/testing) branch for worklow/configuration testing. Once you push your changes to the branch, a [dispatch](../.github/workflows/dispatch.yml) workflow will be triggered. The workflow will use [testing.json](testing.json) configuration file only. You can manipalate that configuration file as needed(you can copy all the `defaults` from [go.json](go.json) for [example](https://github.com/protocol/.github/commit/43476995428996a90ca95bf838f084ba1a710c68)). diff --git a/configs/go.json b/configs/go.json new file mode 100644 index 00000000..e3160543 --- /dev/null +++ b/configs/go.json @@ -0,0 +1,189 @@ +{ + "defaults": { + "files": [ + ".github/workflows/automerge.yml", + ".github/workflows/go-test.yml", + ".github/workflows/go-check.yml", + ".github/workflows/releaser.yml", + ".github/workflows/release-check.yml", + ".github/workflows/tagpush.yml" + ], + "deploy_versioning": true, + "deploy_go": true + }, + "repositories": [ + { "target": "filecoin-project/go-amt-ipld" }, + { "target": "filecoin-project/go-bitfield" }, + { "target": "filecoin-project/go-commp-utils" }, + { "target": "filecoin-project/go-fil-commp-hashhash" }, + { "target": "filecoin-project/go-hamt-ipld" }, + { "target": "filecoin-project/go-indexer-core" }, + { "target": "filecoin-project/go-legs" }, + { "target": "filecoin-project/indexer-reference-provider" }, + { "target": "filecoin-project/storetheindex" }, + { "target": "filecoin-shipyard/js-lotus-client-schema" }, + { "target": "ipfs-shipyard/dnslink-dnsimple" }, + { "target": "ipfs-shipyard/git-remote-ipld" }, + { "target": "ipfs-shipyard/ipfs-counter" }, + { "target": "ipfs-shipyard/w3rc" }, + { "target": "ipfs/bbloom" }, + { "target": "ipfs/go-bitfield" }, + { "target": "ipfs/go-bitswap" }, + { "target": "ipfs/go-block-format" }, + { "target": "ipfs/go-blockservice" }, + { "target": "ipfs/go-bs-sqlite3" }, + { "target": "ipfs/go-cid" }, + { "target": "ipfs/go-cidutil" }, + { "target": "ipfs/go-dagwriter" }, + { "target": "ipfs/go-datastore" }, + { "target": "ipfs/go-detect-race" }, + { "target": "ipfs/go-dnslink" }, + { "target": "ipfs/go-ds-badger" }, + { "target": "ipfs/go-ds-badger2" }, + { "target": "ipfs/go-ds-bitcask" }, + { "target": "ipfs/go-ds-flatfs" }, + { "target": "ipfs/go-ds-leveldb" }, + { "target": "ipfs/go-ds-measure" }, + { "target": "ipfs/go-ds-pebble" }, + { "target": "ipfs/go-ds-redis" }, + { "target": "ipfs/go-ds-s3" }, + { "target": "ipfs/go-ds-sql" }, + { "target": "ipfs/go-fetcher" }, + { "target": "ipfs/go-filestore" }, + { "target": "ipfs/go-fs-lock" }, + { "target": "ipfs/go-graphsync" }, + { "target": "ipfs/go-ipfs-api" }, + { "target": "ipfs/go-ipfs-blockstore" }, + { "target": "ipfs/go-ipfs-blocksutil" }, + { "target": "ipfs/go-ipfs-chunker" }, + { "target": "ipfs/go-ipfs-cmds" }, + { "target": "ipfs/go-ipfs-config" }, + { "target": "ipfs/go-ipfs-delay" }, + { "target": "ipfs/go-ipfs-ds-help" }, + { "target": "ipfs/go-ipfs-example-plugin" }, + { "target": "ipfs/go-ipfs-exchange-interface" }, + { "target": "ipfs/go-ipfs-exchange-offline" }, + { "target": "ipfs/go-ipfs-files" }, + { "target": "ipfs/go-ipfs-http-client" }, + { "target": "ipfs/go-ipfs-keystore" }, + { "target": "ipfs/go-ipfs-pinner" }, + { "target": "ipfs/go-ipfs-posinfo" }, + { "target": "ipfs/go-ipfs-pq" }, + { "target": "ipfs/go-ipfs-provider" }, + { "target": "ipfs/go-ipfs-routing" }, + { "target": "ipfs/go-ipfs-util" }, + { "target": "ipfs/go-ipld-cbor" }, + { "target": "ipfs/go-ipld-format" }, + { "target": "ipfs/go-ipld-git" }, + { "target": "ipfs/go-ipld-legacy" }, + { "target": "ipfs/go-ipns" }, + { "target": "ipfs/go-log" }, + { "target": "ipfs/go-merkledag" }, + { "target": "ipfs/go-metrics-interface" }, + { "target": "ipfs/go-metrics-prometheus" }, + { "target": "ipfs/go-mfs" }, + { "target": "ipfs/go-namesys" }, + { "target": "ipfs/go-path" }, + { "target": "ipfs/go-peertaskqueue" }, + { "target": "ipfs/go-qringbuf" }, + { "target": "ipfs/go-todocounter" }, + { "target": "ipfs/go-unixfs" }, + { "target": "ipfs/go-unixfsnode" }, + { "target": "ipfs/go-verifcid" }, + { "target": "ipfs/hang-fds" }, + { "target": "ipfs/interface-go-ipfs-core" }, + { "target": "ipfs/ipfs-ds-convert" }, + { "target": "ipfs/ipfs-update" }, + { "target": "ipfs/ipget" }, + { "target": "ipfs/iptb" }, + { "target": "ipfs/iptb-plugins" }, + { "target": "ipfs/pinbot-irc" }, + { "target": "ipfs/tar-utils" }, + { "target": "ipld/codec-fixtures" }, + { "target": "ipld/go-car" }, + { "target": "ipld/go-codec-dagpb" }, + { "target": "ipld/go-ipld-adl-hamt" }, + { "target": "ipld/go-ipld-btc" }, + { "target": "ipld/go-ipld-graphql" }, + { "target": "ipld/go-ipld-prime-proto" }, + { "target": "ipld/go-ipld-schema" }, + { "target": "ipld/go-ipld-selector-text-lite" }, + { "target": "ipld/go-ipldtool" }, + { "target": "ipld/go-storethehash" }, + { "target": "libp2p/dht-tracer1" }, + { "target": "libp2p/dht-utils" }, + { "target": "libp2p/go-buffer-pool" }, + { "target": "libp2p/go-cidranger" }, + { "target": "libp2p/go-composable-routing" }, + { "target": "libp2p/go-conn-security-multistream" }, + { "target": "libp2p/go-doh-resolver" }, + { "target": "libp2p/go-eventbus" }, + { "target": "libp2p/go-flow-metrics" }, + { "target": "libp2p/go-libp2p" }, + { "target": "libp2p/go-libp2p-asn-util" }, + { "target": "libp2p/go-libp2p-backoff" }, + { "target": "libp2p/go-libp2p-blankhost" }, + { "target": "libp2p/go-libp2p-circuit" }, + { "target": "libp2p/go-libp2p-connmgr" }, + { "target": "libp2p/go-libp2p-consensus" }, + { "target": "libp2p/go-libp2p-core" }, + { "target": "libp2p/go-libp2p-daemon" }, + { "target": "libp2p/go-libp2p-discovery" }, + { "target": "libp2p/go-libp2p-gorpc" }, + { "target": "libp2p/go-libp2p-gostream" }, + { "target": "libp2p/go-libp2p-http" }, + { "target": "libp2p/go-libp2p-introspector" }, + { "target": "libp2p/go-libp2p-kad-dht" }, + { "target": "libp2p/go-libp2p-kbucket" }, + { "target": "libp2p/go-libp2p-loggables" }, + { "target": "libp2p/go-libp2p-mplex" }, + { "target": "libp2p/go-libp2p-nat" }, + { "target": "libp2p/go-libp2p-noise" }, + { "target": "libp2p/go-libp2p-peerstore" }, + { "target": "libp2p/go-libp2p-pnet" }, + { "target": "libp2p/go-libp2p-pubsub-router" }, + { "target": "libp2p/go-libp2p-pubsub-tracer" }, + { "target": "libp2p/go-libp2p-quic-transport" }, + { "target": "libp2p/go-libp2p-raft" }, + { "target": "libp2p/go-libp2p-record" }, + { "target": "libp2p/go-libp2p-relay-daemon" }, + { "target": "libp2p/go-libp2p-resource-manager" }, + { "target": "libp2p/go-libp2p-routing-helpers" }, + { "target": "libp2p/go-libp2p-swarm" }, + { "target": "libp2p/go-libp2p-testing" }, + { "target": "libp2p/go-libp2p-tls" }, + { "target": "libp2p/go-libp2p-transport-upgrader" }, + { "target": "libp2p/go-libp2p-webrtc-direct" }, + { "target": "libp2p/go-libp2p-xor" }, + { "target": "libp2p/go-libp2p-yamux" }, + { "target": "libp2p/go-mplex" }, + { "target": "libp2p/go-msgio" }, + { "target": "libp2p/go-nat" }, + { "target": "libp2p/go-netroute" }, + { "target": "libp2p/go-openssl" }, + { "target": "libp2p/go-reuseport" }, + { "target": "libp2p/go-reuseport-transport" }, + { "target": "libp2p/go-routing-language" }, + { "target": "libp2p/go-smart-record" }, + { "target": "libp2p/go-sockaddr" }, + { "target": "libp2p/go-socket-activation" }, + { "target": "libp2p/go-stream-muxer-multistream" }, + { "target": "libp2p/go-tcp-transport" }, + { "target": "libp2p/go-ws-transport" }, + { "target": "libp2p/go-yamux" }, + { "target": "libp2p/hydra-booster" }, + { "target": "libp2p/repl" }, + { "target": "libp2p/zeroconf" }, + { "target": "multiformats/go-base32" }, + { "target": "multiformats/go-base36" }, + { "target": "multiformats/go-multiaddr" }, + { "target": "multiformats/go-multiaddr-dns" }, + { "target": "multiformats/go-multiaddr-fmt" }, + { "target": "multiformats/go-multibase" }, + { "target": "multiformats/go-multicodec" }, + { "target": "multiformats/go-multihash" }, + { "target": "multiformats/go-multistream" }, + { "target": "multiformats/go-varint" }, + { "target": "multiformats/ma-pipe" } + ] +} diff --git a/configs/testing.json b/configs/testing.json new file mode 100644 index 00000000..f1eaf8b6 --- /dev/null +++ b/configs/testing.json @@ -0,0 +1,8 @@ +{ + "defaults": { + "files": [] + }, + "repositories": [ + { "target": "protocol/.github-test-target" } + ] +}