Update test matrix strategy (#10)

This commit is contained in:
Bryan Naegele 2021-09-12 18:49:05 -06:00 committed by GitHub
parent aabe880146
commit 4d758e89f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 55 additions and 33 deletions

View File

@ -1,20 +1,35 @@
{ {
"otp_version": ["24.0.4", "23.3.4.2", "22.3.4.20"], "otp_version": [
"elixir_version": ["1.12.2", "1.11.4", "1.10.4"], "24.0.6",
"23.3.4.7",
"22.3.4.21"
],
"elixir_version": [
"1.12.3",
"1.11.4"
],
"rebar3_version": [
"3.16.1"
],
"os": [
"ubuntu-18.04"
],
"include": [ "include": [
{ {
"otp_version": "21.3.8.24", "otp_version": "21.3.8.24",
"elixir_version": "1.10.4", "elixir_version": "1.10.4",
"rebar3_version": "3.15.2" "rebar3_version": "3.15.2"
},
{
"otp_version": "21.3.8.24",
"elixir_version": "1.11.4",
"rebar3_version": "3.15.2"
} }
], ],
"exclude": [ "exclude": [
{ {
"otp_version": "21.3.8.24", "otp_version": "21.3.8.24",
"elixir_version": "1.12.2" "elixir_version": "1.12.3"
} }
],
"apps": [
"opentelemetry_phoenix"
] ]
} }

View File

@ -10,19 +10,22 @@ on:
- 'main' - 'main'
jobs: jobs:
# test-matrix: test-matrix:
# runs-on: ubuntu-latest runs-on: ubuntu-latest
# outputs: outputs:
# matrix: ${{ steps.set-matrix.outputs.matrix }} matrix: ${{ steps.set-matrix.outputs.matrix }}
# steps: steps:
# - uses: actions/checkout@v2 - uses: actions/checkout@v2
# - name: Read file - name: Read file
# id: set-matrix id: set-matrix
# run: | run: |
# echo "::set-output name=matrix::$(cat ./.github/test-matrix.json | jq -r -s '.|tojson')" matrixStringifiedObject="{\"otp_version\":[\"24.0.6\",\"23.3.4.7\",\"22.3.4.21\"],\"elixir_version\":[\"1.12.3\",\"1.11.4\"],\"rebar3_version\":[\"3.16.1\"],\"os\":[\"ubuntu-18.04\"],\"include\":[{\"otp_version\":\"21.3.8.24\",\"elixir_version\":\"1.10.4\",\"rebar3_version\":\"3.15.2\"},{\"otp_version\":\"21.3.8.24\",\"elixir_version\":\"1.11.4\",\"rebar3_version\":\"3.15.2\"}],\"exclude\":[{\"otp_version\":\"21.3.8.24\",\"elixir_version\":\"1.12.3\"}]}"
echo "::set-output name=matrix::$matrixStringifiedObject"
opentelemetry-phoenix: opentelemetry-phoenix:
# needs: [test-matrix] needs: [test-matrix]
if: (contains(github.event.pull_request.labels.*.name, 'elixir') && contains(github.event.pull_request.labels.*.name, 'opentelemetry_phoenix')) if: (contains(github.event.pull_request.labels.*.name, 'elixir') && contains(github.event.pull_request.labels.*.name, 'opentelemetry_phoenix') && contains(github.event.pull_request.labels.*.name, 'scope-ci'))
env:
app: 'opentelemetry_phoenix'
defaults: defaults:
run: run:
working-directory: instrumentation/${{ env.app }} working-directory: instrumentation/${{ env.app }}
@ -30,21 +33,7 @@ jobs:
name: Opentelemetry Phoenix test on Elixir ${{ matrix.elixir_version }} (OTP ${{ matrix.otp_version }}) name: Opentelemetry Phoenix test on Elixir ${{ matrix.elixir_version }} (OTP ${{ matrix.otp_version }})
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix: ${{ fromJson(needs.test-matrix.outputs.matrix) }}
os: [ubuntu-18.04]
otp_version: ["24.0.4", "23.3.4.2", "22.3.4.20"]
elixir_version: ["1.12.2", "1.11.4"]
rebar3_version: ["3.16.1"]
include:
- otp_version: '21.3.8.24'
elixir_version: '1.11.4'
rebar3_version: '3.15.2'
os: ubuntu-18.04
exclude:
- otp_version: '21.3.8.24'
elixir_version: '1.12.1'
env:
app: 'opentelemetry_phoenix'
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: erlef/setup-beam@v1 - uses: erlef/setup-beam@v1

18
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,18 @@
## Contributing
### CI
Given the number of projects in this repo and the wide matrix of OTP/Elixir versions we must
test against, it is important to scope test jobs to the smallest subset of test possible. Project test jobs should utilize the test matrix strategy outputted by the `test-matrix` job.
### Test Matrix Updates
As new OTP and Elixir versions are released, the test matrix must be updated. A beautified version of the [test matrix](https://github.com/open-telemetry/opentelemetry-erlang-contrib/blob/main/.github/test-matrix.json) is kept for easy editing.
Updating the file:
1. Update the beautified json file (this is the form you'll commit)
2. Uglify and escape the json object
3. Copy this final value to the `test-matrix` job output