-
Notifications
You must be signed in to change notification settings - Fork 11
104 lines (90 loc) · 3.39 KB
/
wc_build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: Reusable - Build & coverage
on:
workflow_call:
inputs:
matrix_filter:
required: true
type: string
secrets:
CODECOV_TOKEN:
required: false
jobs:
matrix_prep:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- id: set-matrix
uses: JoshuaTheMiller/[email protected]
with:
filter: '${{ inputs.matrix_filter }}'
build:
needs: [ "matrix_prep" ]
strategy:
fail-fast: false
matrix: ${{fromJson(needs.matrix_prep.outputs.matrix)}}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# SETUP & CACHE
- uses: coursier/[email protected]
with:
jvm: adopt:8
apps: sbt scala scalafmt # https://github.com/coursier/apps
- uses: coursier/cache-action@v6
with:
extraKey: "${{ matrix.spark }}"
# CHECK CODE FORMAT
- name: Code Format
id: code_format
if: contains(matrix.scope, 'test')
run: sbt -DsparkVersion=${{ matrix.spark }} scalafmtCheckAll
shell: bash
# TESTING & COVERAGE
- name: Test & coverage 📋
id: test_coverage
if: steps.code_format.conclusion == 'success'
run: sbt -DsparkVersion=${{ matrix.spark }} coverage +core/test coverageAggregate
shell: bash
- name: Test Summary
id: test_summary
if: ${{ success() && steps.test_coverage.conclusion == 'success' || failure() && steps.test_coverage.conclusion == 'failure' }}
uses: test-summary/[email protected]
with:
paths: "./core/target/test-reports/**/TEST-*.xml"
output: "test-summary.md"
- name: Add 2 GitHub step summary
if: ${{ (success() || failure()) && steps.test_summary.conclusion == 'success' }}
shell: bash
run: cat test-summary.md >> $GITHUB_STEP_SUMMARY
- name: Add summary link
id: add_summary_link
if: ${{ (success() || failure()) && steps.test_summary.conclusion == 'success' }}
shell: bash
run: |
img=$(head -1 test-summary.md | perl -pe 's/(<.*?.>).*/$1/')
url="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
echo "| ${{ matrix.spark }} | [${img}](${url}) |" > test-summary-${{ matrix.spark }}.md
cat -e test-summary-${{ matrix.spark }}.md
- name: Upload test summary
if: ${{ github.event_name == 'pull_request' && ((success() || failure()) && steps.add_summary_link.conclusion == 'success') }}
uses: actions/upload-artifact@v4
with:
name: "test-summary-${{ matrix.spark }}.md"
path: "test-summary-${{ matrix.spark }}.md"
if-no-files-found: error
retention-days: 1
- name: Publish coverage to codecov 📊
if: contains(matrix.scope, 'uploadReport')
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./target/scala-2.12/scoverage-report/scoverage.xml,./target/scala-2.13/scoverage-report/scoverage.xml
fail_ci_if_error: true
verbose: false
flags: 'spark-${{ matrix.spark }}.x'
# CLEAN PROJECT BEFORE CACHE
- name: Cleaning before cache 🚯
if: ${{ always() }}
uses: ./.github/actions/clean_cache