-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into fix-dates-2
- Loading branch information
Showing
84 changed files
with
3,909 additions
and
817 deletions.
There are no files selected for viewing
This file contains 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,102 @@ | ||
# Reusable workflow that builds Quesma Docker image and either: | ||
# - pushes it to Docker Hub | ||
# - or exports it to .tar artifact | ||
|
||
name: Docker image build | ||
on: | ||
workflow_call: # Can be reused from another workflow | ||
inputs: | ||
VERSION: | ||
description: 'Version number to tag the image with (optional)' | ||
default: nightly | ||
required: false | ||
type: string | ||
PUSH: | ||
description: 'Whether to push the image to the registry (optional)' # if not, we will export it to .tar artifact | ||
default: false | ||
required: false | ||
type: boolean | ||
REF: | ||
description: 'The branch, tag or SHA to checkout. By default it will use the default branch' | ||
default: '' | ||
required: false | ||
type: string | ||
secrets: | ||
DOCKER_USER: | ||
required: false | ||
DOCKER_PAT: | ||
required: false | ||
|
||
jobs: | ||
build-quesma-docker-image: | ||
strategy: | ||
matrix: | ||
module: [ "quesma" ] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ inputs.REF }} | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
cache-dependency-path: ${{ matrix.module }}/go.sum | ||
go-version: '1.23' | ||
|
||
- name: Log in to Docker Hub | ||
uses: docker/login-action@v3 | ||
if: ${{ inputs.PUSH }} | ||
with: | ||
username: ${{ secrets.DOCKER_USER }} | ||
password: ${{ secrets.DOCKER_PAT }} | ||
|
||
- name: Set the build date | ||
run: echo QUESMA_BUILD_DATE=$(git --no-pager log -1 --date=format:'%Y-%m-%d' --format="%ad") >> $GITHUB_ENV | ||
|
||
# If we don't push the image, we build it only for the host architecture and export it to .tar file | ||
# This step is similar to "Build and push", but avoids building arm64 image, which takes | ||
# a lot of time on GitHub Actions. | ||
- name: Build and export | ||
uses: docker/build-push-action@v6 | ||
if: ${{ !inputs.PUSH }} | ||
with: | ||
context: ${{ matrix.module }}/. | ||
tags: | | ||
quesma/quesma:${{ inputs.VERSION }} | ||
quesma/quesma:nightly | ||
push: false | ||
outputs: type=docker,dest=/tmp/image.tar | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
env: | ||
DOCKER_BUILD_SUMMARY: false | ||
|
||
# If we push the image, we build it for both amd64 and arm64 and don't export it | ||
- name: Build and push | ||
uses: docker/build-push-action@v6 | ||
if: ${{ inputs.PUSH }} | ||
with: | ||
context: ${{ matrix.module }}/. | ||
tags: | | ||
quesma/quesma:${{ inputs.VERSION }} | ||
quesma/quesma:nightly | ||
push: true | ||
build-args: | | ||
QUESMA_BUILD_SHA=${{ github.sha }} | ||
QUESMA_VERSION=${{ inputs.VERSION }} | ||
QUESMA_BUILD_DATE=${{ env.QUESMA_BUILD_DATE }} | ||
platforms: linux/amd64,linux/arm64 | ||
env: | ||
DOCKER_BUILD_SUMMARY: false | ||
|
||
- name: Upload artifact | ||
uses: actions/upload-artifact@v4 | ||
if: ${{ !inputs.PUSH }} | ||
with: | ||
name: ${{ matrix.module }} | ||
path: /tmp/image.tar | ||
retention-days: 1 |
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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 |
---|---|---|
@@ -1,18 +1,22 @@ | ||
name: Integration tests | ||
|
||
on: | ||
# #merge_group: | ||
# push: | ||
# branches: [ "main" ] | ||
push: | ||
branches: [ "main" ] | ||
workflow_dispatch: | ||
inputs: | ||
GIT_REF: | ||
description: 'Commit hash to run the tests' | ||
required: true | ||
jobs: | ||
build-quesma-docker-image: | ||
uses: ./.github/workflows/build-quesma-docker-image.yml | ||
with: | ||
REF: ${{inputs.GIT_REF}} | ||
|
||
integration-test-run: | ||
runs-on: ubuntu-latest | ||
needs: [build-quesma-docker-image] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: ## @TODO REMOVE | ||
|
@@ -22,20 +26,51 @@ jobs: | |
uses: actions/setup-go@v5 | ||
with: | ||
cache-dependency-path: smoke-test/go.sum | ||
go-version: '1.22' | ||
go-version: '1.23' | ||
|
||
# (perhaps prefetching these should be considered) | ||
# - name: Download images | ||
# uses: actions/download-artifact@v4 | ||
# with: | ||
# path: /tmp/images | ||
- name: Download images | ||
uses: actions/download-artifact@v4 | ||
with: | ||
path: /tmp/images | ||
|
||
- name: Load images | ||
run: | | ||
for file in /tmp/images/*/*.tar; do | ||
docker load --input $file | ||
done | ||
docker image ls -a | ||
- name: Set environment variable | ||
run: echo "EXECUTING_ON_GITHUB_CI=true" >> $GITHUB_ENV | ||
|
||
- name: Get last commit author | ||
id: get_author | ||
run: echo "::set-output name=author::$(git log -1 --pretty=format:'%an <%ae> sha1={%H}')" | ||
|
||
- name: Run integration tests | ||
working-directory: ci/it | ||
# env: | ||
# EXECUTING_ON_GITHUB_CI: true | ||
run: go test -v | ||
|
||
- name: Send Slack notification on failure | ||
if: failure() | ||
uses: slackapi/[email protected] | ||
with: | ||
channel-id: ${{ secrets.SLACK_CHANNEL_ID }} | ||
slack-message: | | ||
:exclamation: *Integration tests failed.* :exclamation: @channel | ||
Last commit by: ${{ steps.get_author.outputs.author }} | ||
env: | ||
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | ||
|
||
- name: Send Slack notification on success | ||
if: success() | ||
uses: slackapi/[email protected] | ||
with: | ||
channel-id: ${{ secrets.SLACK_CHANNEL_ID }} | ||
slack-message: | | ||
:white_check_mark: *Integration tests passed.* Good job team! | ||
Last commit by: ${{ steps.get_author.outputs.author }} | ||
env: | ||
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | ||
|
||
|
This file contains 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,31 @@ | ||
name: Docker image build (nightly) | ||
# Pipeline which builds `nightly` Docker images for Quesma | ||
# pushes them to Docker Hub as `quesma/quesma:nightly` (and `quesma/quesma:<VERSION>`, if VERSION is specified explicitly) | ||
# | ||
# This workflow is triggered by a push/merge to the `main` branch | ||
# quesma/quesma:nightly image is a pointer to latest released version. | ||
# | ||
# This workflow is not reusable, use build-quesma-docker-image.yml as a reusable workflow. | ||
on: | ||
push: | ||
branches: [ "main" ] | ||
workflow_dispatch: # Handy for testing | ||
inputs: | ||
VERSION: | ||
description: 'Version number to tag the image with (optional)' | ||
default: nightly | ||
required: true | ||
PUSH: | ||
description: 'Whether to push the image to the registry' | ||
default: false | ||
required: true | ||
jobs: | ||
build-quesma-docker-image: | ||
uses: ./.github/workflows/build-quesma-docker-image.yml | ||
with: | ||
VERSION: ${{ inputs.VERSION || 'nightly' }} # when called from the main branch, `github.event.inputs.VERSION` doesn't use default value and is just empty | ||
# Pushes to DockerHub only for `main` branch builds, unless set explicitly in the job input | ||
PUSH: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') || inputs.PUSH }} | ||
secrets: | ||
DOCKER_USER: ${{ secrets.DOCKER_USER }} | ||
DOCKER_PAT: ${{ secrets.DOCKER_PAT }} |
Oops, something went wrong.