mirror of
https://github.com/julia-actions/julia-processcoverage.git
synced 2026-02-15 04:26:57 +08:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
03114f09f1 | ||
|
|
605cc6b85a | ||
|
|
6e018a9646 | ||
|
|
a89a6dbd45 | ||
|
|
52227d0278 | ||
|
|
f555f2b0e5 | ||
|
|
40c067cf87 | ||
|
|
6cb1ebb8b8 |
1
.github/CODEOWNERS
vendored
Normal file
1
.github/CODEOWNERS
vendored
Normal file
@@ -0,0 +1 @@
|
||||
* @julia-actions/reviewers
|
||||
33
.github/workflows/backup.yml
vendored
Normal file
33
.github/workflows/backup.yml
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
name: Backup
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '5 4 * * 0'
|
||||
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
backup:
|
||||
runs-on: ubuntu-20.04
|
||||
|
||||
steps:
|
||||
- name: Configure cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
${{ env.GITHUB_WORKSPACE }}
|
||||
~/.cache/restic
|
||||
key: ${{ runner.os }}
|
||||
|
||||
- name: Install the correct Python version
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: '3.x'
|
||||
|
||||
- name: Run backup action
|
||||
uses: julia-actions/restic-action@main
|
||||
env: # Options: https://restic.readthedocs.io/en/latest/040_backup.html#environment-variables
|
||||
RESTIC_REPOSITORY: b2:${{ secrets.B2_BUCKET }}:${{ github.repository }}
|
||||
RESTIC_PASSWORD: ${{ secrets.RESTIC_PASSWORD }}
|
||||
B2_ACCOUNT_ID: ${{ secrets.B2_ACCOUNT_ID }}
|
||||
B2_ACCOUNT_KEY: ${{ secrets.B2_ACCOUNT_KEY }}
|
||||
117
README.md
117
README.md
@@ -2,100 +2,35 @@
|
||||
<a href="https://github.com/actions/typescript-action/actions"><img alt="typescript-action status" src="https://github.com/actions/typescript-action/workflows/build-test/badge.svg"></a>
|
||||
</p>
|
||||
|
||||
# Create a JavaScript Action using TypeScript
|
||||
## Usage
|
||||
|
||||
Use this template to bootstrap the creation of a JavaScript action.:rocket:
|
||||
|
||||
This template includes compilication support, tests, a validation workflow, publishing, and versioning guidance.
|
||||
|
||||
If you are new, there's also a simpler introduction. See the [Hello World JavaScript Action](https://github.com/actions/hello-world-javascript-action)
|
||||
|
||||
## Create an action from this template
|
||||
|
||||
Click the `Use this Template` and provide the new repo details for your action
|
||||
|
||||
## Code in Master
|
||||
|
||||
Install the dependencies
|
||||
```bash
|
||||
$ npm install
|
||||
```
|
||||
|
||||
Build the typescript and package it for distribution
|
||||
```bash
|
||||
$ npm run build && npm run pack
|
||||
```
|
||||
|
||||
Run the tests :heavy_check_mark:
|
||||
```bash
|
||||
$ npm test
|
||||
|
||||
PASS ./index.test.js
|
||||
✓ throws invalid number (3ms)
|
||||
✓ wait 500 ms (504ms)
|
||||
✓ test runs (95ms)
|
||||
|
||||
...
|
||||
```
|
||||
|
||||
## Change action.yml
|
||||
|
||||
The action.yml contains defines the inputs and output for your action.
|
||||
|
||||
Update the action.yml with your name, description, inputs and outputs for your action.
|
||||
|
||||
See the [documentation](https://help.github.com/en/articles/metadata-syntax-for-github-actions)
|
||||
|
||||
## Change the Code
|
||||
|
||||
Most toolkit and CI/CD operations involve async operations so the action is run in an async function.
|
||||
|
||||
```javascript
|
||||
import * as core from '@actions/core';
|
||||
...
|
||||
|
||||
async function run() {
|
||||
try {
|
||||
...
|
||||
}
|
||||
catch (error) {
|
||||
core.setFailed(error.message);
|
||||
}
|
||||
}
|
||||
|
||||
run()
|
||||
```
|
||||
|
||||
See the [toolkit documentation](https://github.com/actions/toolkit/blob/master/README.md#packages) for the various packages.
|
||||
|
||||
## Publish to a distribution branch
|
||||
|
||||
Actions are run from GitHub repos so we will checkin the packed dist folder.
|
||||
|
||||
Then run [ncc](https://github.com/zeit/ncc) and push the results:
|
||||
```bash
|
||||
$ npm run pack
|
||||
$ git add dist
|
||||
$ git commit -a -m "prod dependencies"
|
||||
$ git push origin releases/v1
|
||||
```
|
||||
|
||||
Your action is now published! :rocket:
|
||||
|
||||
See the [versioning documentation](https://github.com/actions/toolkit/blob/master/docs/action-versioning.md)
|
||||
|
||||
## Validate
|
||||
|
||||
You can now validate the action by referencing `./` in a workflow in your repo (see [test.yml](.github/workflows/test.yml)])
|
||||
See [PkgTemplates.jl](https://github.com/invenia/PkgTemplates.jl/blob/master/test/fixtures/AllPlugins/.github/workflows/CI.yml) for a complete example.
|
||||
|
||||
```yaml
|
||||
uses: ./
|
||||
with:
|
||||
milliseconds: 1000
|
||||
|
||||
- uses: julia-actions/julia-processcoverage@v1
|
||||
- uses: codecov/codecov-action@v2
|
||||
with:
|
||||
files: lcov.info
|
||||
```
|
||||
|
||||
See the [actions tab](https://github.com/actions/javascript-action/actions) for runs of this action! :rocket:
|
||||
One can also specify the directory or directories (comma separated) to use via the `directories` input (which defaults to `src,ext`). E.g.
|
||||
```yaml
|
||||
|
||||
## Usage:
|
||||
|
||||
After testing you can [create a v1 tag](https://github.com/actions/toolkit/blob/master/docs/action-versioning.md) to reference the stable and latest V1 action
|
||||
- uses: julia-actions/julia-processcoverage@v1
|
||||
with:
|
||||
directories: src,ext,examples
|
||||
- uses: codecov/codecov-action@v2
|
||||
with:
|
||||
files: lcov.info
|
||||
```
|
||||
instructs the action to look for coverage information in `src`, `ext`, and an `examples` folder. Likewise, use
|
||||
```yaml
|
||||
- uses: julia-actions/julia-processcoverage@v1
|
||||
with:
|
||||
directories: path/to/subdir/package/src
|
||||
- uses: codecov/codecov-action@v2
|
||||
with:
|
||||
files: lcov.info
|
||||
```
|
||||
to get coverage information from a package in a subdirectory of the repo.
|
||||
|
||||
@@ -6,8 +6,16 @@ branding:
|
||||
icon: 'settings'
|
||||
color: 'gray-dark'
|
||||
|
||||
inputs:
|
||||
directories:
|
||||
description: 'Comma-separated list of directories to look for coverage information (e.g. `src,examples`)'
|
||||
required: false
|
||||
default: 'src,ext'
|
||||
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
- run: julia --color=yes "$GITHUB_ACTION_PATH"/main.jl
|
||||
shell: bash
|
||||
env:
|
||||
INPUT_DIRECTORIES: ${{ inputs.directories }}
|
||||
|
||||
15
main.jl
15
main.jl
@@ -6,6 +6,15 @@ Pkg.add(PackageSpec(name="CoverageTools"))
|
||||
|
||||
using CoverageTools
|
||||
|
||||
pf = process_folder()
|
||||
|
||||
LCOV.writefile("lcov.info", pf)
|
||||
directories = get(ENV, "INPUT_DIRECTORIES", "src,ext")
|
||||
dirs = filter!(!isempty, split(directories, ","))
|
||||
for dir in dirs
|
||||
if dir == "ext"
|
||||
continue # Silently skip this directory
|
||||
elseif !isdir(dir)
|
||||
error("directory \"$dir\" not found!")
|
||||
end
|
||||
end
|
||||
filter!(isdir, dirs)
|
||||
pfs = mapreduce(process_folder, vcat, dirs)
|
||||
LCOV.writefile("lcov.info", pfs)
|
||||
|
||||
Reference in New Issue
Block a user