Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cubicrootxyz/workflows
Collection of commonly used GitHub workflows
https://github.com/cubicrootxyz/workflows
automation build cd ci docker golang image jobs lint openapi renovate reusable swagger test workflows
Last synced: about 8 hours ago
JSON representation
Collection of commonly used GitHub workflows
- Host: GitHub
- URL: https://github.com/cubicrootxyz/workflows
- Owner: CubicrootXYZ
- Created: 2024-08-03T10:26:27.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-11-10T10:03:24.000Z (7 days ago)
- Last Synced: 2024-11-10T11:17:09.422Z (7 days ago)
- Topics: automation, build, cd, ci, docker, golang, image, jobs, lint, openapi, renovate, reusable, swagger, test, workflows
- Language: Go
- Homepage:
- Size: 37.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Workflows
Collection of commonly used GitHub workflows.
## Building images
This workflow will build and push images to Dockerhub. For any change an image with the commit SHA as tag will be published. For releases the release tag will be used to tag the image.
Provide a `static_tag` so any commit on `main` branch will result in an image pushed with that tag. Can be used to provide a `beta` or `main` tagged image.
```yaml
jobs:
build_image:
uses: CubicrootXYZ/Workflows/.github/workflows/[email protected]
with:
docker_build_args: "--no-cache"
docker_file_path: "./"
image_name: "example/image"
vuln_scan: false # Uses grype to scan for vulnerabilities.
secrets:
dockerhub_user: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }}
```## Golang
### Code Quality
To ensure code quality use the provided `golang_quality` workflow. It runs multiple analysis tools.
```yaml
permissions:
# Required by golangci job to write annotations to the merge request.
contents: read
checks: write
jobs:
golang_quality:
uses: CubicrootXYZ/Workflows/.github/workflows/[email protected]
with:
workdir: "golang/application/subfolder/"
```### Execute Tests
To execute golang tests use the provided `golang_test` workflow.
```yaml
jobs:
golang_test:
uses: CubicrootXYZ/Workflows/.github/workflows/[email protected]
with:
workdir: "tests/golang_test/"
services: '{"database": {"image": "mysql:8.0", "ports": ["3306:3306"]}}'
env: '{"TESTENV": "value"}'
```## Jinja
### Validate generates are up to date
Add the following job to your CI to ensure `jinja` generated files are always up to date. Uses `makejinja` for templating.
```yaml
jobs:
jinja:
uses: CubicrootXYZ/Workflows/.github/workflows/[email protected]
with:
workdir: "tests/jinja/"
```## OpenAPI
### Render OpenAPI 2 specs with redoc
Render an OpenAPI 2 spec with `redoc`. The spec file needs to be present in the given artifact. The rendered `index.html` will be added to the artifact `rendered-api-docu`.
```yaml
jobs:
render:
uses: CubicrootXYZ/Workflows/.github/workflows/[email protected]
with:
spec_artifact_name: spec
spec_artifact_path: tests/openapi2/
spec_filename: petstore.yaml
```### Generate OpenAPI 2 spec from golang source code
Generate OpenAPI 2 spec file based on `swag` compatible annotiations in the source code.
```yaml
jobs:
build:
uses: CubicrootXYZ/Workflows/.github/workflows/[email protected]
with:
entrypoint: cmd/main.go
workdir: ./
```## GitHub Pages
Make sure GitHub pages are activated and set to "GitHub Action" in your repository settings.
Add the following permissions to the `workflows` file:
```yaml
permissions:
contents: read
pages: write
id-token: write
```To deploy an artifact to GitHub pages use the following job:
```yaml
jobs:
pages_test:
uses: CubicrootXYZ/Workflows/.github/workflows/[email protected]
with:
artifact_name: static-html
artifact_path: index.html
```## Renovate
Create a new access token and set it as `RENOVATE_TOKEN` repo secret.
```yaml
jobs:
renovate_test:
uses: CubicrootXYZ/Workflows/.github/workflows/workflows/[email protected]
with:
author: "Max "
secrets:
token: "${{ secrets.RENOVATE_TOKEN }}"
```