Skip to content

Workflow file for this run

name: Test Build and Call With Fake Register
on: [push]
jobs:
fakeRegister:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python 3.x
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y openssl
- name: Install Python Dependencies
run: |
python3 -m pip install --upgrade pip
pip3 install requests
- name: Create Dummy Certificates
run: |
mkdir -p ./data/certs
openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:2048 -out ./data/certs/local-ca.key
openssl req -x509 -new -nodes -key ./data/certs/local-ca.key -sha256 -days 3650 -out ./data/certs/local-ca.pem -subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=local-ca.example.com"
openssl req -x509 -new -nodes -key ./data/certs/local-ca.key -sha256 -days 3650 -out ./data/certs/factory_ca.pem -subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=www.example.com"
openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:2048 -out ./data/certs/server.key
openssl req -new -key ./data/certs/server.key -out ./data/certs/server.csr -subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=www.example.com"
openssl x509 -req -in ./data/certs/server.csr -CA ./data/certs/local-ca.pem -CAkey ./data/certs/local-ca.key -CAcreateserial -out ./data/certs/tls-crt -days 365 -sha256
ls -la ./data/certs
- name: Run Docker Compose
run: |
docker-compose up --build --force-recreate --detach
sleep 10
- name: Execute Script
run: |
python3 fake-lmp-device-register --registration-url "http://localhost:80/sign" --factory fake-test-sample
- name: Check relative /var/sota directory and pkey.pem file
run: |
if [[ -d "var/sota" && -f "var/sota/pkey.pem" ]]; then
echo "Relative /var/sota directory exists and pkey.pem is present"
else
echo "Relative /var/sota directory or pkey.pem is missing"
exit 1
fi
ls -la var/sota/
- name: Output Docker Compose Logs
if: always()
run: |
echo "Docker Compose Logs:"
docker-compose logs
- name: Shutdown Docker Compose
if: always()
run: |
docker-compose ps
docker-compose down