testing ci #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: Verify and Install IPs | |
on: | |
push: | |
workflow_dispatch: | |
jobs: | |
verify_install: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y jq | |
pip install ipmgr | |
- name: Create results file | |
run: echo "" > results.txt | |
- name: Read and process JSON | |
id: process_json | |
run: | | |
# Extract IP names and their latest version | |
jq -r 'to_entries[] | "\(.key) \(.value.release | keys_unsorted | .[0])"' verified_IPs.json > ip_versions.txt | |
- name: Install and verify IPs | |
run: | | |
# Loop through each IP and version | |
while read -r NAME VERSION; do | |
echo "Processing $NAME with version $VERSION" | |
if ipm install "$NAME"; then | |
cd "$NAME" | |
if ipm check-ip --ip-root ~/.ipm/"$NAME"/"$VERSION" --ip-name "$NAME"; then | |
echo "$NAME: PASSED" >> ../results.txt | |
else | |
echo "$NAME: FAILED during check-ip" >> ../results.txt | |
fi | |
cd .. | |
else | |
echo "$NAME: FAILED during install" >> results.txt | |
fi | |
done < ip_versions.txt | |
- name: Output results | |
run: cat results.txt | |
- name: Fail job if any IP failed | |
run: | | |
if grep -q "FAILED" results.txt; then | |
echo "Some IPs failed. See results above." | |
exit 1 | |
fi | |
shell: bash |