Skip to content

Commit 9db31ce

Browse files
committed
Merging main
2 parents e75de08 + f931d2d commit 9db31ce

5 files changed

Lines changed: 131 additions & 62 deletions

File tree

.github/workflows/cache.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Caching Cargo events
2+
3+
on: push
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v3
10+
11+
- name: Cache Cargo
12+
id: cache-cargo
13+
uses: actions/cache@v3
14+
env:
15+
cache-name: cache-cargo
16+
with:
17+
path: cache-folder
18+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/Cargo.lock') }}
19+
restore-keys: |
20+
${{ runner.os }}-build-${{ env.cache-name }}-
21+
${{ runner.os }}-build-
22+
${{ runner.os }}-
23+
24+
- if: ${{ steps.cache-cargo.outputs.cache-hit != 'true' }}
25+
name: Install grcov
26+
continue-on-error: true
27+
run: cargo install grcov
28+
29+
- name: Build
30+
run: cargo build
31+
32+
- name: Test
33+
run: cargo test
34+
35+
# TODO we need to pass the OS flags correctly

.github/workflows/configs/gcov-config.yml

Lines changed: 0 additions & 14 deletions
This file was deleted.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Unit Test Results
2+
3+
on:
4+
workflow_run:
5+
workflows: ["gcov"]
6+
types:
7+
- completed
8+
9+
jobs:
10+
unit-test-results:
11+
name: Unit Test Results
12+
runs-on: ubuntu-latest
13+
if: github.event.workflow_run.conclusion != 'skipped'
14+
15+
steps:
16+
- name: Download and Extract Artifacts
17+
env:
18+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
19+
run: |
20+
mkdir -p artifacts && cd artifacts
21+
22+
artifacts_url=${{ github.event.workflow_run.artifacts_url }}
23+
24+
gh api "$artifacts_url" -q '.artifacts[] | [.name, .archive_download_url] | @tsv' | while read artifact
25+
do
26+
IFS=$'\t' read name url <<< "$artifact"
27+
gh api $url > "$name.zip"
28+
unzip -d "$name" "$name.zip"
29+
done
30+
31+
- name: Publish Unit Test Results
32+
uses: EnricoMi/publish-unit-test-result-action@v2
33+
with:
34+
commit: ${{ github.event.workflow_run.head_sha }}
35+
event_file: artifacts/Event File/event.json
36+
event_name: ${{ github.event.workflow_run.event }}
37+
files: "artifacts/*.xml"

.github/workflows/publish.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- name: Checkout sources
16-
uses: actions/checkout@v2
16+
uses: actions/checkout@v3
1717

1818
- name: Install stable toolchain
1919
uses: actions-rs/toolchain@v1

.github/workflows/tests.yml

Lines changed: 58 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -10,54 +10,65 @@ env:
1010
CARGO_TERM_COLOR: always
1111

1212
jobs:
13-
# tests-unix:
14-
# runs-on: ubuntu-latest
15-
# steps:
16-
# - uses: actions/checkout@v3
17-
# - name: Run tests Unix
18-
# working-directory: ./canyon_sql
19-
# run: cargo test --verbose
20-
21-
# tests-windows:
22-
# runs-on: windows-latest
23-
# steps:
24-
# - uses: actions/checkout@v3
25-
# - name: Run tests for Windows
26-
# working-directory: ./canyon_sql
27-
# run: cargo test --verbose
28-
29-
# tests-macos:
30-
# runs-on: macos-latest
31-
# steps:
32-
# - uses: actions/checkout@v3
33-
# - name: Run tests for macOS
34-
# working-directory: ./canyon_sql
35-
# run: cargo test --verbose
36-
3713
gcov:
38-
runs-on: ubuntu-latest
39-
steps:
40-
- uses: actions/checkout@v3
41-
- name: Use nightly toolchain
42-
run: |
43-
rustup toolchain install nightly
44-
rustup override set nightly
45-
- name: Run tests
46-
run: cargo test --all-features --no-fail-fast
47-
env:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v3
17+
18+
- name: Use nightly toolchain
19+
run: |
20+
rustup toolchain install nightly
21+
rustup override set nightly
22+
23+
- name: Install grcov
24+
run: cargo install grcov
25+
26+
- name: Run tests
27+
env:
28+
CARGO_INCREMENTAL: '0'
29+
RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests'
30+
RUSTDOCFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests'
31+
run: |
32+
cargo test --all-features --no-fail-fast --target=x86_64-unknown-linux-gnu
33+
34+
- name: Generate code coverage report
35+
if: always()
36+
env:
4837
CARGO_INCREMENTAL: '0'
4938
RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests'
5039
RUSTDOCFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests'
51-
- uses: actions-rs/grcov@v0.1
52-
with:
53-
config: .github/workflows/configs/gcov-config.yml
54-
- name: Publish Test Results
55-
uses: EnricoMi/publish-unit-test-result-action@v2
56-
if: always()
57-
with:
58-
junit_files: "test-results/*.xml"
59-
- name: Show me directories
60-
if: always()
61-
run: |
62-
ls -la
63-
ls -la ./test-results
40+
run: |
41+
grcov . -s . --binary-path ./target/debug/ -t html --branch --ignore-not-existing -o ./target/debug/coverage
42+
grcov . -s . --binary-path ./target/debug/ -t cobertura --branch --ignore-not-existing -o ./target/debug/coverage/code_cov.xml
43+
44+
- name: Publish Test Results from XML
45+
uses: EnricoMi/publish-unit-test-result-action@v2
46+
if: always()
47+
with:
48+
junit_files: "./target/debug/coverage/code_cov.xml"
49+
50+
- name: Show me directories
51+
if: always()
52+
run: |
53+
ls -la ./target/debug
54+
ls -la ./target/debug/coverage
55+
ls -la ./target/debug/coverage/badges
56+
57+
- name: Upload
58+
uses: actions/upload-artifact@v3
59+
with:
60+
name: Event File
61+
path: ${{ github.event_path }}
62+
- name: Publish Test Results
63+
uses: actions/upload-artifact@v3
64+
with:
65+
name: Unit Test Results
66+
path: |
67+
./target/debug/coverage/code_cov.xml
68+
./target/debug/coverage/index.html
69+
70+
- name: Publish coverage report to GitHub Pages
71+
if: ${{ github.ref == 'refs/heads/main' }}
72+
uses: JamesIves/github-pages-deploy-action@v4
73+
with:
74+
folder: ./target/debug/coverage

0 commit comments

Comments
 (0)