mirror of
https://github.com/julia-actions/julia-buildpkg.git
synced 2026-02-18 03:56:54 +08:00
Turn runtest into buildpkg action
This commit is contained in:
12
README.md
12
README.md
@@ -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
|
## 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.
|
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:
|
And example workflow that uses this action might look like this:
|
||||||
|
|
||||||
```
|
```
|
||||||
@@ -34,8 +30,6 @@ jobs:
|
|||||||
- uses: julia-actions/setup-julia@latest
|
- uses: julia-actions/setup-julia@latest
|
||||||
with:
|
with:
|
||||||
version: ${{ matrix.julia-version }}
|
version: ${{ matrix.julia-version }}
|
||||||
|
- uses: julia-actions/julia-buildpkg@master
|
||||||
- uses: julia-actions/julia-runtest@master
|
- uses: julia-actions/julia-runtest@master
|
||||||
env:
|
|
||||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
|
||||||
COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
|
|
||||||
```
|
```
|
||||||
|
|||||||
13
action.yml
13
action.yml
@@ -1,15 +1,6 @@
|
|||||||
name: 'Run Julia package tests'
|
name: 'Run Pkg.build'
|
||||||
description: 'Run the tests in a Julia package'
|
description: 'Run the build step in a Julia package'
|
||||||
author: 'David Anthoff'
|
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:
|
runs:
|
||||||
using: 'node12'
|
using: 'node12'
|
||||||
main: 'lib/main.js'
|
main: 'lib/main.js'
|
||||||
|
|||||||
12
lib/main.js
12
lib/main.js
@@ -21,20 +21,8 @@ const exec = __importStar(require("@actions/exec"));
|
|||||||
function run() {
|
function run() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
try {
|
try {
|
||||||
const codecov = core.getInput('codecov');
|
|
||||||
const coveralls = core.getInput('coveralls');
|
|
||||||
// Run Pkg.build
|
// 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']);
|
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) {
|
catch (error) {
|
||||||
core.setFailed(error.message);
|
core.setFailed(error.message);
|
||||||
|
|||||||
2
package-lock.json
generated
2
package-lock.json
generated
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "julia-runtest",
|
"name": "julia-buildpkg",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "julia-runtest",
|
"name": "julia-buildpkg",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "Julia package test run action",
|
"description": "Julia package test run action",
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/julia-actions/julia-runtest.git"
|
"url": "git+https://github.com/julia-actions/julia-buildpkg.git"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"actions",
|
"actions",
|
||||||
|
|||||||
16
src/main.ts
16
src/main.ts
@@ -3,24 +3,8 @@ import * as exec from '@actions/exec'
|
|||||||
|
|
||||||
async function run() {
|
async function run() {
|
||||||
try {
|
try {
|
||||||
const codecov = core.getInput('codecov')
|
|
||||||
const coveralls = core.getInput('coveralls')
|
|
||||||
|
|
||||||
// Run Pkg.build
|
// 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'])
|
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) {
|
} catch (error) {
|
||||||
core.setFailed(error.message)
|
core.setFailed(error.message)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user