Add and improve tests (#92) #102
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
name: Build | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- "*" | |
pull_request: | |
concurrency: | |
group: ${{ github.head_ref || github.sha }}-${{ github.workflow }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
name: ${{ matrix.id }} | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
id: | |
- "mysql-8.0" | |
steps: | |
- name: Parse ID | |
id: parse | |
run: | | |
set -x | |
if [ "${GITHUB_REF_TYPE}" = "tag" ] && [[ "${GITHUB_REF_NAME}" =~ ^${{ matrix.id }}\. ]]; then | |
version="${GITHUB_REF_NAME}" | |
else | |
version=${{ matrix.id }}-latest | |
fi | |
push=false | |
if [ "${GITHUB_EVENT_NAME}" = "push" ]; then | |
push=true | |
if [ "${GITHUB_REF_TYPE}" = "tag" ] && [ "${version}" != "${GITHUB_REF_NAME}" ]; then | |
push=false | |
fi | |
fi | |
tag="groonga/mroonga:${version}" | |
tags="${tag}" | |
if [ "${version}" = "mysql-8.0-latest" ]; then | |
tags="${tags},groonga/mroonga:latest" | |
fi | |
echo "::set-output name=push::${push}" | |
echo "::set-output name=tag::${tag}" | |
echo "::set-output name=tags::${tags}" | |
- uses: actions/checkout@v4 | |
- uses: docker/login-action@v3 | |
if: steps.parse.outputs.push == 'true' | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
- uses: docker/setup-buildx-action@v3 | |
id: buildx | |
- uses: docker/build-push-action@v6 | |
id: docker_build | |
with: | |
# cache-from: type=gha | |
# cache-to: type=gha,mode=max | |
context: ${{ matrix.id }} | |
push: ${{ steps.parse.outputs.push }} | |
load: ${{ steps.parse.outputs.push != 'true' }} | |
tags: ${{ steps.parse.outputs.tags }} | |
- name: Image info | |
run: | | |
echo "ref: ${{ github.ref }}" | |
echo "tags: ${{ steps.parse.outputs.tags }}" | |
echo "digest: ${{ steps.docker_build.outputs.digest }}" | |
- name: Test | |
run: | | |
./test.sh \ | |
"${{ matrix.id }}" \ | |
"${{ steps.parse.outputs.tag }}" |