Skip to content
This repository was archived by the owner on Dec 13, 2025. It is now read-only.

Update GitHub Artifact Actions (major) #71

Update GitHub Artifact Actions (major)

Update GitHub Artifact Actions (major) #71

Workflow file for this run

name: Test
on:
push:
branches: [ master ]
pull_request:
paths:
- '.github/workflows/test.yml'
- '**/*.swift'
- 'Tests/**'
jobs:
test:
container:
image: swift
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Test with Code Coverage
run: swift test --enable-code-coverage --filter '^((?!ipv6).)*$'
- name: Report Codecov
run: |
llvm-cov report .build/debug/SwiftPublicIPPackageTests.xctest -instr-profile=.build/debug/codecov/default.profdata -use-color
- name: Export Codecov
run: |
mkdir -p coverage
llvm-cov export -format="lcov" .build/debug/SwiftPublicIPPackageTests.xctest -instr-profile .build/debug/codecov/default.profdata > ./coverage/lcov.info
- name: Convert Absolute Path to Relative Path
run: sed -i "s~${PWD}/~~g" ./coverage/lcov.info
- uses: actions/upload-artifact@v6
with:
name: lcov.info
path: ./coverage/lcov.info
retention-days: 1
codecov:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v7
with:
name: lcov.info
path: ./coverage/
- run: ls -R
- uses: HackingGate/lcov-reporter-action@a1c0d02b814fedd5aff86d9e7eac73834eb6e091
with:
lcov-base: ./coverage/lcov-base.info
lcov-file: ./coverage/lcov.info
- run: cat ./coverage/body.html
- uses: actions/github-script@v6
with:
script: |
fs = require('fs');
fs.readFile('./coverage/body.html', 'utf8', function (error,data) {
if (error) {
console.log(error)
}
if (context.eventName === "pull_request") {
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: data
})
} else if (context.eventName === "push") {
github.repos.createCommitComment({
commit_sha: context.sha,
owner: context.repo.owner,
repo: context.repo.repo,
body: data
})
}
});