Skip to content
This repository has been archived by the owner on Apr 28, 2024. It is now read-only.

Update docker/login-action action to v3 (#33) #126

Update docker/login-action action to v3 (#33)

Update docker/login-action action to v3 (#33) #126

Workflow file for this run

name: build
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
CARGO_TERM_COLOR: always
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: fmt
run: cargo fmt -- --check
- name: clippy
run: cargo clippy -- -Dwarnings
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
- name: Run check
run: cargo check --verbose
docker:
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker
uses: docker/setup-buildx-action@v3
- name: Build Docker image
run: |
docker build -t kbudde/bench-metrics:${{ github.sha }} .
docker tag kbudde/bench-metrics:${{ github.sha }} kbudde/bench-metrics:latest
- name: docker image smoke test
# missing depencies will prevent starting the application.
run: |
docker run --name benchem -d -it -e BENCH_URL="http://localhost:9090/" kbudde/bench-metrics:latest
sleep 15s
docker logs benchem|grep "Benchem started" || {
echo "Issue with docker image. Start up log message not found"
echo "## Output: $(docker logs benchem)"
exit 1;
}
docker rm -f benchem || echo "ok"
- name: integration test
run: ./integration_test/check.sh
## if: github.ref == 'refs/heads/main' ##
- name: Login to Docker Hub
if: github.ref == 'refs/heads/main'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Push Docker image
if: github.ref == 'refs/heads/main'
run: |
docker push kbudde/bench-metrics:${{ github.sha }}
docker push kbudde/bench-metrics:latest