Skip to content

Commit

Permalink
Resync piped
Browse files Browse the repository at this point in the history
  • Loading branch information
always-on-duty[bot] committed Apr 7, 2024
1 parent 246ca7c commit bb42d3d
Show file tree
Hide file tree
Showing 7 changed files with 330 additions and 0 deletions.
96 changes: 96 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: Docker

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

on:
schedule:
- cron: "25 14 * * *"
push:
branches: [ "master" ]
# Publish semver tags as releases.
tags: [ "v*.*.*" ]
pull_request:
branches: [ "master" ]

env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}


jobs:
build:

runs-on: ubuntu-latest
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@cd7d8d697e10461458bc61a30d094dc601a8b017

# Install the cosign tool except on PR
# https://github.com/sigstore/cosign-installer
- name: Install cosign
if: github.event_name != 'pull_request'
uses: sigstore/cosign-installer@e1523de7571e31dbe865fd2e80c5c7c23ae71eb4 #v3.4.0

# Set up BuildKit Docker container builder to be able to build
# multi-platform images and export cache
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@2b51285047da1547ffb1b2203d8be4c0af6b1f20 # v3.2.0

# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

# Sign the resulting Docker image digest except on PRs.
# This will only write to the public Rekor transparency log when the Docker
# repository is public to avoid leaking data. If you would like to publish
# transparency data even for private images, pass --force to cosign below.
# https://github.com/sigstore/cosign
- name: Sign the published Docker image
if: ${{ github.event_name != 'pull_request' }}
env:
# https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
TAGS: ${{ steps.meta.outputs.tags }}
DIGEST: ${{ steps.build-and-push.outputs.digest }}
# This step uses the identity token to provision an ephemeral certificate
# against the sigstore community Fulcio instance.
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}
41 changes: 41 additions & 0 deletions .github/workflows/freeze-for-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Freeze PR dependency changes

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
pull_request:
branches:
- master
paths: ["piped", "pyproject.toml", "requirements.in", "dev-requirements/*.in", "!dev-requirements/constraints.in"]

jobs:
freeze-pr-dep-changes:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@cd7d8d697e10461458bc61a30d094dc601a8b017
with:
submodules: "true"

- name: Set up Python 3.11
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d
with:
python-version: "3.11"

- name: install prerequisites
run: |
python -m pip install --upgrade pip wheel
python -m pip install -r ./piped/python/base-requirements/nox.txt
- name: Upgrade dependency locks
run: python -m nox -s freeze-locks bot-package-diff

- uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3
with:
name: gogo.patch
path: gogo.patch

- name: Check diff file
run: python -m nox -s is-diff-file-empty
41 changes: 41 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Lint

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
push:
branches:
- master
pull_request:
branches:
- master
schedule:
- cron: "0 12 * * 6"
workflow_dispatch:

jobs:
lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@cd7d8d697e10461458bc61a30d094dc601a8b017
with:
submodules: "true"

- name: Set up Python 3.11
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d
with:
python-version: "3.11"

- name: install prerequisites
run: |
python -m pip install --upgrade pip wheel
python -m pip install -r ./piped/python/base-requirements/nox.txt
- name: Check spelling
run: python -m nox -s spell-check

- name: Lint with flake8
run: python -m nox -s flake8
40 changes: 40 additions & 0 deletions .github/workflows/reformat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Reformat PR code

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
pull_request:
branches:
- master

jobs:
reformat:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@cd7d8d697e10461458bc61a30d094dc601a8b017
with:
submodules: "true"

- name: Set up Python 3.11
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d
with:
python-version: "3.11"

- name: install prerequisites
run: |
python -m pip install --upgrade pip wheel
python -m pip install -r ./piped/python/base-requirements/nox.txt
- name: Reformat
run: python -m nox -s reformat bot-package-diff

- uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3
with:
name: gogo.patch
path: gogo.patch

- name: Check diff file
run: python -m nox -s is-diff-file-empty
38 changes: 38 additions & 0 deletions .github/workflows/type-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Type check

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
push:
branches:
- master
pull_request:
branches:
- master
schedule:
- cron: "0 12 * * 6"
workflow_dispatch:

jobs:
type-check:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@cd7d8d697e10461458bc61a30d094dc601a8b017
with:
submodules: "true"

- name: Set up Python 3.11
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d
with:
python-version: "3.11"

- name: install prerequisites
run: |
python -m pip install --upgrade pip wheel
python -m pip install -r ./piped/python/base-requirements/nox.txt
- name: Run type checker
run: python -m nox -s type-check
38 changes: 38 additions & 0 deletions .github/workflows/update-licence.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Update licence

on:
schedule:
- cron: "0 7 1 1 *"
workflow_dispatch:

jobs:
update-licence:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@cd7d8d697e10461458bc61a30d094dc601a8b017
with:
submodules: "true"

- name: Set up Python 3.11
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d
with:
python-version: "3.11"

- name: install prerequisites
run: |
python -m pip install --upgrade pip wheel
python -m pip install -r ./piped/python/base-requirements/nox.txt
- name: Update licence
run: python -m nox -s update-licence

- name: Create Pull Request
uses: peter-evans/create-pull-request@70a41aba780001da0a30141984ae2a0c95d8704e
with:
author: "always-on-duty[bot] <120557446+always-on-duty[bot]@users.noreply.github.com>"
branch: task/update-licence
commit-message: Update licence
committer: "always-on-duty[bot] <120557446+always-on-duty[bot]@users.noreply.github.com>"
title: Update licence
token: ${{ secrets.ACTIONS_TOKEN || secrets.GITHUB_TOKEN }}
36 changes: 36 additions & 0 deletions .github/workflows/verify-locks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# This is run to avoid an edge case where the latest version of a (probably sub)
# dependency being yanked leads to pip failing to backtrack the dep.
# This happened with `cachecontrol==0.12.12 ; python_version >= "3.7" and python_version < "4.0"`.
name: Verify dependency locks

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
pull_request:
branches:
- master
paths: ["dev-requirements/*.txt"]

jobs:
verify-pr-dep-changes:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@cd7d8d697e10461458bc61a30d094dc601a8b017
with:
submodules: "true"

- name: Set up Python 3.11
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d
with:
python-version: "3.11"

- name: install prerequisites
run: |
python -m pip install --upgrade pip wheel
python -m pip install -r ./piped/python/base-requirements/nox.txt
- name: Verify dependency locks
run: python -m nox -s verify-deps

0 comments on commit bb42d3d

Please sign in to comment.