Skip to content

Commit

Permalink
adding up-to-date artifacts from saltext-vault
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholasmhughes committed Dec 9, 2023
1 parent 075420b commit 408f6d4
Show file tree
Hide file tree
Showing 6 changed files with 685 additions and 3 deletions.
163 changes: 163 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
name: CI

on:
workflow_call:
inputs:
release:
required: false
type: boolean
default: false
version:
required: false
type: string
secrets:
PYPI_API_TOKEN:
required: false
TEST_PYPI_API_TOKEN:
required: false


jobs:
get-changed-files:
name: Get Changed Files
runs-on: ubuntu-latest
permissions:
contents: read # for dorny/paths-filter to fetch a list of changed files
pull-requests: read # for dorny/paths-filter to read pull requests
outputs:
changed-files: ${{ toJSON(steps.changed-files.outputs) }}
steps:
- uses: actions/checkout@v3
- name: Get Changed Files
id: changed-files
uses: dorny/paths-filter@v2
with:
token: ${{ github.token }}
list-files: json
filters: |
repo:
- added|modified:
- '**'
deleted:
- deleted:
- '**'
pre-commit:
name: Pre-Commit
uses: ./.github/workflows/pre-commit-action.yml
needs:
- get-changed-files
with:
changed-files: ${{ needs.get-changed-files.outputs.changed-files }}

test:
name: Test
needs:
- get-changed-files
uses: ./.github/workflows/test-action.yml
with:
changed-files: ${{ needs.get-changed-files.outputs.changed-files }}

docs:
name: Docs
needs:
- get-changed-files
uses: ./.github/workflows/docs-action.yml
with:
changed-files: ${{ needs.get-changed-files.outputs.changed-files }}

# build-python-package:
# name: Python Package
# if: ${{ inputs.release && success() }}
# uses: ./.github/workflows/package-action.yml
# needs:
# - pre-commit
# with:
# version: "${{ inputs.version }}"
#
# deploy-python-package-test-pypi:
# name: Deploy Python Package (Test PyPI)
# uses: ./.github/workflows/deploy-package-action.yml
# if: ${{ inputs.release && success() }}
# needs:
# - pre-commit
# - test
# - docs
# - build-python-package
# secrets:
# TEST_PYPI_API_TOKEN: "${{ secrets.TEST_PYPI_API_TOKEN }}"
# with:
# version: "${{ inputs.version }}"
#
# deploy-python-package:
# name: Deploy Python Package (PyPI)
# uses: ./.github/workflows/deploy-package-action.yml
# if: ${{ inputs.release && success() }}
# needs:
# - pre-commit
# - test
# - docs
# - build-python-package
# - deploy-python-package-test-pypi
# secrets:
# PYPI_API_TOKEN: "${{ secrets.PYPI_API_TOKEN }}"
# with:
# test: false
# version: "${{ inputs.version }}"
#
# push-tag:
# name: Push Version Tag
# runs-on: ubuntu-latest
# permissions:
# contents: write
# if: ${{ inputs.release && success() }}
# needs:
# - build-python-package
# - deploy-python-package
# steps:
# - name: Checkout
# uses: actions/checkout@v3
# - name: Push Tag
# uses: rickstaa/action-create-tag@v1
# with:
# tag: "v${{ inputs.version }}"
# message: "Version ${{ inputs.version }}"
#
set-pipeline-exit-status:
# This step is just so we can make github require this step, to pass checks
# on a pull request instead of requiring all
name: Set the CI Pipeline Exit Status
runs-on: ubuntu-latest
if: always()
needs:
- pre-commit
- test
- docs
# - build-python-package
# - deploy-python-package-test-pypi
# - deploy-python-package
# - push-tag
steps:
- name: Download Exit Status Files
if: always()
uses: actions/download-artifact@v3
with:
name: exitstatus
path: exitstatus

- name: Delete Exit Status Artifacts
if: always()
uses: geekyeggo/delete-artifact@v2
with:
name: exitstatus
failOnError: false

- name: Set Pipeline Exit Status
run: |
tree exitstatus
grep -RE 'failure|cancelled' exitstatus/ && exit 1 || exit 0
- name: Done
if: always()
run:
echo "All workflows finished"
43 changes: 43 additions & 0 deletions .github/workflows/docs-action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Build Documentation

on:
workflow_call:
inputs:
changed-files:
required: true
type: string
description: JSON string containing information about changed files

jobs:
Docs:
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- uses: actions/checkout@v4

- name: Set up Python 3.7 For Nox
uses: actions/setup-python@v1
with:
python-version: 3.7

- name: Install Nox
run: |
python -m pip install --upgrade pip
pip install nox
- name: Install Doc Requirements
run: |
nox --force-color -e docs --install-only
- name: Build Docs
env:
SKIP_REQUIREMENTS_INSTALL: YES
run: |
nox --force-color -e docs
- name: Set Exit Status
if: always()
run: |
mkdir exitstatus
echo "${{ job.status }}" > exitstatus/${{ github.job }}
11 changes: 11 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Pull Request or Push

on: [push, pull_request]

jobs:
ci:
name: CI
uses: ./.github/workflows/ci.yml
permissions:
contents: write
pull-requests: read
58 changes: 58 additions & 0 deletions .github/workflows/pre-commit-action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Pre-Commit

on:
workflow_call:
inputs:
changed-files:
required: true
type: string
description: JSON string containing information about changed files

jobs:
Pre-Commit:
name: Pre-Commit
runs-on: ubuntu-latest
container:
image: python:3.10.9-slim-buster

steps:
- name: Install System Deps
run: |
echo "deb http://deb.debian.org/debian buster-backports main" >> /etc/apt/sources.list
apt-get update
apt-get install -y enchant git gcc make zlib1g-dev libc-dev libffi-dev g++ libxml2 libxml2-dev libxslt-dev libcurl4-openssl-dev libssl-dev libgnutls28-dev
apt-get install -y git/buster-backports
- uses: actions/checkout@v4

- name: Install Pre-Commit
run: |
# TODO: Update pip version without error
# python -m pip install --upgrade pip
python -m pip install pip==19.3.1
pip install pre-commit
pre-commit install --install-hooks
- name: Check ALL Files On Branch
if: github.event_name != 'pull_request'
run: |
pre-commit run --show-diff-on-failure --color=always --all-files
- name: Check Changed Files On PR
if: github.event_name == 'pull_request' && fromJSON(inputs.changed-files)['repo'] == 'true'
run: |
pre-commit run --show-diff-on-failure --color=always --files ${{ join(fromJSON(inputs.changed-files)['repo_files'], ' ') }}
- name: Set Exit Status
if: always()
run: |
mkdir exitstatus
echo "${{ job.status }}" > exitstatus/${{ github.job }}
- name: Upload Exit Status
if: always()
uses: actions/upload-artifact@v3
with:
name: exitstatus
path: exitstatus
if-no-files-found: error
Loading

0 comments on commit 408f6d4

Please sign in to comment.