ci: update mise to 2025.4.4 #118
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
name: Integration Tests | |
on: | |
push: | |
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#onworkflow_dispatch | |
workflow_dispatch: | |
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions | |
permissions: | |
contents: read # for "git clone" | |
defaults: | |
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#defaultsrun | |
run: | |
# Enable fail-fast behavior using set -eo pipefail | |
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference | |
shell: bash | |
jobs: | |
run-integration-tests: | |
name: Integration Tests | |
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idruns-on | |
runs-on: ubuntu-22.04 | |
# https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs | |
strategy: | |
# https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs#handling-failures | |
fail-fast: false | |
matrix: | |
# https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs#example-adding-configurations | |
include: | |
# "docker-service-name" must match "services.$name" from docker-compose.yaml | |
# "database-service-name" must match "services.$name" from docker-compose.yaml | |
# "application-port" must match "services.$name.environment:PORT" from docker-compose.yaml | |
- docker-service-name: 'express-js' | |
database-service-name: 'mysql' | |
application-port: 3010 | |
skip_500_error_testing: false | |
- docker-service-name: 'express-ts' | |
database-service-name: 'mysql' | |
application-port: 3020 | |
skip_500_error_testing: false | |
- docker-service-name: 'chi' | |
database-service-name: 'mysql' | |
application-port: 3030 | |
skip_500_error_testing: true | |
- docker-service-name: 'fastapi' | |
database-service-name: 'postgres' | |
application-port: 4040 | |
skip_500_error_testing: false | |
env: | |
# Prevent interference between builds by setting the project name to a unique value. Otherwise | |
# "docker compose down" has been stopping containers (especially database) from other builds. | |
# https://docs.docker.com/compose/project-name/ | |
# https://docs.docker.com/compose/environment-variables/envvars/#compose_project_name | |
COMPOSE_PROJECT_NAME: ${{ matrix.docker-service-name }} | |
steps: | |
- name: Clone source code | |
uses: actions/[email protected] # https://github.com/actions/checkout | |
with: | |
# Whether to configure the token or SSH key with the local git config. Default: true | |
persist-credentials: false | |
- name: Show docker version | |
run: docker version | |
- name: Show docker compose version | |
run: docker compose version | |
- name: Start containers | |
working-directory: docker | |
run: >- | |
docker compose up \ | |
--build \ | |
--detach \ | |
--wait \ | |
--quiet-pull \ | |
${{ matrix.docker-service-name }} | |
- name: Show container statuses | |
if: '!cancelled()' | |
working-directory: docker | |
run: docker compose ps | |
- name: Install mise to install Hurl | |
uses: jdx/[email protected] # https://github.com/jdx/mise-action | |
with: | |
version: 2025.4.4 # [default: latest] mise version to install | |
install: true # [default: true] run `mise install` | |
cache: true # [default: true] cache mise using GitHub's cache | |
log_level: info # [default: info] log level | |
working_directory: tests # [default: .] directory to run mise in | |
env: | |
# Workaround: don't install some dependencies that we don't use (go, node, python) | |
# See: https://github.com/jdx/mise-action/issues/183 | |
# https://mise.jdx.dev/configuration/settings.html#disable_tools | |
MISE_DISABLE_TOOLS: go,node,python | |
- name: Show Hurl version | |
working-directory: tests | |
run: hurl --version | |
- name: Run integration tests | |
working-directory: tests | |
run: >- | |
hurl \ | |
--error-format long \ | |
--variable SERVER_URL=http://127.0.0.1:${{ matrix.application-port }} \ | |
--variable skip_500_error_testing=${{ matrix.skip_500_error_testing }} \ | |
--test | |
- name: Show application logs | |
if: failure() | |
working-directory: docker | |
run: >- | |
docker compose logs \ | |
--no-log-prefix \ | |
--timestamps \ | |
${{ matrix.docker-service-name }} | |
- name: Show database logs | |
if: failure() | |
working-directory: docker | |
run: >- | |
docker compose logs \ | |
--no-log-prefix \ | |
--timestamps \ | |
${{ matrix.database-service-name }} | |
- name: Stop containers | |
if: always() | |
working-directory: docker | |
run: >- | |
docker compose down \ | |
--volumes \ | |
--remove-orphans \ | |
--rmi local |