mirror of
https://github.com/NewFuture/DDNS.git
synced 2026-10-20 08:17:43 +00:00
Bumps [actions/checkout](https://github.com/actions/checkout) from 6 to 7. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v6...v7) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: '7' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
130 lines
4.5 KiB
YAML
130 lines
4.5 KiB
YAML
name: Test Install Script
|
|
run-name: "Install Test: ${{ github.event_name == 'pull_request' && format('PR #{0}', github.event.pull_request.number) || github.ref_name }} | ${{ github.event.pull_request.title || 'Manual trigger' }} by ${{ github.actor }}"
|
|
permissions:
|
|
contents: read
|
|
|
|
on:
|
|
push:
|
|
branches: [ master ]
|
|
pull_request:
|
|
branches: [ master ]
|
|
paths:
|
|
- 'docs/public/install.sh'
|
|
- '.github/workflows/test-install.yml'
|
|
|
|
jobs:
|
|
check-changes:
|
|
name: Check install.sh or workflow changes
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
install-sh-changed: ${{ steps.filter.outputs.install-sh }}
|
|
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
with:
|
|
fetch-depth: 2
|
|
- name: Check if install.sh or workflow changed
|
|
id: filter
|
|
run: |
|
|
if [ "${{ github.event_name }}" = "pull_request" ]; then
|
|
echo "install-sh=true" >> $GITHUB_OUTPUT
|
|
else
|
|
# For push events, check if install.sh or workflow file changed in the last commit
|
|
if git diff --name-only HEAD^ HEAD | grep -qE "^(docs/public/install.sh|\.github/workflows/test-install\.yml)$"; then
|
|
echo "install-sh=true" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "install-sh=false" >> $GITHUB_OUTPUT
|
|
fi
|
|
fi
|
|
- name: Set matrix based on changes
|
|
id: set-matrix
|
|
run: |
|
|
if [ "${{ steps.filter.outputs.install-sh }}" = "true" ]; then
|
|
# Test all platforms when install.sh changed
|
|
echo 'matrix=["ubuntu-latest", "ubuntu-24.04-arm", "macos-latest", "macos-15-intel"]' >> $GITHUB_OUTPUT
|
|
else
|
|
# Test only ubuntu-latest when install.sh hasn't changed
|
|
echo 'matrix=["ubuntu-latest"]' >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
test-install-script:
|
|
name: Test on ${{ matrix.os }}
|
|
runs-on: ${{ matrix.os }}
|
|
needs: check-changes
|
|
env:
|
|
# Remote installer from the current repository and commit
|
|
RAW_URL: ${{ format('https://raw.githubusercontent.com/{0}/{1}/docs/public/install.sh', github.repository, github.sha) }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: ${{ fromJSON(needs.check-changes.outputs.matrix) }}
|
|
|
|
steps:
|
|
- name: Test install script help
|
|
run: curl -fsSL "$RAW_URL" | sh -s -- --help
|
|
- name: Test with bash (if available)
|
|
run: curl -fsSL "$RAW_URL" | bash -s -- --help
|
|
|
|
- name: Test install latest
|
|
run: curl -fsSL "$RAW_URL" | sh
|
|
- name: Check DDNS
|
|
run: ddns --version
|
|
- name: Test uninstall
|
|
run: curl -fsSL "$RAW_URL" | sh -s -- --uninstall
|
|
|
|
|
|
- name: Test install beta with language detection (zh_CN)
|
|
run: curl -fsSL "$RAW_URL" | LANG=zh_CN.UTF-8 sh -s -- beta
|
|
- name: Test install help with language detection (zh_CN)
|
|
run: curl -fsSL "$RAW_URL" | LANG=zh_CN.UTF-8 sh -s -- --help
|
|
- name: Check DDNS
|
|
run: ddns --version
|
|
- name: Test uninstall
|
|
run: curl -fsSL "$RAW_URL" | sh -s -- --uninstall
|
|
|
|
- name: Test install location by wget
|
|
run: wget -qO - "$RAW_URL" | sh -s -- --install-dir /tmp/ddns
|
|
- name: Check DDNS in custom location
|
|
run: /tmp/ddns/ddns --version
|
|
|
|
test-with-container:
|
|
name: Test on Container (${{ matrix.container }})
|
|
runs-on: ubuntu-latest
|
|
needs: check-changes
|
|
if: needs.check-changes.outputs.install-sh-changed == 'true'
|
|
strategy:
|
|
matrix:
|
|
container:
|
|
- alpine:latest
|
|
- debian:latest
|
|
- openwrt/rootfs:latest
|
|
|
|
container: ${{ matrix.container }}
|
|
env:
|
|
# Remote installer from the current repository and commit
|
|
RAW_URL: ${{ format('https://raw.githubusercontent.com/{0}/{1}/docs/public/install.sh', github.repository, github.sha) }}
|
|
|
|
steps:
|
|
- name: install wget
|
|
if: matrix.container == 'debian:latest'
|
|
run: apt-get update && apt-get install -y wget
|
|
- name: Download install script
|
|
run: wget "$RAW_URL" && chmod +x install.sh
|
|
|
|
- name: Test install script help
|
|
run: ./install.sh --help
|
|
|
|
- name: Test install latest
|
|
run: ./install.sh
|
|
- name: Check DDNS
|
|
run: ddns --version
|
|
- name: Test uninstall
|
|
run: ./install.sh --uninstall
|
|
|
|
- name: Test install beta with language detection (zh_CN)
|
|
run: LANG=zh_CN.UTF-8 ./install.sh beta
|
|
- name: Check DDNS
|
|
run: ddns --version
|
|
- name: Test uninstall
|
|
run: ./install.sh --uninstall
|