It works in both Firefox and Chrome #2851
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: CI jobs | |
on: | |
push: | |
jobs: | |
aaa: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install software | |
run: | | |
mkdir -p ${HOME}/bin && curl https://raw.githubusercontent.com/vishnubob/wait-for-it/8ed92e8cab83cfed76ff012ed4a36cef74b28096/wait-for-it.sh > ${HOME}/bin/wait-for-it.sh && chmod +x ${HOME}/bin/wait-for-it.sh | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: liberica | |
java-version: 17.0.4 | |
- name: Cache local Maven repository | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.m2/repository | |
~/.m2/wrapper | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml', '**/.mvn/wrapper/maven-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- name: Start & wait docker-compose environment | |
run: | | |
docker-compose up -d postgresql redis rabbitmq jaeger | |
${HOME}/bin/wait-for-it.sh -t 30 127.0.0.1:35432 -- echo 'postgres is up' | |
${HOME}/bin/wait-for-it.sh -t 30 127.0.0.1:36379 -- echo 'redis is up' | |
${HOME}/bin/wait-for-it.sh -t 30 127.0.0.1:36672 -- echo 'rabbitmq is up' | |
${HOME}/bin/wait-for-it.sh -t 30 127.0.0.1:6831 -- echo 'jaeger is up' | |
docker-compose -f docker-compose.keycloak.yml up -d keycloak | |
sleep 15 && ${HOME}/bin/wait-for-it.sh -t 30 127.0.0.1:8484 -- echo 'keycloak is up' | |
- name: Build and test with Maven | |
run: | | |
(cd aaa; ./mvnw clean package) | |
- name: Build docker image and deploy | |
if: github.ref == 'refs/heads/master' | |
run: | | |
mkdir -p ~/.ssh && openssl aes-256-cbc -K ${{ secrets.EncryptedKey }} -iv ${{ secrets.EncryptedIv }} -in ./.secret_keys/id_rsa.enc -out ~/.ssh/id_rsa -d | |
chmod 600 ~/.ssh/id_rsa | |
BUILDDIR=./build; | |
WORKDIR=./aaa; | |
IMAGE=nkonev/chat-aaa:latest; | |
cd $WORKDIR && mkdir -p $BUILDDIR && cp ./Dockerfile $BUILDDIR && cp target/*-exec.jar $BUILDDIR && | |
docker build -t $IMAGE $BUILDDIR && | |
echo "Will login to docker" && | |
docker login -u="nkonev" -p="${{ secrets.DockerPassword }}" && | |
echo "Will push docker image" && | |
docker push $IMAGE && | |
echo "Will deploy aaa" && | |
ssh -o "BatchMode yes" -o StrictHostKeyChecking=no -q ${{ secrets.ConnectLine }} ${{ secrets.AaaUpdateCommand }} | |
frontend: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.16.0 | |
- name: Cache Node.js dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
**/node_modules | |
key: ${{ runner.os }}-frontend-cache-v1-${{ hashFiles('**/package-lock.json') }} | |
- name: Build with npm run | |
run: | | |
(cd frontend; npm install && npm run build) | |
- name: Build docker image and deploy | |
if: github.ref == 'refs/heads/master' | |
run: | | |
mkdir -p ~/.ssh && openssl aes-256-cbc -K ${{ secrets.EncryptedKey }} -iv ${{ secrets.EncryptedIv }} -in ./.secret_keys/id_rsa.enc -out ~/.ssh/id_rsa -d | |
chmod 600 ~/.ssh/id_rsa | |
BUILDDIR=./build; | |
WORKDIR=./frontend; | |
IMAGE=nkonev/chat-frontend:latest; | |
GIT_HASH=$(git rev-list -1 HEAD); | |
cd $WORKDIR && mkdir -p $BUILDDIR && cp ./Dockerfile $BUILDDIR && cp -r ../frontend-nginx/* $BUILDDIR && cp ../docker/nginx/frontend.conf $BUILDDIR && | |
docker build -t $IMAGE --build-arg GIT_HASH=$GIT_HASH $BUILDDIR && | |
echo "Will login to docker" && | |
docker login -u="nkonev" -p="${{ secrets.DockerPassword }}" && | |
echo "Will push docker image" && | |
docker push $IMAGE && | |
echo "Will deploy frontend" && | |
ssh -o "BatchMode yes" -o StrictHostKeyChecking=no -q ${{ secrets.ConnectLine }} ${{ secrets.FrontendUpdateCommand }} | |
frontend2: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.16.0 | |
- name: Cache Node.js dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
**/node_modules | |
key: ${{ runner.os }}-frontend-cache-v2-${{ hashFiles('**/package-lock.json') }} | |
- name: Build with npm run | |
run: | | |
(cd frontend; npm install && npm run build) | |
chat: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.19 | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/go/pkg/mod | |
~/.cache/go-build | |
key: ${{ runner.os }}-go-chat-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Install software | |
run: | | |
mkdir -p ${HOME}/bin && curl https://raw.githubusercontent.com/vishnubob/wait-for-it/8ed92e8cab83cfed76ff012ed4a36cef74b28096/wait-for-it.sh > ${HOME}/bin/wait-for-it.sh && chmod +x ${HOME}/bin/wait-for-it.sh | |
- name: Start & wait docker-compose environment | |
run: | | |
docker-compose up -d postgresql redis rabbitmq | |
${HOME}/bin/wait-for-it.sh -t 30 127.0.0.1:35432 -- echo 'postgres is up' | |
${HOME}/bin/wait-for-it.sh -t 30 127.0.0.1:36379 -- echo 'redis is up' | |
${HOME}/bin/wait-for-it.sh -t 30 127.0.0.1:36672 -- echo 'rabbitmq is up' | |
- name: Build and test with make | |
run: (cd chat; sleep 5 && make check-env download generate test package) | |
- name: Build docker image and deploy | |
if: github.ref == 'refs/heads/master' | |
run: | | |
mkdir -p ~/.ssh && openssl aes-256-cbc -K ${{ secrets.EncryptedKey }} -iv ${{ secrets.EncryptedIv }} -in ./.secret_keys/id_rsa.enc -out ~/.ssh/id_rsa -d | |
chmod 600 ~/.ssh/id_rsa | |
echo "Will login to docker" && | |
docker login -u="nkonev" -p="${{ secrets.DockerPassword }}" | |
(cd chat; make push-docker && echo "Will deploy chat" && ssh -o "BatchMode yes" -o StrictHostKeyChecking=no -q ${{ secrets.ConnectLine }} ${{ secrets.ChatUpdateCommand }} ) | |
event: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.19 | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/go/pkg/mod | |
~/.cache/go-build | |
key: ${{ runner.os }}-go-event-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Build and test with make | |
run: (cd event; make check-env download generate test package) | |
- name: Build docker image and deploy | |
if: github.ref == 'refs/heads/master' | |
run: | | |
mkdir -p ~/.ssh && openssl aes-256-cbc -K ${{ secrets.EncryptedKey }} -iv ${{ secrets.EncryptedIv }} -in ./.secret_keys/id_rsa.enc -out ~/.ssh/id_rsa -d | |
chmod 600 ~/.ssh/id_rsa | |
echo "Will login to docker" && | |
docker login -u="nkonev" -p="${{ secrets.DockerPassword }}" | |
(cd event; make push-docker && echo "Will deploy event" && ssh -o "BatchMode yes" -o StrictHostKeyChecking=no -q ${{ secrets.ConnectLine }} ${{ secrets.EventUpdateCommand }} ) | |
notification: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.19 | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/go/pkg/mod | |
~/.cache/go-build | |
key: ${{ runner.os }}-go-notification-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Build and test with make | |
run: (cd notification; make check-env download generate test package) | |
- name: Build docker image and deploy | |
if: github.ref == 'refs/heads/master' | |
run: | | |
mkdir -p ~/.ssh && openssl aes-256-cbc -K ${{ secrets.EncryptedKey }} -iv ${{ secrets.EncryptedIv }} -in ./.secret_keys/id_rsa.enc -out ~/.ssh/id_rsa -d | |
chmod 600 ~/.ssh/id_rsa | |
echo "Will login to docker" && | |
docker login -u="nkonev" -p="${{ secrets.DockerPassword }}" | |
(cd notification; make push-docker && echo "Will deploy notification" && ssh -o "BatchMode yes" -o StrictHostKeyChecking=no -q ${{ secrets.ConnectLine }} ${{ secrets.NotificationUpdateCommand }} ) | |
storage: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.19 | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/go/pkg/mod | |
~/.cache/go-build | |
key: ${{ runner.os }}-go-storage-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Build and test with make | |
run: (cd storage; make check-env download generate test package) | |
- name: Build docker image and deploy | |
if: github.ref == 'refs/heads/master' | |
run: | | |
mkdir -p ~/.ssh && openssl aes-256-cbc -K ${{ secrets.EncryptedKey }} -iv ${{ secrets.EncryptedIv }} -in ./.secret_keys/id_rsa.enc -out ~/.ssh/id_rsa -d | |
chmod 600 ~/.ssh/id_rsa | |
echo "Will login to docker" && | |
docker login -u="nkonev" -p="${{ secrets.DockerPassword }}" | |
(cd storage; make push-docker && echo "Will deploy storage" && ssh -o "BatchMode yes" -o StrictHostKeyChecking=no -q ${{ secrets.ConnectLine }} ${{ secrets.StorageUpdateCommand }} ) | |
video: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.19 | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/go/pkg/mod | |
~/.cache/go-build | |
key: ${{ runner.os }}-go-video-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Build and test with make | |
run: (cd video; make check-env download generate test package) | |
- name: Build docker image and deploy | |
if: github.ref == 'refs/heads/master' | |
run: | | |
mkdir -p ~/.ssh && openssl aes-256-cbc -K ${{ secrets.EncryptedKey }} -iv ${{ secrets.EncryptedIv }} -in ./.secret_keys/id_rsa.enc -out ~/.ssh/id_rsa -d | |
chmod 600 ~/.ssh/id_rsa | |
echo "Will login to docker" && | |
docker login -u="nkonev" -p="${{ secrets.DockerPassword }}" | |
(cd video; make push-docker && echo "Will deploy video" && ssh -o "BatchMode yes" -o StrictHostKeyChecking=no -q ${{ secrets.ConnectLine }} ${{ secrets.VideoUpdateCommand }} ) | |
integration-test: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install software | |
run: | | |
mkdir -p ${HOME}/bin && curl https://raw.githubusercontent.com/vishnubob/wait-for-it/8ed92e8cab83cfed76ff012ed4a36cef74b28096/wait-for-it.sh > ${HOME}/bin/wait-for-it.sh && chmod +x ${HOME}/bin/wait-for-it.sh | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: liberica | |
java-version: 17.0.4 | |
- name: Cache local Maven repository | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.m2/repository | |
~/.m2/wrapper | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml', '**/.mvn/wrapper/maven-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16.13.0 | |
- name: Cache Playwright browsers and Node.js dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
**/node_modules | |
~/.cache/ms-playwright | |
key: ${{ runner.os }}-playwright-browsers-v0-${{ hashFiles('**/package-lock.json') }} | |
- name: Install Playwright Node.js dependencies | |
run: (cd integration-test; npm ci) | |
- name: Install Playwright browsers | |
run: (cd integration-test; npx playwright install) | |
- name: Cache frontend Node.js dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
**/node_modules | |
key: ${{ runner.os }}-frontend-cache-v1-${{ hashFiles('**/package-lock.json') }} | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.19 | |
- name: Cache go modules | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/go/pkg/mod | |
~/.cache/go-build | |
key: ${{ runner.os }}-go-integration-test-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Start and wait docker-compose | |
run: | | |
docker-compose up -d postgresql redis rabbitmq jaeger minio frontend traefik | |
${HOME}/bin/wait-for-it.sh -t 30 127.0.0.1:35432 -- echo 'postgres is up' | |
${HOME}/bin/wait-for-it.sh -t 30 127.0.0.1:36379 -- echo 'redis is up' | |
sleep 5 && ${HOME}/bin/wait-for-it.sh -t 30 127.0.0.1:36672 -- echo 'rabbitmq is up' | |
${HOME}/bin/wait-for-it.sh -t 30 127.0.0.1:16686 -- echo 'jaeger web ui is up' | |
${HOME}/bin/wait-for-it.sh -t 30 127.0.0.1:8082 -- echo 'frontend nginx is up' | |
${HOME}/bin/wait-for-it.sh -t 30 127.0.0.1:9000 -- echo 'minio is up' | |
${HOME}/bin/wait-for-it.sh -t 30 127.0.0.1:8081 -- echo 'traefik is up' | |
- name: Build microservices | |
run: | | |
(cd aaa; ./mvnw -DskipTests clean package) | |
(cd frontend; npm install && npm run build) | |
(cd chat; make check-env download generate package-go) | |
(cd event; make check-env download generate package-go) | |
- name: Run microservices | |
run: | | |
(cd aaa; ./run-oauth2-emu.sh & ./run-with-oauth2.sh &) | |
(cd chat; ./chat &) | |
(cd event; ./event &) | |
- name: Wait for microservices | |
run: | | |
${HOME}/bin/wait-for-it.sh -t 40 127.0.0.1:9080 -- echo 'oauth2 emulator controller is up' | |
${HOME}/bin/wait-for-it.sh -t 40 127.0.0.1:8060 -- echo 'aaa is up' | |
${HOME}/bin/wait-for-it.sh -t 40 127.0.0.1:1235 -- echo 'chat is up' | |
${HOME}/bin/wait-for-it.sh -t 40 127.0.0.1:1238 -- echo 'event is up' | |
- name: Run your Playwright tests | |
run: (cd integration-test; npx playwright test) | |
- name: Upload test results | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: playwright-results | |
path: integration-test/test-results |