Skip to content

Commit e7c0e32

Browse files
Add CI workflow to run integration tests
On every push and pull request that affects relevant files, run the integration tests.
1 parent e52d9eb commit e7c0e32

File tree

2 files changed

+90
-0
lines changed

2 files changed

+90
-0
lines changed
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
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

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
[![Check Markdown status](https://github.com/arduino/setup-protoc/actions/workflows/check-markdown-task.yml/badge.svg)](https://github.com/arduino/setup-protoc/actions/workflows/check-markdown-task.yml)
77
[![Check License status](https://github.com/arduino/setup-protoc/actions/workflows/check-license.yml/badge.svg)](https://github.com/arduino/setup-protoc/actions/workflows/check-license.yml)
88
[![Check Taskfiles status](https://github.com/arduino/setup-protoc/actions/workflows/check-taskfiles.yml/badge.svg)](https://github.com/arduino/setup-protoc/actions/workflows/check-taskfiles.yml)
9+
[![Integration Tests status](https://github.com/arduino/setup-protoc/actions/workflows/test-integration.yml/badge.svg)](https://github.com/arduino/setup-protoc/actions/workflows/test-integration.yml)
910

1011
This action makes the `protoc` compiler available to Workflows.
1112

0 commit comments

Comments
 (0)