Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

check github actions yamls #272

Merged
merged 5 commits into from
Jan 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/workflows/check-config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
on:
on:
pull_request:
paths:
- 'configs/*.json'
Expand All @@ -8,8 +8,6 @@ name: Check Config
jobs:
check-config:
runs-on: ubuntu-latest
outputs:
targets: ${{ steps.set-matrix.outputs.targets }}
steps:
- uses: actions/checkout@v2
- name: check if config files are sorted alphabetically
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/check-yaml.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
on:
pull_request:
paths:
- '**/action.yml'
- '**/action.yaml'
- '**/.github/workflows/*.yml'
- '**/.github/workflows/*.yaml'

name: Check YAML

jobs:
check-yaml:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# TODO: switch to mainline once https://github.com/nwisbeta/validate-yaml-schema/pull/21 is merged
- uses: galargh/validate-yaml-schema@c8060d4a389d0eec986a90665bf0c496bf1f52e8
with:
yamlSchemasJson: |
{
"https://json.schemastore.org/github-action.json": ["**/action.yml", "**/action.yaml"],
"https://json.schemastore.org/github-workflow.json": ["**/.github/workflows/*.yml", "**/.github/workflows/*.yaml"]
}
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Some repositories may require some pre-setup steps to be run before tests (or co
runs:
using: "composite"
steps:
- name: Step 1
- name: Step 1
shell: bash
run: echo "do some initial setup"
- name: Step 2
Expand Down Expand Up @@ -60,5 +60,11 @@ If you want your project to participle, please send a PR!

## Development

### Branches

The `master` branch contains currently deployed workflows.
When we make minor changes to these workflows, we don't always want these changes to get deployed to all hundreds of repositories, as this creates a lot of unnecessary noise. Minor changes to the workflows are therefore merged into the [`next`](https://github.com/protocol/.github/tree/next) branch. When the time has come, we create a PR from the `next` branch to `master` to trigger a deployment to all repositores.

### IDE

If you're using [Visual Studio Code](https://code.visualstudio.com/) for development, you might want to install the [YAML](https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml) extension. It is configured to perform GitHub workflow/action linting out-of-the-box. If you're using a different IDE, you can check if a [client](https://github.com/redhat-developer/yaml-language-server#clients) for it exists.
4 changes: 2 additions & 2 deletions templates/.github/workflows/go-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ jobs:
go: [ "1.16.x", "1.17.x" ]
env:
COVERAGES: ""
runs-on: ${{ matrix.os }}-latest
name: ${{ matrix.os}} (go ${{ matrix.go }})
runs-on: ${{ format('${0}-latest', matrix.os) }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was the old syntax wrong? I'm a bit confused because it apparently worked just fine :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It worked but the schema from https://json.schemastore.org/github-workflow.json didn't account for it. I'll see if there's a way to express what we were doing in that schema - if so I'll create a PR but, personally, I'd be fine with the setup proposed here too.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. Slight preference for keeping what we had, because it was simpler, but I also don't think it matters too much :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had a look at JSON schema and it seems it'd be quite complicated to add that runs-on accepts any prefix of a valid runner name + expression syntax + any suffix of a valid runner name so if you don't mind, I'd stick with the string format.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SGTM! Thanks for being thorough :)

name: ${{ matrix.os }} (go ${{ matrix.go }})
steps:
- uses: actions/checkout@v2
with:
Expand Down