8 Commits
v1.1.0 ... v1.2

Author SHA1 Message Date
Oscar Dowson
03114f09f1 Fix when input directories are not found (#20)
* Fix when input directories are not found

* Update main.jl

Co-authored-by: Ian Butterworth <i.r.butterworth@gmail.com>

Co-authored-by: Ian Butterworth <i.r.butterworth@gmail.com>
2022-12-21 20:01:07 -05:00
Fredrik Ekre
605cc6b85a RFC: change default directory to src,ext. (#19) 2022-12-21 23:56:53 +01:00
Curtis Vogt
6e018a9646 Use codecov-action@v2 in examples (#11) 2021-10-26 16:35:58 +02:00
Jim Garrison
a89a6dbd45 Update README link to PkgTemplates.jl (#10)
The target file was renamed in https://github.com/invenia/PkgTemplates.jl/pull/252
2021-10-01 10:08:13 +02:00
Eric Hanson
52227d0278 Add directories input (#8)
Co-authored-by: Sascha Mann <git@mail.saschamann.eu>
Co-authored-by: Michael Schlottke-Lakemper <michael@sloede.com>
2021-06-05 12:04:57 +02:00
Sascha Mann
f555f2b0e5 Add automated backup workflow (#7) 2020-12-19 14:45:37 +01:00
Sascha Mann
40c067cf87 Make the @julia-actions/reviewers the global code owners for this repo 2020-12-14 14:35:01 +01:00
Amin Yahyaabadi
6cb1ebb8b8 Add README (#5) 2020-08-14 15:02:09 +02:00
5 changed files with 80 additions and 94 deletions

1
.github/CODEOWNERS vendored Normal file
View File

@@ -0,0 +1 @@
* @julia-actions/reviewers

33
.github/workflows/backup.yml vendored Normal file
View 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
View File

@@ -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.

View File

@@ -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
View File

@@ -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)