use correct image #30
Workflow file for this run
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: Tests | |
on: [push] | |
env: | |
IMAGE_NAME: coap | |
IMAGE_TAGGED: coap:${{ github.sha }} | |
REPO_IMAGE_TAGGED: ${{ vars.REGISTRY_LOGIN_SERVER }}/coap:${{ github.sha }} | |
REPO_IMAGE_LATEST: ${{ vars.REGISTRY_LOGIN_SERVER }}/coap:latest | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.22.1 | |
- name: Build client | |
working-directory: client | |
run: go build | |
- name: Build server | |
working-directory: server | |
run: go build | |
- name: Build image | |
run: | | |
docker build -t ${{ env.IMAGE_TAGGED }} . | |
- name: Run image | |
env: | |
STORAGE_CONNECTION_STRING: ${{ secrets.STORAGE_CONNECTION_STRING }} | |
STORAGE_CONTAINER_NAME: ${{ vars.STORAGE_CONTAINER_NAME }} | |
run: | | |
docker run --network=host -p 5688:5688/udp -p 5689:5689/udp -e STORAGE_CONNECTION_STRING -e STORAGE_CONTAINER_NAME -d ${{ env.IMAGE_TAGGED }} | |
- run: docker ps | |
- run: docker container logs `docker ps | grep ${{ env.IMAGE_TAGGED }} | awk '{ print $1; }'` | |
- name: Run test client (IPv4) | |
working-directory: client | |
run: ./coap-client | |
- name: Run test client (IPv6) | |
working-directory: client | |
run: ./coap-client -udp6 | |
- name: Docker logs | |
if: always() | |
run: | | |
docker ps | |
docker container logs `docker ps | grep ${{ env.IMAGE_TAGGED }} | awk '{ print $1; }'` | |
- name: Push image to the infrastructure container registry as latest | |
if: github.ref == 'refs/heads/saga' | |
run: | | |
docker login -u ${{ vars.REGISTRY_USERNAME }} -p ${{ secrets.REGISTRY_PASSWORD }} ${{ vars.REGISTRY_LOGIN_SERVER }} | |
docker tag ${{ env.IMAGE_TAGGED }} ${{ env.REPO_IMAGE_TAGGED }} | |
docker push ${{ env.REPO_IMAGE_TAGGED }} | |
docker tag ${{ env.IMAGE_TAGGED }} ${{ env.REPO_IMAGE_LATEST }} | |
docker push ${{ env.REPO_IMAGE_LATEST }} |