enable secrets #5
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] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
environment: production | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 1.21.6 | |
- name: Build server | |
working-directory: server | |
run: go build | |
- name: Build client | |
working-directory: client | |
run: go build | |
- name: Build image | |
run: | | |
docker build -t academy-coap . | |
- name: Run image | |
env: | |
STORAGE_CONNECTION_STRING: ${{ secrets.STORAGE_CONNECTION_STRING }} | |
STORAGE_CONTAINER_NAME: ${{ vars.STORAGE_CONTAINER_NAME }} | |
run: | | |
docker run -p 5688:5688/udp -p 5689:5689/udp -e STORAGE_CONNECTION_STRING -e STORAGE_CONTAINER_NAME -d academy-coap | |
- run: docker ps | |
- name: Run test client | |
working-directory: client | |
run: go run client.go -address 172.17.0.2 | |
- name: Docker logs | |
run: | | |
docker ps | |
docker container logs `docker ps | grep academy-coap | awk '{ print $1; }'` | |
if: always() | |
- name: Docker Login | |
run: | | |
docker login -u ${{ vars.REGISTRY_USERNAME }} -p ${{ secrets.REGISTRY_PASSWORD }} ${{ vars.REGISTRY_LOGIN_SERVER }} | |
- name: Push Image | |
run: | | |
docker tag academy-coap ${{vars.REGISTRY_LOGIN_SERVER}}/coap | | |
docker push ${{vars.REGISTRY_LOGIN_SERVER}}/coap | |