matrix-testing 1 #7
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: Docker | |
on: | |
push: | |
branches: ['**'] | |
tags: ['v*.*.*'] | |
pull_request: | |
branches: ['**'] | |
env: | |
# github.repository as <account>/<repo> | |
IMAGE_NAME: mnestix-browser | |
IMAGE_TAG: latest | |
# Update the version manually | |
IMAGE_TAG_VERSION: 1.3.1 | |
REGISTRY_USER: ${{ secrets.DOCKER_USERNAME }} | |
REGISTRY_PASS: ${{ secrets.DOCKER_API_TOKEN }} | |
jobs: | |
build-images: | |
name: Build and Upload Images | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Build image | |
id: build | |
run: docker compose build mnestix-browser | |
- name: Save mnestix-browser image | |
run: docker save mnestix-browser -o mnestix-browser.tar | |
- name: Upload mnestix-browser artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: mnestix-browser | |
path: mnestix-browser.tar | |
- name: Build test image | |
id: build-test | |
run: docker compose -f compose.yml -f docker-compose/compose.test.yml build cypress-test | |
- name: Save cypress-test image | |
run: docker save cypress-test -o cypress-test.tar | |
- name: Upload cypress-test artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: cypress-test | |
path: cypress-test.tar | |
cypress-test: | |
runs-on: ubuntu-latest | |
needs: build-images | |
permissions: | |
contents: read | |
strategy: | |
fail-fast: false | |
matrix: | |
containers: [1, 2, 3] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Download mnestix-browser artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: mnestix-browser | |
- name: Load mnestix-browser image | |
run: docker load -i mnestix-browser.tar | |
- name: Download cypress-test artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: cypress-test | |
- name: Load cypress-test image | |
run: docker load -i cypress-test.tar | |
- name: E2E test | |
id: test | |
run: | | |
docker compose -f compose.yml -f docker-compose/compose.test.yml --profile tests up -d && | |
docker compose -f compose.yml -f docker-compose/compose.test.yml attach cypress-test | |
env: | |
SPLIT: ${{ strategy.job-total }} | |
SPLIT_INDEX: ${{ strategy.job-index }} | |
- name: E2E test collect artifact | |
id: test_artifact | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: cypress-artifacts-${{ matrix.containers }} | |
path: cypress-artifacts/ |