init
This commit is contained in:
commit
51b4a0a824
27
.gitignore
vendored
Normal file
27
.gitignore
vendored
Normal file
|
@ -0,0 +1,27 @@
|
|||
# Logs
|
||||
logs
|
||||
*.log
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
|
||||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (http://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directory
|
||||
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
|
||||
node_modules
|
5
CHANGELOG.md
Normal file
5
CHANGELOG.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
# setup-zig change log
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
This project adheres to [Semantic Versioning](http://semver.org/).
|
74
CODE_OF_CONDUCT.md
Normal file
74
CODE_OF_CONDUCT.md
Normal file
|
@ -0,0 +1,74 @@
|
|||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
In the interest of fostering an open and welcoming environment, we as
|
||||
contributors and maintainers pledge to making participation in our project and
|
||||
our community a harassment-free experience for everyone, regardless of age, body
|
||||
size, disability, ethnicity, gender identity and expression, level of experience,
|
||||
nationality, personal appearance, race, religion, or sexual identity and
|
||||
orientation.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to creating a positive environment
|
||||
include:
|
||||
|
||||
* Using welcoming and inclusive language
|
||||
* Being respectful of differing viewpoints and experiences
|
||||
* Gracefully accepting constructive criticism
|
||||
* Focusing on what is best for the community
|
||||
* Showing empathy towards other community members
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery and unwelcome sexual attention or
|
||||
advances
|
||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or electronic
|
||||
address, without explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Our Responsibilities
|
||||
|
||||
Project maintainers are responsible for clarifying the standards of acceptable
|
||||
behavior and are expected to take appropriate and fair corrective action in
|
||||
response to any instances of unacceptable behavior.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or
|
||||
reject comments, commits, code, wiki edits, issues, and other contributions
|
||||
that are not aligned to this Code of Conduct, or to ban temporarily or
|
||||
permanently any contributor for other behaviors that they deem inappropriate,
|
||||
threatening, offensive, or harmful.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies both within project spaces and in public spaces
|
||||
when an individual is representing the project or its community. Examples of
|
||||
representing a project or community include using an official project e-mail
|
||||
address, posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event. Representation of a project may be
|
||||
further defined and clarified by project maintainers.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported by contacting the project team at renee@kooi.me. All
|
||||
complaints will be reviewed and investigated and will result in a response that
|
||||
is deemed necessary and appropriate to the circumstances. The project team is
|
||||
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||
Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good
|
||||
faith may face temporary or permanent repercussions as determined by other
|
||||
members of the project's leadership.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
||||
available at [https://contributor-covenant.org/version/1/4][version]
|
||||
|
||||
[homepage]: https://contributor-covenant.org
|
||||
[version]: https://contributor-covenant.org/version/1/4/
|
15
LICENSE.md
Normal file
15
LICENSE.md
Normal file
|
@ -0,0 +1,15 @@
|
|||
# [Apache License 2.0](https://spdx.org/licenses/Apache-2.0)
|
||||
|
||||
Copyright 2019 Renée Kooi <renee@kooi.me>
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
> http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
32
README.md
Normal file
32
README.md
Normal file
|
@ -0,0 +1,32 @@
|
|||
# setup-zig
|
||||
|
||||
Use the zig compiler in your Github Action
|
||||
|
||||
[Install](#install) - [Usage](#usage) - [License: Apache-2.0](#license)
|
||||
|
||||
[![npm][npm-image]][npm-url]
|
||||
[![travis][travis-image]][travis-url]
|
||||
[![standard][standard-image]][standard-url]
|
||||
|
||||
[npm-image]: https://img.shields.io/npm/v/setup-zig.svg?style=flat-square
|
||||
[npm-url]: https://www.npmjs.com/package/setup-zig
|
||||
[travis-image]: https://img.shields.io/travis/goto-bus-stop/setup-zig.svg?style=flat-square
|
||||
[travis-url]: https://travis-ci.org/goto-bus-stop/setup-zig
|
||||
[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square
|
||||
[standard-url]: http://npm.im/standard
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
npm install setup-zig
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var setupZig = require('setup-zig')
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[Apache-2.0](LICENSE.md)
|
44
index.js
Normal file
44
index.js
Normal file
|
@ -0,0 +1,44 @@
|
|||
const os = require('os')
|
||||
const path = require('path')
|
||||
const semver = require('semver')
|
||||
const actions = require('@actions/core')
|
||||
const cache = require('@actions/tool-cache')
|
||||
|
||||
async function downloadZig (version) {
|
||||
const host = {
|
||||
linux: 'linux-x86_64',
|
||||
darwin: 'macos-x86_64',
|
||||
win32: 'windows-x86_64'
|
||||
}[os.platform()]
|
||||
const ext = {
|
||||
linux: 'tar.xz',
|
||||
darwin: 'tar.xz',
|
||||
win32: 'zip'
|
||||
}[os.platform()]
|
||||
|
||||
const variantName = `zig-${host}-${version}`
|
||||
const url = `https://github.com/ziglang/zig/releases/download/${version}/${variantName}.${ext}`
|
||||
|
||||
const downloadPath = await cache.downloadTool(url)
|
||||
const zigPath = ext === 'zip'
|
||||
? await cache.extractZip(downloadPath)
|
||||
: await cache.extractTar(downloadPath, undefined, 'x')
|
||||
|
||||
const binPath = path.join(zigPath, variantName)
|
||||
return cache.cacheDir(binPath, 'zig', version)
|
||||
}
|
||||
|
||||
async function main () {
|
||||
const version = actions.getInput('version') || '0.5.0'
|
||||
if (semver.lt(version, '0.3.0')) {
|
||||
actions.setFailed('This action does not work with Zig 0.1.0 and Zig 0.2.0')
|
||||
return
|
||||
}
|
||||
|
||||
const zigPath = await downloadZig(version)
|
||||
|
||||
// Add the `zig` binary to the $PATH
|
||||
actions.addPath(zigPath)
|
||||
}
|
||||
|
||||
main()
|
34
package.json
Normal file
34
package.json
Normal file
|
@ -0,0 +1,34 @@
|
|||
{
|
||||
"name": "setup-zig",
|
||||
"description": "Use the zig compiler in your Github Action",
|
||||
"version": "0.0.0",
|
||||
"author": "Renée Kooi <renee@kooi.me>",
|
||||
"bugs": {
|
||||
"url": "https://github.com/goto-bus-stop/setup-zig/issues"
|
||||
},
|
||||
"devDependencies": {
|
||||
"standard": "^14.3.1",
|
||||
"tape": "^4.10.0"
|
||||
},
|
||||
"homepage": "https://github.com/goto-bus-stop/setup-zig",
|
||||
"keywords": [
|
||||
"Actions",
|
||||
"Github",
|
||||
"zig",
|
||||
"ziglang"
|
||||
],
|
||||
"license": "Apache-2.0",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/goto-bus-stop/setup-zig.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "standard && node test"
|
||||
},
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.1.3",
|
||||
"@actions/tool-cache": "^1.1.2",
|
||||
"semver": "^6.3.0"
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user