Skip to content

make trest tests pass again #475

make trest tests pass again

make trest tests pass again #475

Workflow file for this run

name: Build, test and push images
env:
POSTGRES_PASSWORD: password
POSTGRES_HOST: postgres
on:
push
jobs:
build_frontend_docker_image:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build frontend image
working-directory: frontend
env:
IMAGE_TAG: ghcr.io/t-x-t/dukatia/frontend:${{ github.ref_name }}
NUXT_PUBLIC_COMMIT: ${{ github.sha }}
NUXT_PUBLIC_BRANCH: ${{ github.ref_name }}
run: |
docker build --build-arg NUXT_PUBLIC_COMMIT=$NUXT_PUBLIC_COMMIT --build-arg NUXT_PUBLIC_BRANCH=$NUXT_PUBLIC_BRANCH -t $IMAGE_TAG .
docker save -o frontend_image.tar ghcr.io/t-x-t/dukatia/frontend:${{ github.ref_name }}
- name: Save docker image
uses: actions/upload-artifact@v4
with:
name: frontend_image
path: frontend/frontend_image.tar
build_backend_docker_image:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build backend image
working-directory: backend
env:
IMAGE_TAG: ghcr.io/t-x-t/dukatia/backend:${{ github.ref_name }}
run: |
docker build -t $IMAGE_TAG .
docker save -o backend_image.tar ghcr.io/t-x-t/dukatia/backend:${{ github.ref_name }}
- name: Save docker image
uses: actions/upload-artifact@v4
with:
name: backend_image
path: backend/backend_image.tar
build_example_demo_account_creator_docker_image:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build backend image
working-directory: examples/demo_account_creator
env:
IMAGE_TAG: ghcr.io/t-x-t/dukatia/examples_demo_account_creator:${{ github.ref_name }}
run: |
docker build -t $IMAGE_TAG .
docker save -o examples_demo_account_creator_image.tar ghcr.io/t-x-t/dukatia/examples_demo_account_creator:${{ github.ref_name }}
- name: Save docker image
uses: actions/upload-artifact@v4
with:
name: examples_demo_account_creator_image
path: examples/demo_account_creator/examples_demo_account_creator_image.tar
backend_api_test_trest:
runs-on: ubuntu-latest
needs:
build_backend_docker_image
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download backend image
uses: actions/download-artifact@v4
with:
name: backend_image
- name: Run trest on backend
working-directory: backend
run: |
docker load -i ../backend_image.tar
sed -i -e 's/build: ./image: ghcr.io\/t-x-t\/dukatia\/backend:${{ github.ref_name }}/g' trest.backend_different_db_user.docker-compose.yml
sed -i -e 's/build: ./image: ghcr.io\/t-x-t\/dukatia\/backend:${{ github.ref_name }}/g' trest.backend.docker-compose.yml
wget bin.tre.st/latest && chmod +x latest && ./latest trest.json
backend_test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Test backend
working-directory: backend
run: |
rustup toolchain install nightly --profile minimal --no-self-update
rustup default nightly
POSTGRES_PORT=5432 POSTGRES_HOST=127.0.0.1 cargo test -j 1
backend_clippy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run clippy on backend
working-directory: backend
run: |
rustup toolchain install nightly --profile minimal --no-self-update
rustup default nightly
rustup component add --toolchain nightly clippy
cargo clippy
push_backend:
runs-on: ubuntu-latest
permissions:
packages: write
needs:
- backend_test
- backend_clippy
- backend_api_test_trest
steps:
- name: Login to GitHub Packages
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Download backend image
uses: actions/download-artifact@v4
with:
name: backend_image
- name: Push backend image
env:
IMAGE_TAG: ghcr.io/t-x-t/dukatia/backend:${{ github.ref_name }}
run: |
docker load -i backend_image.tar
docker push $IMAGE_TAG
push_examples_demo_account_creator:
runs-on: ubuntu-latest
permissions:
packages: write
needs:
- build_example_demo_account_creator_docker_image
- backend_test
- backend_clippy
- backend_api_test_trest
steps:
- name: Login to GitHub Packages
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Download examples_demo_account_creator image
uses: actions/download-artifact@v4
with:
name: examples_demo_account_creator_image
- name: Push backend image
env:
IMAGE_TAG: ghcr.io/t-x-t/dukatia/examples_demo_account_creator:${{ github.ref_name }}
run: |
docker load -i examples_demo_account_creator_image.tar
docker push $IMAGE_TAG
push_frontend:
runs-on: ubuntu-latest
permissions:
packages: write
needs:
- backend_test
- backend_clippy
- backend_api_test_trest
- build_frontend_docker_image
steps:
- name: Login to GitHub Packages
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Download frontend image
uses: actions/download-artifact@v4
with:
name: frontend_image
- name: Push frontend image
env:
IMAGE_TAG: ghcr.io/t-x-t/dukatia/frontend:${{ github.ref_name }}
run: |
docker load -i frontend_image.tar
docker push $IMAGE_TAG