|
| 1 | +name: Test install script |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + paths: |
| 6 | + - ".github/workflows/test-install.yml" |
| 7 | + - "etc/install.sh" |
| 8 | + pull_request: |
| 9 | + paths: |
| 10 | + - ".github/workflows/test-install.yml" |
| 11 | + - "etc/install.sh" |
| 12 | + schedule: |
| 13 | + # Run every day at 03:00 UTC to catch breakage caused by external events |
| 14 | + - cron: "0 3 * * *" |
| 15 | + # workflow_dispatch event allows the workflow to be triggered manually. |
| 16 | + # See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows#workflow_dispatch |
| 17 | + workflow_dispatch: |
| 18 | + |
| 19 | +env: |
| 20 | + TOOL_NAME: arduino-lint # The executable's file name |
| 21 | + |
| 22 | +jobs: |
| 23 | + default: |
| 24 | + strategy: |
| 25 | + fail-fast: false |
| 26 | + |
| 27 | + matrix: |
| 28 | + os: |
| 29 | + - ubuntu-latest |
| 30 | + - windows-latest |
| 31 | + - macos-latest |
| 32 | + |
| 33 | + runs-on: ${{ matrix.os }} |
| 34 | + |
| 35 | + steps: |
| 36 | + - name: Checkout local repository |
| 37 | + uses: actions/checkout@v2 |
| 38 | + |
| 39 | + - name: Run script with defaults |
| 40 | + shell: sh |
| 41 | + run: | |
| 42 | + "${{ github.workspace }}/etc/install.sh" |
| 43 | +
|
| 44 | + - name: Verify installation |
| 45 | + shell: bash |
| 46 | + run: | |
| 47 | + "${PWD}/bin/${{ env.TOOL_NAME }}" --version |
| 48 | +
|
| 49 | + bindir: |
| 50 | + strategy: |
| 51 | + fail-fast: false |
| 52 | + |
| 53 | + matrix: |
| 54 | + os: |
| 55 | + - ubuntu-latest |
| 56 | + - windows-latest |
| 57 | + - macos-latest |
| 58 | + |
| 59 | + runs-on: ${{ matrix.os }} |
| 60 | + |
| 61 | + steps: |
| 62 | + - name: Set install path environment variable |
| 63 | + shell: bash |
| 64 | + run: | |
| 65 | + # See: https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable |
| 66 | + echo "BINDIR=${{ runner.temp }}/custom-installation-folder" >> "$GITHUB_ENV" |
| 67 | +
|
| 68 | + - name: Checkout local repository |
| 69 | + uses: actions/checkout@v2 |
| 70 | + |
| 71 | + - name: Run script with custom install location |
| 72 | + shell: sh |
| 73 | + run: | |
| 74 | + mkdir -p "${{ env.BINDIR }}" |
| 75 | + "${{ github.workspace }}/etc/install.sh" |
| 76 | +
|
| 77 | + - name: Verify installation |
| 78 | + shell: bash |
| 79 | + run: | |
| 80 | + "${{ env.BINDIR }}/${{ env.TOOL_NAME }}" --version |
| 81 | +
|
| 82 | + version: |
| 83 | + strategy: |
| 84 | + fail-fast: false |
| 85 | + |
| 86 | + matrix: |
| 87 | + os: |
| 88 | + - ubuntu-latest |
| 89 | + - windows-latest |
| 90 | + - macos-latest |
| 91 | + |
| 92 | + runs-on: ${{ matrix.os }} |
| 93 | + |
| 94 | + env: |
| 95 | + VERSION: "1.0.0" |
| 96 | + |
| 97 | + steps: |
| 98 | + - name: Checkout local repository |
| 99 | + uses: actions/checkout@v2 |
| 100 | + |
| 101 | + - name: Run script with version argument |
| 102 | + shell: sh |
| 103 | + run: | |
| 104 | + "${{ github.workspace }}/etc/install.sh" "${{ env.VERSION }}" |
| 105 | +
|
| 106 | + - name: Verify installation |
| 107 | + shell: bash |
| 108 | + run: | |
| 109 | + "${PWD}/bin/${{ env.TOOL_NAME }}" --version | grep --fixed-strings "${{ env.VERSION }}" |
| 110 | +
|
| 111 | + nightly: |
| 112 | + strategy: |
| 113 | + fail-fast: false |
| 114 | + |
| 115 | + matrix: |
| 116 | + os: |
| 117 | + - ubuntu-latest |
| 118 | + - windows-latest |
| 119 | + - macos-latest |
| 120 | + |
| 121 | + runs-on: ${{ matrix.os }} |
| 122 | + |
| 123 | + steps: |
| 124 | + - name: Checkout local repository |
| 125 | + uses: actions/checkout@v2 |
| 126 | + |
| 127 | + - name: Run script with nightly build version argument |
| 128 | + shell: sh |
| 129 | + run: | |
| 130 | + "${{ github.workspace }}/etc/install.sh" "nightly-latest" |
| 131 | +
|
| 132 | + - name: Verify installation |
| 133 | + shell: bash |
| 134 | + run: | |
| 135 | + "${PWD}/bin/${{ env.TOOL_NAME }}" --version | grep "^nightly-" |
0 commit comments