Skip to content

Commit

Permalink
Merge pull request #1 from MetRonnie/content
Browse files Browse the repository at this point in the history
Add the actions
  • Loading branch information
oliver-sanders authored Sep 10, 2020
2 parents 4eb5422 + b09ab35 commit 3b646be
Show file tree
Hide file tree
Showing 19 changed files with 1,667 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"env": {
"commonjs": true,
"es6": true,
"node": true
},
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": 2018
},
"rules": {
}
}
20 changes: 20 additions & 0 deletions .github/workflows/style_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Style test

on:
pull_request:

jobs:

style-test:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:

- name: Checkout repo
uses: actions/[email protected]

- name: Install (dev) dependencies
run: npm install

- name: Style test
run: npx eslint .
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules/**

!node_modules/cylc-action-utils.js
# Have put that file in node_modules so that we don't have to specify the path to it every time we require() it
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,35 @@
# release-actions

GitHub Actions for automating releases

## Usage

Use the repository + path to the action subdirectory in the workflow.

As an example - in a workflow's `jobs.<job_id>.steps` section:
```yaml
- name: Create & checkout PR branch
uses: cylc/release-actions/stage-1/checkout-pr-branch@v1
```
Some actions require inputs or env variables, e.g.
```yaml
- name: Comment on the release PR with the results & next steps
uses: cylc/release-actions/stage-2/comment-on-pr@v1
with:
release-url: ${{ steps.create-release.outputs.html_url }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```
See the `action.yml` file for what is required for a particular action.

## Contributing

The `v1` tag should be updated to point at the latest release that maintains backwards compatibility.

Note: Certain modules (e.g. `cylc-action-utils.js`) may be kept in `node_modules/` so that they don't have to be referenced by path when using `require()`, and should be unignored in `.gitignore`. For some reason, `yarn install` causes these modules to be deleted, so stick to `npm install`.

Info on "composite run step" actions:
- https://docs.github.com/en/actions/creating-actions/creating-a-composite-run-steps-action
- https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runs-for-composite-run-steps-actions
33 changes: 33 additions & 0 deletions bin/cmp_py_versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env python3

# THIS FILE IS PART OF THE CYLC SUITE ENGINE.
# Copyright (C) NIWA & British Crown (Met Office) & Contributors.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

"""Check if two PEP 440 compliant Python package version numbers are equal.
Usage:
$ cmp_py_versions <version_number1> <version_number2>
You can also check if a single version number is valid by passing it twice.
"""

import sys
import packaging.version

ver1, ver2 = [packaging.version.Version(i) for i in sys.argv[1:3]]

if ver1 != ver2:
print(f'{ver1} not equal to {ver2}')
20 changes: 20 additions & 0 deletions build-python-package/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Build Python package
description: Build Python package wheel distribution. Can also be run in test mode.
inputs:
dry-run:
description: If true, merely test the build process in a temporary directory
required: false
default: false
runs:
using: composite
steps:
- shell: bash
env:
IS_TEST: ${{ inputs.dry-run }}
run: |
if "$IS_TEST"; then
cd $( mktemp -d )
python3 "${{ github.workspace }}/setup.py" bdist_wheel
else
python3 setup.py bdist_wheel sdist
fi
55 changes: 55 additions & 0 deletions node_modules/cylc-action-utils.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3b646be

Please sign in to comment.