-
Notifications
You must be signed in to change notification settings - Fork 0
Add common and harness specific configuration for deployment and publication #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 22 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
3021b83
Add pre-commit config file
d25358a
Add dependabot config
c94e37d
Add license
c314b62
Add build workflow
f926fd4
Add automerge for dependabot PRs
be69588
Add missing bracket
a96b3d3
Correct quotes
7dbe4b1
Remove dotnet condition
71a9c4c
Remove --from when installing bowtie
8afc66e
Use correct package to install bowtie
ea9853a
Version is always set in the matrix
cd85920
Try extract version from latest and current version and prepare a the…
c427f39
Move part of tags to build image step
a1b573a
Print collected versions
3214f25
Execute pre-commit hook
b852abd
Use raw value in jq to get rid of quotes
5a1e33d
Trigger image build only on a push to main branch
550260a
Correct which version is used for a tag
5970ae4
Add tag with version to the final image
2bd10c6
Use gh cli to create tag and release
76dd912
Add missing GH_TOKEN env variable
37e94bb
Use personal access token to create a tag and release
9217c0c
Use default github token for release creation
81750f1
Use bowtie action
401d87b
Add workflow to rebuild all available old version and the latest one …
OptimumCode ca0a56b
Add zizmor pre-commit hook and update workflow to comply with zizmor …
OptimumCode 9f1969b
Cleanup workflows
8ecb6b5
Use user.login to identify whether the PR is from dependabot
751f7d4
Remove manual tag creation. Use release API to create a tag
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
version: 2 | ||
updates: | ||
# common configuration | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" | ||
- package-ecosystem: "docker" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" | ||
|
||
# test harnsess configuration | ||
- package-ecosystem: "gradle" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,186 @@ | ||
name: Rebuild Bowtie Image | ||
OptimumCode marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
push: | ||
branches-ignore: | ||
- "wip*" | ||
|
||
env: | ||
IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }} | ||
|
||
concurrency: | ||
group: images-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
meta: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
latest-version: ${{ steps.version.outputs.value }} | ||
implementation-name: ${{ steps.impl.outputs.name }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install uv | ||
uses: astral-sh/setup-uv@v5 | ||
with: | ||
enable-cache: true | ||
|
||
- name: Compute implementation name | ||
id: impl | ||
run: echo "name=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')" >> $GITHUB_OUTPUT | ||
|
||
- name: Compute latest implementation version | ||
id: version | ||
run: | | ||
version=$(uvx --from 'bowtie-json-schema' --python 3.13 bowtie info \ | ||
--implementation ${{ steps.impl.outputs.name }} \ | ||
--format json | jq -r '.version // empty') | ||
echo "value=${version}" >> $GITHUB_OUTPUT | ||
|
||
build: | ||
needs: meta | ||
|
||
runs-on: ubuntu-latest | ||
|
||
outputs: | ||
current-version: ${{ steps.current-version.outputs.value }} | ||
|
||
permissions: | ||
id-token: write | ||
contents: read | ||
attestations: write | ||
packages: write | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install qemu | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y qemu-user-static | ||
|
||
- name: Build | ||
id: build_image | ||
uses: redhat-actions/buildah-build@v2 | ||
with: | ||
context: '.' | ||
containerfiles: | | ||
Dockerfile | ||
image: ${{ needs.meta.outputs.implementation-name }} | ||
tags: ${{ github.sha }} ${{ github.ref == 'refs/heads/main' && 'latest' || '' }} | ||
OptimumCode marked this conversation as resolved.
Show resolved
Hide resolved
|
||
archs: amd64, arm64 | ||
|
||
- name: Set DOCKER_HOST so podman-built images are findable | ||
run: | | ||
systemctl --user enable --now podman.socket | ||
sudo loginctl enable-linger $USER | ||
podman --remote info | ||
echo "DOCKER_HOST=unix://$(podman info --format '{{.Host.RemoteSocket.Path}}')" >> $GITHUB_ENV | ||
|
||
- name: Install uv | ||
OptimumCode marked this conversation as resolved.
Show resolved
Hide resolved
|
||
uses: astral-sh/setup-uv@v5 | ||
with: | ||
enable-cache: true | ||
|
||
- name: Smoke Test | ||
run: | | ||
uvx --from 'bowtie-json-schema' --python 3.13 bowtie smoke -i "localhost/${{ steps.build_image.outputs.image-with-tag }}" --format json | ||
uvx --from 'bowtie-json-schema' --python 3.13 bowtie smoke -i "localhost/${{ steps.build_image.outputs.image-with-tag }}" --format markdown >> $GITHUB_STEP_SUMMARY | ||
|
||
- name: Collect current version | ||
id: current-version | ||
run: | | ||
version=$(uvx --from 'bowtie-json-schema' --python 3.13 bowtie info \ | ||
--implementation "localhost/${{ steps.build_image.outputs.image-with-tag }}" \ | ||
--format json | jq -r '.version // empty') | ||
echo "value=${version}" >> $GITHUB_OUTPUT | ||
|
||
- name: Print collected versions | ||
run: echo "latest_version=${{ needs.meta.outputs.latest-version }}; current_version=${{ steps.current-version.outputs.value }}" | ||
|
||
- name: Log in to ghcr.io | ||
uses: redhat-actions/podman-login@v1 | ||
with: | ||
username: ${{ github.actor }} | ||
password: ${{ github.token }} | ||
registry: ${{ env.IMAGE_REGISTRY }} | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | ||
|
||
- name: Add tag with version to the image | ||
run: podman tag ${{ steps.build_image.outputs.image-with-tag }} ${{ steps.build_image.outputs.image }}:${{ steps.current-version.outputs.value }} | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | ||
OptimumCode marked this conversation as resolved.
Show resolved
Hide resolved
OptimumCode marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
- name: Publish | ||
id: push | ||
uses: redhat-actions/push-to-registry@v2 | ||
with: | ||
image: ${{ steps.build_image.outputs.image }} | ||
tags: ${{ steps.current-version.outputs.value }} ${{ steps.build_image.outputs.tags }} | ||
registry: ${{ env.IMAGE_REGISTRY }} | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | ||
|
||
- name: Generate attestation for images | ||
uses: actions/attest-build-provenance@v2 | ||
with: | ||
subject-name: ${{ env.IMAGE_REGISTRY }}/${{ steps.build_image.outputs.image }} | ||
subject-digest: ${{ steps.push.outputs.digest }} | ||
push-to-registry: true | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | ||
|
||
mark-previous-version: | ||
needs: [build, meta] | ||
runs-on: ubuntu-latest | ||
|
||
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && needs.build.outputs.current-version != needs.meta.outputs.latest-version | ||
|
||
env: | ||
TAG: v${{ needs.meta.outputs.latest-version }} | ||
COMMIT: ${{ github.event.before }} | ||
GH_TOKEN: ${{ secrets.PAT_GITHUB }} | ||
|
||
steps: | ||
|
||
- name: Create a tag to mark previous latest version | ||
env: | ||
COMMIT: ${{ env.COMMIT }} | ||
run: > | ||
gh api | ||
--method POST | ||
-H "Accept: application/vnd.github+json" | ||
-H "X-GitHub-Api-Version: 2022-11-28" | ||
/repos/${{ github.repository }}/git/refs | ||
-f "ref=refs/tags/$TAG" | ||
-f "sha=$COMMIT" | ||
|
||
- name: Create release assotiated with the tag | ||
run: > | ||
gh api | ||
--method POST | ||
-H "Accept: application/vnd.github+json" | ||
-H "X-GitHub-Api-Version: 2022-11-28" | ||
/repos/${{ github.repository }}/releases | ||
-f "tag_name=$TAG" | ||
-f "name=$TAG" | ||
-f "body=Automatic release for $TAG" | ||
-F "generate_release_notes=true" | ||
|
||
|
||
automerge: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
|
||
if: (!cancelled() && github.event_name == 'pull_request' && github.actor == 'dependabot[bot]') | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
steps: | ||
- name: Automatically merge allowed PRs | ||
run: gh pr merge --auto --merge "$PR_URL" | ||
env: | ||
PR_URL: ${{ github.event.pull_request.html_url }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
repos: | ||
# common hooks - should be added to template project | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v5.0.0 | ||
hooks: | ||
- id: check-added-large-files | ||
- id: check-ast | ||
- id: check-json | ||
- id: check-toml | ||
- id: check-vcs-permalinks | ||
- id: check-yaml | ||
- id: debug-statements | ||
- id: end-of-file-fixer | ||
- id: mixed-line-ending | ||
args: [--fix, lf] | ||
- id: trailing-whitespace | ||
OptimumCode marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# test harness specific hooks | ||
- repo: https://github.com/dustinsand/pre-commit-jvm | ||
rev: v0.11.0 | ||
hooks: | ||
- name: ktlint (java/kotlin implementations) | ||
id: ktlint | ||
args: [--format] | ||
- name: detekt (java/kotlin implementations) | ||
id: detekt | ||
args: ["--build-upon-default-config"] |
OptimumCode marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
Copyright (c) 2022 Bowtie's Authors | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. | ||
|
||
Bowtie's logo was designed by @PaulWaller with work sponsored by [endjin](https://endjin.com). |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.