Turn runtest into buildpkg action

This commit is contained in:
David Anthoff
2019-09-23 13:58:15 -07:00
parent a7eaa22ec9
commit 38734de96b
6 changed files with 8 additions and 51 deletions

View File

@@ -1,15 +1,11 @@
# julia-runtest Action
# julia-buildpkg Action
This action runs the tests in a Julia package and uploads coverage results to [Coveralls](https://coveralls.io/) and [Codecov](https://codecov.io/).
This action runs the build step in a Julia package.
## Usage
Julia needs to be installed before this action can run. This can easily be achieved with the [setup-julia](https://github.com/marketplace/actions/setup-julia-environment) action.
This action accepts two inpus: `codecov` (with values `true` or `false`) and `coveralls` (with values `true` or `false`). These inputs control whether coverage results are automatically uploaded to the respective service. Both inputs have a default value of `true`.
Uploads to [Coveralls](https://coveralls.io/) or [Codecov](https://codecov.io/) only work if an upload token for the respective service is stored as a Github Actions secret and made available to the action. These tokens need to be stored in the environment variables `CODECOV_TOKEN` and `COVERALLS_TOKEN`.
And example workflow that uses this action might look like this:
```
@@ -34,8 +30,6 @@ jobs:
- uses: julia-actions/setup-julia@latest
with:
version: ${{ matrix.julia-version }}
- uses: julia-actions/julia-buildpkg@master
- uses: julia-actions/julia-runtest@master
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
```

View File

@@ -1,15 +1,6 @@
name: 'Run Julia package tests'
description: 'Run the tests in a Julia package'
name: 'Run Pkg.build'
description: 'Run the build step in a Julia package'
author: 'David Anthoff'
inputs:
codecov:
description: 'Coverage results upload to codecov.'
required: false
default: 'true'
coveralls:
description: 'Coverage results upload to coveralls.'
required: false
default: 'true'
runs:
using: 'node12'
main: 'lib/main.js'

View File

@@ -21,20 +21,8 @@ const exec = __importStar(require("@actions/exec"));
function run() {
return __awaiter(this, void 0, void 0, function* () {
try {
const codecov = core.getInput('codecov');
const coveralls = core.getInput('coveralls');
// Run Pkg.build
yield exec.exec('julia', ['--color=yes', '--project', '-e', 'using Pkg; if VERSION >= v\"1.1.0-rc1\"; Pkg.build(verbose=true); else Pkg.build(); end']);
// Run Pkg.test
yield exec.exec('julia', ['--color=yes', '--check-bounds=yes', '--project', '-e', 'using Pkg; Pkg.test(coverage=true)']);
if (codecov == 'true') {
// await exec.exec('julia', ['--color=yes', '-e', 'using Pkg; Pkg.add("Coverage"); using Coverage; Codecov.submit(process_folder())'])
yield exec.exec('julia', ['--color=yes', '-e', 'using Pkg; Pkg.add(PackageSpec(url="https://github.com/davidanthoff/Coverage.jl.git", rev="githubactions")); using Coverage; Codecov.submit(process_folder())']);
}
if (coveralls == 'true') {
// await exec.exec('julia', ['--color=yes', '-e', 'using Pkg; Pkg.add("Coverage"); using Coverage; Coveralls.submit(process_folder())'])
yield exec.exec('julia', ['--color=yes', '-e', 'using Pkg; Pkg.add(PackageSpec(url="https://github.com/davidanthoff/Coverage.jl.git", rev="githubactions")); using Coverage; Coveralls.submit(process_folder())']);
}
}
catch (error) {
core.setFailed(error.message);

2
package-lock.json generated
View File

@@ -1,5 +1,5 @@
{
"name": "julia-runtest",
"name": "julia-buildpkg",
"version": "0.1.0",
"lockfileVersion": 1,
"requires": true,

View File

@@ -1,5 +1,5 @@
{
"name": "julia-runtest",
"name": "julia-buildpkg",
"version": "0.1.0",
"private": true,
"description": "Julia package test run action",
@@ -10,7 +10,7 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/julia-actions/julia-runtest.git"
"url": "git+https://github.com/julia-actions/julia-buildpkg.git"
},
"keywords": [
"actions",

View File

@@ -3,24 +3,8 @@ import * as exec from '@actions/exec'
async function run() {
try {
const codecov = core.getInput('codecov')
const coveralls = core.getInput('coveralls')
// Run Pkg.build
await exec.exec('julia', ['--color=yes', '--project', '-e', 'using Pkg; if VERSION >= v\"1.1.0-rc1\"; Pkg.build(verbose=true); else Pkg.build(); end'])
// Run Pkg.test
await exec.exec('julia', ['--color=yes', '--check-bounds=yes', '--project', '-e', 'using Pkg; Pkg.test(coverage=true)'])
if(codecov=='true') {
// await exec.exec('julia', ['--color=yes', '-e', 'using Pkg; Pkg.add("Coverage"); using Coverage; Codecov.submit(process_folder())'])
await exec.exec('julia', ['--color=yes', '-e', 'using Pkg; Pkg.add(PackageSpec(url="https://github.com/davidanthoff/Coverage.jl.git", rev="githubactions")); using Coverage; Codecov.submit(process_folder())'])
}
if(coveralls=='true') {
// await exec.exec('julia', ['--color=yes', '-e', 'using Pkg; Pkg.add("Coverage"); using Coverage; Coveralls.submit(process_folder())'])
await exec.exec('julia', ['--color=yes', '-e', 'using Pkg; Pkg.add(PackageSpec(url="https://github.com/davidanthoff/Coverage.jl.git", rev="githubactions")); using Coverage; Coveralls.submit(process_folder())'])
}
} catch (error) {
core.setFailed(error.message)
}