test-install.yml 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. name: Test Install Script
  2. run-name: "Install Test: ${{ github.event_name == 'pull_request' && format('PR #{0}', github.event.pull_request.number) || github.ref_name }} | ${{ github.event.head_commit.message || github.event.pull_request.title || 'Manual trigger' }} by ${{ github.actor }}"
  3. on:
  4. push:
  5. branches: [ master ]
  6. pull_request:
  7. branches: [ master ]
  8. paths:
  9. - 'install.sh'
  10. - '.github/workflows/test-install.yml'
  11. jobs:
  12. test-install-script:
  13. name: Test on ${{ matrix.os }}
  14. runs-on: ${{ matrix.os }}
  15. env:
  16. # Remote installer from the current repository and commit
  17. RAW_URL: ${{ format('https://raw.githubusercontent.com/{0}/{1}/install.sh', github.repository, github.sha) }}
  18. strategy:
  19. fail-fast: false
  20. matrix:
  21. os: [ubuntu-latest, ubuntu-24.04-arm, macos-latest, macos-13]
  22. steps:
  23. - name: Test install script help
  24. run: curl -fsSL "$RAW_URL" | sh -s -- --help
  25. - name: Test with bash (if available)
  26. run: curl -fsSL "$RAW_URL" | bash -s -- --help
  27. - name: Test install latest
  28. run: curl -fsSL "$RAW_URL" | sh
  29. - name: Check DDNS
  30. run: ddns --version
  31. - name: Test uninstall
  32. run: curl -fsSL "$RAW_URL" | sh -s -- --uninstall
  33. - name: Test install beta with language detection (zh_CN)
  34. run: curl -fsSL "$RAW_URL" | LANG=zh_CN.UTF-8 sh -s -- beta
  35. - name: Test install help with language detection (zh_CN)
  36. run: curl -fsSL "$RAW_URL" | LANG=zh_CN.UTF-8 sh -s -- --help
  37. - name: Check DDNS
  38. run: ddns --version
  39. - name: Test uninstall
  40. run: curl -fsSL "$RAW_URL" | sh -s -- --uninstall
  41. - name: Test install location by wget
  42. run: wget -qO - "$RAW_URL" | sh -s -- --install-dir /tmp/ddns
  43. - name: Check DDNS in custom location
  44. run: /tmp/ddns/ddns --version
  45. test-with-container:
  46. name: Test on Container (${{ matrix.container }})
  47. runs-on: ubuntu-latest
  48. strategy:
  49. matrix:
  50. container:
  51. - alpine:latest
  52. - debian:latest
  53. - openwrt/rootfs:latest
  54. container: ${{ matrix.container }}
  55. env:
  56. # Remote installer from the current repository and commit
  57. RAW_URL: ${{ format('https://raw.githubusercontent.com/{0}/{1}/install.sh', github.repository, github.sha) }}
  58. steps:
  59. - name: install wget
  60. if: matrix.container == 'debian:latest'
  61. run: apt-get update && apt-get install -y wget
  62. - name: Download install script
  63. run: wget "$RAW_URL" && chmod +x install.sh
  64. - name: Test install script help
  65. run: ./install.sh --help
  66. - name: Test install latest
  67. run: ./install.sh
  68. - name: Check DDNS
  69. run: ddns --version
  70. - name: Test uninstall
  71. run: ./install.sh --uninstall
  72. - name: Test install beta with language detection (zh_CN)
  73. run: LANG=zh_CN.UTF-8 ./install.sh beta
  74. - name: Check DDNS
  75. run: ddns --version
  76. - name: Test uninstall
  77. run: ./install.sh --uninstall