Skip to content

repo_tests

repo_tests #51

Workflow file for this run

name: repo_tests
on: [workflow_dispatch, workflow_call]
jobs:
repo_tests:
name: ${{ matrix.repo }} ${{ matrix.description }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
# Items in this list satisfy a few criteria:
#
# * test has to be useful/interesting and add value atop the monorepo tests for
# trunk init
#
# * the repo has to exercise some functionality specific to action.yaml (e.g. our
# custom Node functionality for npm/yarn/pnpm)
#
# * the repo and its dependency closure should be fast to set up, since we trigger
# this workflow on PRs
#
- repo: highlightjs/highlight.js
ref: 4f9cd3bffb6bc55c9e2c4252c7b733a219880151
description: (uses npm)
post-init: |
cp local-action/repo_tests/highlightjs.yaml .trunk/user.yaml
- repo: jbeder/yaml-cpp
ref: 0e6e28d1a38224fc8172fae0109ea7f673c096db
description: (compile-commands.json)
post-init: |
# black complains about py2 code
${TRUNK_PATH} check disable black
mkdir build
cd build
cmake .. -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
cd ..
ln -s build/compile_commands.json
sed -i "s|lint:|lint:\n compile_commands: json|" .trunk/trunk.yaml
cp local-action/repo_tests/yaml_cpp.yaml .trunk/user.yaml
${TRUNK_PATH} check enable clang-tidy
# fails because of a malformed html file
# - repo: pallets/flask
# ref: 2b2a7641430bc7d40dba3c8d701636fc9b16530c
# post-init: |
# cp local-action/repo_tests/flask.yaml .trunk/user.yaml
- repo: postcss/postcss
ref: aa9e03ea4708909631eba70500c8c0cc0708bb4e
description: (uses pnpm)
post-init: |
${TRUNK_PATH} check enable eslint
- repo: replayio/devtools
ref: 730a9f0ddaafefc2a1a293d6924ce3910cd156ac
description: (has trunk.yaml)
post-init: |
# replay is on a very old version
${TRUNK_PATH} upgrade
trunk-path: node_modules/.bin/trunk
- repo: sass/sass
ref: 225e176115211387e014d97ae0076d94de3152a1
description: (uses npm)
# fails because yarn install would update the yarn lockfile
# - repo: sheldonhull/sheldonhull.hugo
# ref: 4796211f1adeeb1858f2f9bf74d7ee0b4e2d8988
# description: (has trunk.yaml)
- repo: shopify/draggable
ref: e6cf325a98c11b8aefbfb626b7a91b95d1c340c9
description: (uses yarn)
- repo: terraform-linters/tflint
ref: 9c34a740319e2410094ca2754e5eca860f2d13f5
post-init: |
# golangci-lint needs us to init with a newer go runtime
${TRUNK_PATH} check disable golangci-lint
- repo: trunk-io/plugins
ref: main
# fails because pnpm version is too new
# - repo: vuejs/core
# ref: 2d9f6f926453c46f542789927bcd30d15da9c24b
# description: (uses pnpm)
# post-init: |
# # svgo gets confused by JS module loading
# ${TRUNK_PATH} check disable svgo
- repo: z-shell/wiki
ref: 7d0ea1b14d2f163d54111655aa9aa737f3710b72
description: (has trunk.yaml)
steps:
- name: Checkout ${{ matrix.repo }}
uses: actions/checkout@v3
with:
repository: ${{ matrix.repo }}
ref: ${{ matrix.ref }}
- name: Checkout ${{ github.repository }}
uses: actions/checkout@v3
with:
path: local-action
- name: Make fake GITHUB_EVENT_PATH file
shell: python
run: |
f = open("/tmp/fake_github_event_file", "w")
f.write('''{
"inputs": {
"clientPayload": "{\\"targetCheckoutRef\\":\\"refs/pull/9004/merge\\",\\"targetRefName\\":\\"9004/merge\\",\\"checkMode\\":\\"pull_request\\",\\"token\\":\\"fake-token\\",\\"pullRequest\\":{\\"number\\":9004,\\"head\\":{\\"sha\\":\\"70d320b0df1c866206958c5be4a0f18f33cfe6e9\\",\\"ref\\":\\"maverick/trunk-7347-finalize-all-in-progress-check-runs-from-on-pr-webhook\\"},\\"base\\":{\\"sha\\":\\"833f6d5cce8448aeeadada109c0d5ca7d7751df5\\",\\"ref\\":\\"main\\"}},\\"checkRunId\\":13970804651,\\"version\\":\\"0.0.0\\",\\"cache\\":true,\\"cacheKey\\":\\"trunk-check\\",\\"cachePath\\":\\"~/.cache/trunk/tools/ruby\\",\\"checkJobName\\":\\"trunk/pull_request\\",\\"checkJobRunsOn\\":[\\"self-hosted\\",\\"linux\\",\\"r6id2xlarge\\"],\\"concurrencyGroup\\":\\"trunk/pull_request/9004\\",\\"githubToken\\":\\"fake-token\\",\\"targetCheckout\\":\\"trunk-io/trunk\\",\\"uploadLandingState\\":true}",
"client_payload": "{\\"targetCheckoutRef\\":\\"refs/pull/9004/merge\\",\\"targetRefName\\":\\"9004/merge\\",\\"checkMode\\":\\"pull_request\\",\\"token\\":\\"fake-token\\",\\"pullRequest\\":{\\"number\\":9004,\\"head\\":{\\"sha\\":\\"70d320b0df1c866206958c5be4a0f18f33cfe6e9\\",\\"ref\\":\\"maverick/trunk-7347-finalize-all-in-progress-check-runs-from-on-pr-webhook\\"},\\"base\\":{\\"sha\\":\\"833f6d5cce8448aeeadada109c0d5ca7d7751df5\\",\\"ref\\":\\"main\\"}},\\"checkRunId\\":13970804651,\\"version\\":\\"0.0.0\\",\\"cache\\":true,\\"cacheKey\\":\\"trunk-check\\",\\"cachePath\\":\\"~/.cache/trunk/tools/ruby\\",\\"checkJobName\\":\\"trunk/pull_request\\",\\"checkJobRunsOn\\":[\\"self-hosted\\",\\"linux\\",\\"r6id2xlarge\\"],\\"concurrencyGroup\\":\\"trunk/pull_request/9004\\",\\"githubToken\\":\\"fake-token\\",\\"targetCheckout\\":\\"trunk-io/trunk\\",\\"uploadLandingState\\":true}",
"githubToken": \\"fake-token\\",
"trunkToken": \\"fake-token\\"
},
"organization": {
"avatar_url": "https://avatars.githubusercontent.com/u/74779146?v=4",
"description": "The new standard for modern software development",
"events_url": "https://api.github.com/orgs/trunk-io/events",
"hooks_url": "https://api.github.com/orgs/trunk-io/hooks",
"id": 74779146,
"issues_url": "https://api.github.com/orgs/trunk-io/issues",
"login": "trunk-io",
"members_url": "https://api.github.com/orgs/trunk-io/members{/member}",
"node_id": "MDEyOk9yZ2FuaXphdGlvbjc0Nzc5MTQ2",
"public_members_url": "https://api.github.com/orgs/trunk-io/public_members{/member}",
"repos_url": "https://api.github.com/orgs/trunk-io/repos",
"url": "https://api.github.com/orgs/trunk-io"
},
"ref": "refs/heads/main",
"repository": {
"allow_forking": false,
"archive_url": "https://api.github.com/repos/trunk-io/.trunk-internal/{archive_format}{/ref}",
"archived": false,
"assignees_url": "https://api.github.com/repos/trunk-io/.trunk-internal/assignees{/user}",
"blobs_url": "https://api.github.com/repos/trunk-io/.trunk-internal/git/blobs{/sha}",
"branches_url": "https://api.github.com/repos/trunk-io/.trunk-internal/branches{/branch}",
"clone_url": "https://github.com/trunk-io/.trunk-internal.git",
"collaborators_url": "https://api.github.com/repos/trunk-io/.trunk-internal/collaborators{/collaborator}",
"comments_url": "https://api.github.com/repos/trunk-io/.trunk-internal/comments{/number}",
"commits_url": "https://api.github.com/repos/trunk-io/.trunk-internal/commits{/sha}",
"compare_url": "https://api.github.com/repos/trunk-io/.trunk-internal/compare/{base}...{head}",
"contents_url": "https://api.github.com/repos/trunk-io/.trunk-internal/contents/{+path}",
"contributors_url": "https://api.github.com/repos/trunk-io/.trunk-internal/contributors",
"created_at": "2023-03-28T18:55:32Z",
"default_branch": "main",
"deployments_url": "https://api.github.com/repos/trunk-io/.trunk-internal/deployments",
"description": null,
"disabled": false,
"downloads_url": "https://api.github.com/repos/trunk-io/.trunk-internal/downloads",
"events_url": "https://api.github.com/repos/trunk-io/.trunk-internal/events",
"fork": false,
"forks": 0,
"forks_count": 0,
"forks_url": "https://api.github.com/repos/trunk-io/.trunk-internal/forks",
"full_name": "trunk-io/.trunk-internal",
"git_commits_url": "https://api.github.com/repos/trunk-io/.trunk-internal/git/commits{/sha}",
"git_refs_url": "https://api.github.com/repos/trunk-io/.trunk-internal/git/refs{/sha}",
"git_tags_url": "https://api.github.com/repos/trunk-io/.trunk-internal/git/tags{/sha}",
"git_url": "git://github.com/trunk-io/.trunk-internal.git",
"has_discussions": false,
"has_downloads": true,
"has_issues": true,
"has_pages": false,
"has_projects": true,
"has_wiki": true,
"homepage": null,
"hooks_url": "https://api.github.com/repos/trunk-io/.trunk-internal/hooks",
"html_url": "https://github.com/trunk-io/.trunk-internal",
"id": 620475538,
"is_template": false,
"issue_comment_url": "https://api.github.com/repos/trunk-io/.trunk-internal/issues/comments{/number}",
"issue_events_url": "https://api.github.com/repos/trunk-io/.trunk-internal/issues/events{/number}",
"issues_url": "https://api.github.com/repos/trunk-io/.trunk-internal/issues{/number}",
"keys_url": "https://api.github.com/repos/trunk-io/.trunk-internal/keys{/key_id}",
"labels_url": "https://api.github.com/repos/trunk-io/.trunk-internal/labels{/name}",
"language": null,
"languages_url": "https://api.github.com/repos/trunk-io/.trunk-internal/languages",
"license": null,
"merges_url": "https://api.github.com/repos/trunk-io/.trunk-internal/merges",
"milestones_url": "https://api.github.com/repos/trunk-io/.trunk-internal/milestones{/number}",
"mirror_url": null,
"name": ".trunk-internal",
"node_id": "R_kgDOJPu0kg",
"notifications_url": "https://api.github.com/repos/trunk-io/.trunk-internal/notifications{?since,all,participating}",
"open_issues": 1,
"open_issues_count": 1,
"owner": {
"avatar_url": "https://avatars.githubusercontent.com/u/74779146?v=4",
"events_url": "https://api.github.com/users/trunk-io/events{/privacy}",
"followers_url": "https://api.github.com/users/trunk-io/followers",
"following_url": "https://api.github.com/users/trunk-io/following{/other_user}",
"gists_url": "https://api.github.com/users/trunk-io/gists{/gist_id}",
"gravatar_id": "",
"html_url": "https://github.com/trunk-io",
"id": 74779146,
"login": "trunk-io",
"node_id": "MDEyOk9yZ2FuaXphdGlvbjc0Nzc5MTQ2",
"organizations_url": "https://api.github.com/users/trunk-io/orgs",
"received_events_url": "https://api.github.com/users/trunk-io/received_events",
"repos_url": "https://api.github.com/users/trunk-io/repos",
"site_admin": false,
"starred_url": "https://api.github.com/users/trunk-io/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/trunk-io/subscriptions",
"type": "Organization",
"url": "https://api.github.com/users/trunk-io"
},
"private": true,
"pulls_url": "https://api.github.com/repos/trunk-io/.trunk-internal/pulls{/number}",
"pushed_at": "2023-06-02T22:31:01Z",
"releases_url": "https://api.github.com/repos/trunk-io/.trunk-internal/releases{/id}",
"size": 24,
"ssh_url": "git@github.com:trunk-io/.trunk-internal.git",
"stargazers_count": 0,
"stargazers_url": "https://api.github.com/repos/trunk-io/.trunk-internal/stargazers",
"statuses_url": "https://api.github.com/repos/trunk-io/.trunk-internal/statuses/{sha}",
"subscribers_url": "https://api.github.com/repos/trunk-io/.trunk-internal/subscribers",
"subscription_url": "https://api.github.com/repos/trunk-io/.trunk-internal/subscription",
"svn_url": "https://github.com/trunk-io/.trunk-internal",
"tags_url": "https://api.github.com/repos/trunk-io/.trunk-internal/tags",
"teams_url": "https://api.github.com/repos/trunk-io/.trunk-internal/teams",
"topics": [],
"trees_url": "https://api.github.com/repos/trunk-io/.trunk-internal/git/trees{/sha}",
"updated_at": "2023-05-03T16:49:35Z",
"url": "https://api.github.com/repos/trunk-io/.trunk-internal",
"visibility": "private",
"watchers": 0,
"watchers_count": 0,
"web_commit_signoff_required": false
},
"sender": {
"avatar_url": "https://avatars.githubusercontent.com/in/125632?v=4",
"events_url": "https://api.github.com/users/trunk-staging-io%5Bbot%5D/events{/privacy}",
"followers_url": "https://api.github.com/users/trunk-staging-io%5Bbot%5D/followers",
"following_url": "https://api.github.com/users/trunk-staging-io%5Bbot%5D/following{/other_user}",
"gists_url": "https://api.github.com/users/trunk-staging-io%5Bbot%5D/gists{/gist_id}",
"gravatar_id": "",
"html_url": "https://github.com/apps/trunk-staging-io",
"id": 87141165,
"login": "trunk-staging-io[bot]",
"node_id": "MDM6Qm90ODcxNDExNjU=",
"organizations_url": "https://api.github.com/users/trunk-staging-io%5Bbot%5D/orgs",
"received_events_url": "https://api.github.com/users/trunk-staging-io%5Bbot%5D/received_events",
"repos_url": "https://api.github.com/users/trunk-staging-io%5Bbot%5D/repos",
"site_admin": false,
"starred_url": "https://api.github.com/users/trunk-staging-io%5Bbot%5D/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/trunk-staging-io%5Bbot%5D/subscriptions",
"type": "Bot",
"url": "https://api.github.com/users/trunk-staging-io%5Bbot%5D"
},
"workflow": ".github/workflows/trunk-check.yaml"
}''')
f.close()
- name: Run trunk-action in ${{ matrix.repo }}
id: trunk
uses: ./local-action/
with:
cache: true
check-mode: all
trunk-path: ${{ matrix.trunk-path }}
post-init: ${{ matrix.post-init }}
arguments: --output-file=.trunk/landing-state.json
cache-key: repo_tests/${{ matrix.repo }}
setup-deps: true
github-event-path: /tmp/fake_github_event_file
json: '{"targetCheckoutRef":"refs/pull/9042/merge","targetRefName":"9042/merge","checkMode":"pull_request","token":"fake-trunk-token","pullRequest":{"number":9042,"head":{"sha":"4e54c7d493b70adf4e4f3fd0188e0ffa5dc58ec2","ref":"elton/fix"},"base":{"sha":"b0fda5a68784996673bd6256085f02ae4dd75c51","ref":"elton/transitions"}},"checkRunId":13970097585,"version":"0.0.0","cache":true,"cacheKey":"trunk-check","cachePath":"~/.cache/trunk/tools/ruby","checkJobName":"trunk/pull_request","checkJobRunsOn":["self-hosted","linux","r6id2xlarge"],"concurrencyGroup":"trunk/pull_request/9042","githubToken":"fake-github-token","targetCheckout":"trunk-io/trunk","uploadLandingState":true}'
continue-on-error: true
- name: Check for task failures
shell: bash
run: |
python3 local-action/repo_tests/check_for_task_failures.py \
'${{ github.env }}' \
'${{ matrix.repo }}' \
'${{ matrix.description }}'
- name: Upload landing state
uses: actions/upload-artifact@v3
with:
name: ${{ env.landing_state_artifact_name }} landing state
path: .trunk/landing-state.json