Skip to content

Commit

Permalink
Run spec checks in their own GitHub Actions job (#2127)
Browse files Browse the repository at this point in the history
* Run spec checks in their own GitHub Actions job

Currently workflows for PRs fail early and nobody knows if the tests
and linters pass or fail.

* Stop using the deprecated `set-output`

See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/

* Pin the Python version used by the maintenance workflow

Afaik ubuntu-latest comes with Python 3.10 at the moment.  Also use
`python -m pip` instead of `pip`, see
https://snarky.ca/why-you-should-use-python-m-pip/.

* Give the maintenance workflow a name
  • Loading branch information
michael-k authored Feb 23, 2023
1 parent 536ff04 commit fed1723
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/maintenance.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
name: Automated Maintenance
on:
schedule:
- cron: '0 13 * * *'
Expand All @@ -7,14 +8,17 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- run: |
pip install -r requirements-dev.txt
python -m pip install -r requirements-dev.txt
make spec
make regen
- name: Set spec version variable
id: vars
run: |
echo ::set-output name=pr_title::"Updates from spec version $(jq -r .ResourceSpecificationVersion CloudFormationResourceSpecification.json)"
echo "pr_title=Updates from spec version $(jq -r .ResourceSpecificationVersion CloudFormationResourceSpecification.json)" >> $GITHUB_OUTPUT
- uses: peter-evans/create-pull-request@v4
with:
commit-message: |
Expand Down
20 changes: 16 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,24 @@ jobs:
pip install -r requirements-dev.txt
- name: Install Node Dependencies
run: npm install
- name: Run Lints
run: make lint
- name: Run Tests
run: make test

test-spec:
name: Spec Generation & Formatting Fixups
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install Python Dependencies
run: |
python -m pip install -r requirements-dev.txt
- name: Ensure spec generation and formatting fixups are clean
run: |
make spec
make regen
git diff --exit-code
- name: Run Lints
run: make lint
- name: Run Tests
run: make test

0 comments on commit fed1723

Please sign in to comment.