Skip to content

Commit 9d97910

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 9d97910

File tree

2 files changed

+96
-0
lines changed

2 files changed

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