|
| 1 | +name: Integration Tests |
| 2 | + |
| 3 | +# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows |
| 4 | +on: |
| 5 | + push: |
| 6 | + paths: |
| 7 | + - ".github/workflows/test-integration.ya?ml" |
| 8 | + - "lib/**" |
| 9 | + - "action.yml" |
| 10 | + pull_request: |
| 11 | + paths: |
| 12 | + - ".github/workflows/test-integration.ya?ml" |
| 13 | + - "lib/**" |
| 14 | + - "action.yml" |
| 15 | + schedule: |
| 16 | + # Run every Tuesday at 8 AM UTC to catch breakage caused by external changes. |
| 17 | + - cron: "0 8 * * TUE" |
| 18 | + workflow_dispatch: |
| 19 | + repository_dispatch: |
| 20 | + |
| 21 | +jobs: |
| 22 | + defaults: |
| 23 | + runs-on: ubuntu-latest |
| 24 | + |
| 25 | + steps: |
| 26 | + - name: Checkout repository |
| 27 | + uses: actions/checkout@v3 |
| 28 | + |
| 29 | + - name: Run action with defaults |
| 30 | + uses: ./ # Use the action from the local path. |
| 31 | + |
| 32 | + - name: Run protoc |
| 33 | + # Verify that protoc was installed |
| 34 | + run: protoc --version |
| 35 | + |
| 36 | + version: |
| 37 | + name: version (${{ matrix.version.input }}, ${{ matrix.runs-on }}) |
| 38 | + runs-on: ${{ matrix.runs-on }} |
| 39 | + |
| 40 | + strategy: |
| 41 | + fail-fast: false |
| 42 | + |
| 43 | + matrix: |
| 44 | + runs-on: |
| 45 | + - ubuntu-latest |
| 46 | + - windows-latest |
| 47 | + - macos-latest |
| 48 | + version: |
| 49 | + - input: 3.x |
| 50 | + expected: "libprotoc 3.20.3" |
| 51 | + - input: 3.17.x |
| 52 | + expected: "libprotoc 3.17.3" |
| 53 | + - input: 3.17.2 |
| 54 | + expected: "libprotoc 3.17.2" |
| 55 | + |
| 56 | + steps: |
| 57 | + - name: Checkout repository |
| 58 | + uses: actions/checkout@v3 |
| 59 | + |
| 60 | + - name: Run action, using protoc minor version wildcard |
| 61 | + uses: ./ |
| 62 | + with: |
| 63 | + version: '${{ matrix.version.input }}' |
| 64 | + repo-token: ${{ secrets.GITHUB_TOKEN }} |
| 65 | + |
| 66 | + - name: Check protoc version |
| 67 | + shell: bash |
| 68 | + run: | |
| 69 | + [[ "$(protoc --version)" == "${{ matrix.version.expected }}" ]] |
| 70 | +
|
| 71 | + invalid-version: |
| 72 | + runs-on: ubuntu-latest |
| 73 | + |
| 74 | + steps: |
| 75 | + - name: Checkout repository |
| 76 | + uses: actions/checkout@v3 |
| 77 | + |
| 78 | + - name: Run action, using invalid version |
| 79 | + id: setup-protoc |
| 80 | + continue-on-error: true |
| 81 | + uses: ./ |
| 82 | + with: |
| 83 | + version: 2.42.x |
| 84 | + |
| 85 | + - name: Fail the job if the action run succeeded |
| 86 | + if: steps.setup-task.outcome == 'success' |
| 87 | + run: | |
| 88 | + echo "::error::The action run was expected to fail, but passed!" |
| 89 | + exit 1 |
0 commit comments