test: skip tests for new ports until deployed #47
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 | |
- pull_request | |
env: | |
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 --cidfile container.cid --network=host -p 5683:5683/udp -p 5684:5684/udp -p 5688:5688/udp -p 5689:5689/udp -e STORAGE_CONNECTION_STRING -e STORAGE_CONTAINER_NAME -d ${{ env.IMAGE_TAGGED }} | |
CID=`cat container.cid` | |
echo "CID=${CID}" >> $GITHUB_ENV | |
- run: docker ps | |
- run: docker container logs ${{ env.CID }} | |
- name: Run test client (IPv4, old ports) | |
working-directory: client | |
run: ./coap-client -udpPort 5688 -dTLSPort 5689 | |
- name: Run test client (IPv6, old ports) | |
working-directory: client | |
run: ./coap-client -udp6 -udpPort 5688 -dTLSPort 5689 | |
- name: Run test client (IPv4, new ports) | |
working-directory: client | |
run: ./coap-client -udpPort 5683 -dTLSPort 5684 | |
- name: Run test client (IPv6, new ports) | |
working-directory: client | |
run: ./coap-client -udp6 -udpPort 5683 -dTLSPort 5684 | |
- name: Docker logs | |
if: always() | |
run: docker container logs ${{ env.CID }} | |
- 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 }} |