90 lines
3.1 KiB
YAML
Executable File
90 lines
3.1 KiB
YAML
Executable File
name: Skyweave Test, Lint, and Deploy Ritual
|
|
|
|
on:
|
|
push:
|
|
branches: [ master ]
|
|
pull_request:
|
|
branches: [ master ]
|
|
|
|
jobs:
|
|
test-and-lint:
|
|
name: Test and Lint Code
|
|
runs-on: ubuntu-latest # CORRECTED: This key was missing.
|
|
|
|
steps:
|
|
- name: 1. Authenticate to Docker Hub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
- name: 2. Checkout Repository Code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: 3. Install Lua Dependencies in Alpine
|
|
# We must run this step inside the target container
|
|
uses: add-and-commit/docker-run-action@v3
|
|
with:
|
|
image: node:lts-alpine
|
|
# The shell command is now run within the node:lts-alpine container
|
|
run: |
|
|
echo "Sanctifying container with Lua tools..."
|
|
apk add --no-cache luacheck lua5.1-dev build-base git luarocks
|
|
luarocks-5.1 install busted
|
|
cp lib/json.lua skyweave/
|
|
|
|
- name: 4. Run Luacheck Scrutiny in Alpine
|
|
uses: add-and-commit/docker-run-action@v3
|
|
with:
|
|
image: node:lts-alpine
|
|
run: |
|
|
echo "Scanning Lua scripture..."
|
|
luacheck --std lua51 .
|
|
|
|
- name: 5. Perform Unit Inquisition (Busted) in Alpine
|
|
uses: add-and-commit/docker-run-action@v3
|
|
with:
|
|
image: node:lts-alpine
|
|
run: |
|
|
echo "Initiating unit tests..."
|
|
busted --lua=lua5.1 --verbose spec/
|
|
|
|
deploy-to-device:
|
|
name: Deploy to Roof Unit
|
|
needs: test-and-lint
|
|
runs-on: ubuntu-latest
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
|
|
|
steps:
|
|
- name: 1. Authenticate to Docker Hub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
- name: 2. Checkout Repository Code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: 3. Prepare SSH Environment
|
|
run: |
|
|
echo "Preparing the sacred keys and crypto-litany for SSH communion..."
|
|
mkdir -p ~/.ssh/
|
|
echo "${{ secrets.ROOF_UNIT_SSH_KEY }}" > ~/.ssh/id_rsa
|
|
chmod 600 ~/.ssh/id_rsa
|
|
|
|
ssh-keyscan -H "${{ secrets.ROOF_UNIT_HOSTNAME }}" >> ~/.ssh/known_hosts
|
|
|
|
echo "Host roof-unit" > ~/.ssh/config
|
|
echo " HostName ${{ secrets.ROOF_UNIT_HOSTNAME }}" >> ~/.ssh/config
|
|
echo " User ${{ secrets.ROOF_UNIT_USER }}" >> ~/.ssh/config
|
|
echo " IdentityFile ~/.ssh/id_rsa" >> ~/.ssh/config
|
|
echo " KexAlgorithms +diffie-hellman-group1-sha1" >> ~/.ssh/config
|
|
echo " HostKeyAlgorithms +ssh-rsa" >> ~/.ssh/config
|
|
echo " MACs +hmac-sha1" >> ~/.ssh/config
|
|
echo " PubkeyAcceptedAlgorithms +ssh-rsa" >> ~/.ssh/config
|
|
|
|
- name: 4. Execute Deployment Ritual
|
|
run: |
|
|
echo "Initiating deployment sequence..."
|
|
chmod +x ./skyweave_deploy.sh
|
|
./skyweave_deploy.sh |