Skip to content

Commit

Permalink
ci: use renovate, update CI and precommit and automate docs
Browse files Browse the repository at this point in the history
  • Loading branch information
tagoro9 committed Jul 5, 2024
1 parent 46d1a07 commit 9063d4e
Show file tree
Hide file tree
Showing 12 changed files with 214 additions and 111 deletions.
6 changes: 0 additions & 6 deletions .github/dependabot.yaml

This file was deleted.

56 changes: 9 additions & 47 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ name: CI

on:
pull_request:
push:
branches: [main]

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: open-turo/actions-gha/lint@v1
- uses: open-turo/actions-gha/lint@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

Expand All @@ -18,8 +19,7 @@ jobs:
runs-on: ubuntu-latest
needs: [test-upload, test-download]
steps:
# This test is for node-based actions, we want to test our actions
- uses: open-turo/actions-gha/test@v1
- uses: open-turo/actions-gha/test@v2
with:
checkout-repo: true
github-token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -32,30 +32,16 @@ jobs:
S3_BUCKET: actions-s3-artifact-test
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Create python requirements, for caching
run: |
cat > requirements.txt <<-EOF
awscli
awscli-local[ver1]
boto3>=1.20
botocore<1.28.0,>=1.27.80
localstack
pyopenssl
EOF
uses: actions/checkout@v4
- name: Setup Python dependency cache
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version-file: .python-version
cache: "pip"
- name: Install python dependencies
run: pip install -r requirements.txt
# TODO: Replace this for faster localstack startup, particularly docker
# image caching or using a leaner image
- name: Setup LocalStack
uses: HarshCasper/[email protected]
# env:
# LOCALSTACK_API_KEY: ${{ secrets.LOCALSTACK_API_KEY }}
- name: Create S3 bucket in localstack
run: awslocal s3 mb "s3://${S3_BUCKET}"
- name: Upload individual files
Expand Down Expand Up @@ -113,26 +99,14 @@ jobs:
S3_BUCKET: actions-s3-artifact-test
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Create python requirements, for caching
run: |
cat > requirements.txt <<-EOF
awscli
awscli-local[ver1]
boto3>=1.20
botocore<1.28.0,>=1.27.80
localstack
pyopenssl
EOF
uses: actions/checkout@v4
- name: Setup Python dependency cache
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version-file: .python-version
cache: "pip"
- name: Install python dependencies
run: pip install -r requirements.txt
# TODO: Replace this for faster localstack startup, particularly docker
# image caching or using a leaner image
- name: Setup LocalStack
uses: HarshCasper/[email protected]
- name: Create S3 bucket in localstack
Expand Down Expand Up @@ -225,26 +199,14 @@ jobs:
S3_BUCKET: actions-s3-artifact-test
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Create python requirements, for caching
run: |
cat > requirements.txt <<-EOF
awscli
awscli-local[ver1]
boto3>=1.20
botocore<1.28.0,>=1.27.80
localstack
pyopenssl
EOF
uses: actions/checkout@v4
- name: Setup Python dependency cache
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version-file: .python-version
cache: "pip"
- name: Install python dependencies
run: pip install -r requirements.txt
# TODO: Replace this for faster localstack startup, particularly docker
# image caching or using a leaner image
- name: Setup LocalStack
uses: HarshCasper/[email protected]
- name: Create S3 bucket in localstack
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ jobs:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: open-turo/actions-gha/lint@v1
- uses: open-turo/actions-gha/lint@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: open-turo/actions-gha/test@v1
- uses: open-turo/actions-gha/test@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

Expand All @@ -28,6 +28,6 @@ jobs:
name: Release
runs-on: ubuntu-latest
steps:
- uses: open-turo/actions-gha/release@v1
- uses: open-turo/actions-gha/release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25 changes: 25 additions & 0 deletions .github/workflows/update-dependencies.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Update dependencies
concurrency: update-dependencies

on:
schedule:
# Every day at midnight
- cron: "0 0 * * *"
workflow_dispatch:
issue_comment:
types:
- edited
pull_request:
types:
- edited

jobs:
update-dependencies:
runs-on: ubuntu-latest
name: Update dependencies
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: open-turo/action-renovate@v1
with:
github-token: ${{ secrets.OPEN_TURO_GITHUB_TOKEN }}
22 changes: 15 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,34 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0 # Use the ref you want to point at
rev: v4.6.0 # Use the ref you want to point at
hooks:
- id: check-json
- id: check-yaml
- id: pretty-format-json
args:
- --autofix
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/pre-commit/mirrors-eslint
rev: v9.6.0
hooks:
- id: eslint
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.5.1
rev: v3.1.0
hooks:
- id: prettier
stages: [commit]
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
rev: v8.0.0
rev: v9.16.0
hooks:
- id: commitlint
stages: [commit-msg]
additional_dependencies: ["@open-turo/commitlint-config-conventional"]
- repo: https://github.com/rhysd/actionlint
rev: v1.6.8
rev: v1.7.1
hooks:
- id: actionlint
- repo: local
hooks:
- id: update-action-readme
name: update-action-readme
entry: ./script/update-action-readme
language: script
files: '.*action\.yaml$'
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.10.4
3.10.14
14 changes: 1 addition & 13 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
{
"branches": [
"main",
{
"channel": "next",
"name": "(f|b|c)/*",
"prerelease": "beta-<%= (/^\\w+-\\d+/.exec(name.substr(2)) || [])[0] %>"
}
],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/github"
]
"extends": "@open-turo/semantic-release-config"
}
Empty file removed action.yaml
Empty file.
87 changes: 69 additions & 18 deletions download/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Github Action S3 Artifact Download

This action downloads a file or directory from an S3 bucket.
<!-- prettier-ignore-start -->
<!-- action-docs-description -->

## Description

GitHub Action that builds Node based repository

<!-- prettier-ignore-end -->

## Usage

Expand Down Expand Up @@ -127,25 +134,69 @@ This example shows how to make a passthrough failure download attempt.
not-found: ignore
```
<!-- prettier-ignore-start -->
<!-- action-docs-inputs source="action.yaml" -->
## Inputs
| parameter | description | required | default |
| --------------------- | ------------------------------------------------------------- | -------- | --------- |
| path | Path to download artifacts to | `false` | . |
| strip | Strip leading path components from downloaded artifacts | `false` | |
| s3uri | S3 uri to artifact to download | `true` | |
| not-found | What to do if the artifact is not found (error, warn, ignore) | `false` | error |
| aws-access-key-id | AWS access key ID of the S3 location | `false` | |
| aws-secret-access-key | AWS secret access key ID of the S3 location | `false` | |
| aws-region | AWS region of the S3 location | `false` | us-east-1 |

## Outputs

| parameter | description |
| --------- | -------------------------------------------- |
| s3uri | S3 URL for uploaded artifact |
| success | Whether the artifact download was successful |

| parameter | description | required | default |
| --- | --- | --- | --- |
| checkout-repo | Perform checkout as first step of action | `false` | true |
| build-script | Custom script to run, should be defined in package.json. | `false` | build |
| github-token | GitHub token that can checkout the repository. e.g. 'secrets.GITHUB_TOKEN' | `true` | ${{ github.token }} |
| npm-auth-token | The Node Package Manager (npm) authentication token. This token is used to authenticate against a private NPM registry configured via a .npmrc file. | `false` | |
| npm-token | The Node Package Manager (npm) authentication token. This token is used to authenticate against the NPM registry. | `false` | |
<!-- action-docs-outputs source="action.yaml" -->
<!-- action-docs-runs source="action.yaml" -->
## Runs

This action is a `composite` action.
<!-- action-docs-usage source="action.yaml" -->
## Usage

```yaml
- uses: @
with:
path:
# Path to download artifacts to
#
# Required: false
# Default: .
strip:
# Strip leading path components from downloaded artifacts
#
# Required: false
# Default: ""
s3uri:
# S3 uri to artifact to download
#
# Required: true
# Default: ""
not-found:
# What to do if the artifact is not found (error, warn, ignore)
#
# Required: false
# Default: error
aws-access-key-id:
# AWS access key ID of the S3 location
#
# Required: false
# Default: ""
aws-secret-access-key:
# AWS secret access key ID of the S3 location
#
# Required: false
# Default: ""
aws-region:
# AWS region of the S3 location
#
# Required: false
# Default: us-east-1
```
<!-- action-docs-usage source="action.yaml" -->
<!-- prettier-ignore-end -->
6 changes: 6 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
awscli==1.33.21
awscli-local==0.22.0
boto3==1.34.139
botocore==1.34.139
localstack==3.5.0
pyOpenSSL==24.1.0
16 changes: 16 additions & 0 deletions script/update-action-readme
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash

set -e

for i in $*; do
# ignore if the file does not end with /action.yaml
if [[ "$i" != *"/action.yaml" ]]; then
echo "skipping: ${i}"
continue
fi

echo "npx action-docs --no-banner -s "${i}""
cd $(dirname "$i")
npx action-docs@2 --no-banner -s action.yaml -u README.md || echo "action-docs failed for $i"
cd -
done
Loading

0 comments on commit 9063d4e

Please sign in to comment.