mirror of
https://github.com/XAMPPRocky/tokei
synced 2024-06-30 22:24:25 +00:00
Create Ferris' Mean Bean Machine
Seperate project coming soon
This commit is contained in:
parent
458af76826
commit
2d2597837d
193
.github/workflows/mean_bean_ci.yml
vendored
Normal file
193
.github/workflows/mean_bean_ci.yml
vendored
Normal file
|
@ -0,0 +1,193 @@
|
|||
name: Mean Bean CI
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
# This job downloads and stores `cross` as an artifact, so that it can be
|
||||
# redownloaded across all of the jobs. Currently this copied pasted between
|
||||
# `ci.yml` and `deploy.yml`. Make sure to update both places when making
|
||||
# changes.
|
||||
install-cross:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
with:
|
||||
depth: 50
|
||||
- uses: ./actions/get-github-release
|
||||
id: cross
|
||||
with:
|
||||
owner: rust-embedded
|
||||
repo: cross
|
||||
matches: ${{ matrix.platform }}
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
- uses: actions/upload-artifact@v1
|
||||
with:
|
||||
name: cross-${{ matrix.platform }}
|
||||
path: ${{ steps.cross.outputs.install_path }}
|
||||
strategy:
|
||||
matrix:
|
||||
platform: [linux-musl, apple-darwin]
|
||||
|
||||
windows:
|
||||
runs-on: windows-latest
|
||||
# Windows technically doesn't need this, but if we don't block windows on it
|
||||
# some of the windows jobs could fill up the concurrent job queue before
|
||||
# one of the install-cross jobs has started, so this makes sure all
|
||||
# artifacts are downloaded first.
|
||||
needs: install-cross
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
depth: 50
|
||||
- run: ci/set_rust_version.bash ${{ matrix.channel }} ${{ matrix.target }}
|
||||
- run: ci/build.bash cargo ${{ matrix.target }}
|
||||
- run: ci/test.bash cargo ${{ matrix.target }}
|
||||
|
||||
strategy:
|
||||
fail-fast: true
|
||||
matrix:
|
||||
channel: [stable, beta, nightly]
|
||||
target:
|
||||
# MSVC
|
||||
- i686-pc-windows-msvc
|
||||
- x86_64-pc-windows-msvc
|
||||
# GNU: You typically only need to test Windows GNU if you're
|
||||
# specifically targetting it, and it can cause issues with some
|
||||
# dependencies if you're not so it's disabled by self.
|
||||
# - i686-pc-windows-gnu
|
||||
# - x86_64-pc-windows-gnu
|
||||
|
||||
macos:
|
||||
runs-on: macos-latest
|
||||
needs: install-cross
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
depth: 50
|
||||
|
||||
- uses: actions/download-artifact@v1
|
||||
with:
|
||||
name: cross-apple-darwin
|
||||
path: /usr/local/bin/
|
||||
|
||||
- run: chmod +x /usr/local/bin/cross
|
||||
|
||||
- run: ci/set_rust_version.bash ${{ matrix.channel }} ${{ matrix.target }}
|
||||
- run: ci/build.bash cross ${{ matrix.target }}
|
||||
# Only test on macOS platforms since we can't simulate the others.
|
||||
- run: ci/test.bash cross ${{ matrix.target }}
|
||||
if: matrix.target == 'x86_64-apple-darwin'
|
||||
|
||||
strategy:
|
||||
fail-fast: true
|
||||
matrix:
|
||||
channel: [stable, beta, nightly]
|
||||
target:
|
||||
# macOS
|
||||
- x86_64-apple-darwin
|
||||
# iOS
|
||||
- aarch64-apple-ios
|
||||
- armv7-apple-ios
|
||||
- armv7s-apple-ios
|
||||
- i386-apple-ios
|
||||
- x86_64-apple-ios
|
||||
# There are no beta or nightly versions of these platforms available.
|
||||
exclude:
|
||||
- target: armv7-apple-ios
|
||||
channel: beta
|
||||
- target: armv7-apple-ios
|
||||
channel: nightly
|
||||
- target: armv7s-apple-ios
|
||||
channel: beta
|
||||
- target: armv7s-apple-ios
|
||||
channel: nightly
|
||||
- target: i386-apple-ios
|
||||
channel: beta
|
||||
- target: i386-apple-ios
|
||||
channel: nightly
|
||||
|
||||
linux:
|
||||
runs-on: ubuntu-latest
|
||||
needs: install-cross
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
depth: 50
|
||||
|
||||
- name: Download Cross
|
||||
uses: actions/download-artifact@v1
|
||||
with:
|
||||
name: cross-linux-musl
|
||||
path: /tmp/
|
||||
- run: chmod +x /tmp/cross
|
||||
- run: ci/set_rust_version.bash ${{ matrix.channel }} ${{ matrix.target }}
|
||||
- run: ci/build.bash /tmp/cross ${{ matrix.target }}
|
||||
# These targets have issues with being tested so they are disabled
|
||||
# by default. You can try disabling to see if they work for
|
||||
# your project.
|
||||
- run: ci/test.bash /tmp/cross ${{ matrix.target }}
|
||||
if: |
|
||||
!contains(matrix.target, 'android') &&
|
||||
!contains(matrix.target, 'bsd') &&
|
||||
!contains(matrix.target, 'solaris') &&
|
||||
matrix.target != 'armv5te-unknown-linux-musleabi' &&
|
||||
matrix.target != 'sparc64-unknown-linux-gnu'
|
||||
|
||||
strategy:
|
||||
fail-fast: true
|
||||
matrix:
|
||||
channel: [stable, beta, nightly]
|
||||
target:
|
||||
# WASM, off by default as most rust projects aren't compatible yet.
|
||||
# - wasm32-unknown-emscripten
|
||||
# Linux
|
||||
- aarch64-unknown-linux-gnu
|
||||
- aarch64-unknown-linux-musl
|
||||
- arm-unknown-linux-gnueabi
|
||||
- arm-unknown-linux-gnueabihf
|
||||
- arm-unknown-linux-musleabi
|
||||
- arm-unknown-linux-musleabihf
|
||||
- armv5te-unknown-linux-musleabi
|
||||
- armv7-unknown-linux-gnueabihf
|
||||
- armv7-unknown-linux-musleabihf
|
||||
- i586-unknown-linux-gnu
|
||||
- i586-unknown-linux-musl
|
||||
- i686-unknown-linux-gnu
|
||||
- i686-unknown-linux-musl
|
||||
- mips-unknown-linux-gnu
|
||||
- mips-unknown-linux-musl
|
||||
- mips64-unknown-linux-gnuabi64
|
||||
- mips64el-unknown-linux-gnuabi64
|
||||
- mipsel-unknown-linux-gnu
|
||||
- mipsel-unknown-linux-musl
|
||||
- powerpc-unknown-linux-gnu
|
||||
- powerpc64-unknown-linux-gnu
|
||||
- powerpc64le-unknown-linux-gnu
|
||||
- s390x-unknown-linux-gnu
|
||||
- x86_64-unknown-linux-gnu
|
||||
- x86_64-unknown-linux-musl
|
||||
- sparc64-unknown-linux-gnu
|
||||
# Android
|
||||
- aarch64-linux-android
|
||||
- arm-linux-androideabi
|
||||
- armv7-linux-androideabi
|
||||
- i686-linux-android
|
||||
- x86_64-linux-android
|
||||
# *BSD
|
||||
# The FreeBSD targets can have issues linking so they are disabled
|
||||
# by default.
|
||||
# - i686-unknown-freebsd
|
||||
# - x86_64-unknown-freebsd
|
||||
- x86_64-unknown-netbsd
|
||||
# DragonFly (Doesn't currently work)
|
||||
# - x86_64-unknown-dragonfly
|
||||
# Solaris
|
||||
- sparcv9-sun-solaris
|
||||
- x86_64-sun-solaris
|
||||
# Bare Metal
|
||||
# These are no-std embedded targets, so they will only build if your
|
||||
# crate is `no_std` compatible.
|
||||
# - thumbv6m-none-eabi
|
||||
# - thumbv7em-none-eabi
|
||||
# - thumbv7em-none-eabihf
|
||||
# - thumbv7m-none-eabi
|
199
.github/workflows/mean_bean_deploy.yml
vendored
Normal file
199
.github/workflows/mean_bean_deploy.yml
vendored
Normal file
|
@ -0,0 +1,199 @@
|
|||
on:
|
||||
push:
|
||||
# Sequence of patterns matched against refs/tags
|
||||
tags:
|
||||
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
|
||||
|
||||
name: Mean Bean Deploy
|
||||
env:
|
||||
BIN: tokei
|
||||
|
||||
jobs:
|
||||
# This job downloads and stores `cross` as an artifact, so that it can be
|
||||
# redownloaded across all of the jobs. Currently this copied pasted between
|
||||
# `ci.yml` and `deploy.yml`. Make sure to update both places when making
|
||||
# changes.
|
||||
install-cross:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
with:
|
||||
depth: 50
|
||||
- uses: ./actions/get-github-release
|
||||
id: cross
|
||||
with:
|
||||
owner: rust-embedded
|
||||
repo: cross
|
||||
matches: ${{ matrix.platform }}
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
- uses: actions/upload-artifact@v1
|
||||
with:
|
||||
name: cross-${{ matrix.platform }}
|
||||
path: ${{ steps.cross.outputs.install_path }}
|
||||
strategy:
|
||||
matrix:
|
||||
platform: [linux-musl, apple-darwin]
|
||||
|
||||
windows:
|
||||
runs-on: windows-latest
|
||||
needs: install-cross
|
||||
strategy:
|
||||
matrix:
|
||||
target:
|
||||
# MSVC
|
||||
- i686-pc-windows-msvc
|
||||
- x86_64-pc-windows-msvc
|
||||
# GNU
|
||||
# - i686-pc-windows-gnu
|
||||
# - x86_64-pc-windows-gnu
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- run: bash ci/set_rust_version.bash stable ${{ matrix.target }}
|
||||
- run: bash ci/build.bash cargo ${{ matrix.target }} RELEASE
|
||||
- run: |
|
||||
cd ./target/${{ matrix.target }}/release/
|
||||
7z a "${{ env.BIN }}.zip" "${{ env.BIN }}.exe"
|
||||
mv "${{ env.BIN }}.zip" $GITHUB_WORKSPACE
|
||||
shell: bash
|
||||
# We're using using a fork of `actions/create-release` that detects
|
||||
# whether a release is already available or not first.
|
||||
- uses: XAMPPRocky/create-release@v1.0.2
|
||||
id: create_release
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ github.ref }}
|
||||
release_name: ${{ github.ref }}
|
||||
# Draft should **always** be false. GitHub doesn't provide a way to
|
||||
# get draft releases from its API, so there's no point using it.
|
||||
draft: false
|
||||
prerelease: true
|
||||
- uses: actions/upload-release-asset@v1
|
||||
id: upload-release-asset
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: ${{ env.BIN }}.zip
|
||||
asset_name: ${{ env.BIN }}-${{ matrix.target }}.zip
|
||||
asset_content_type: application/zip
|
||||
|
||||
macos:
|
||||
runs-on: macos-latest
|
||||
needs: install-cross
|
||||
strategy:
|
||||
matrix:
|
||||
target:
|
||||
# macOS
|
||||
- x86_64-apple-darwin
|
||||
# iOS
|
||||
# - aarch64-apple-ios
|
||||
# - armv7-apple-ios
|
||||
# - armv7s-apple-ios
|
||||
# - i386-apple-ios
|
||||
# - x86_64-apple-ios
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/download-artifact@v1
|
||||
with:
|
||||
name: cross-apple-darwin
|
||||
path: /usr/local/bin/
|
||||
- run: chmod +x /usr/local/bin/cross
|
||||
|
||||
- run: ci/set_rust_version.bash stable ${{ matrix.target }}
|
||||
- run: ci/build.bash cross ${{ matrix.target }} RELEASE
|
||||
- run: tar -czvf ${{ env.BIN }}.tar.gz --directory=target/${{ matrix.target }}/release ${{ env.BIN }}
|
||||
- uses: XAMPPRocky/create-release@v1.0.2
|
||||
id: create_release
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ github.ref }}
|
||||
release_name: ${{ github.ref }}
|
||||
draft: false
|
||||
prerelease: true
|
||||
- uses: actions/upload-release-asset@v1
|
||||
id: upload-release-asset
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: ${{ env.BIN }}.tar.gz
|
||||
asset_name: ${{ env.BIN }}-${{ matrix.target }}.tar.gz
|
||||
asset_content_type: application/gzip
|
||||
|
||||
linux:
|
||||
runs-on: ubuntu-latest
|
||||
needs: install-cross
|
||||
strategy:
|
||||
matrix:
|
||||
target:
|
||||
# WASM, off by default as most rust projects aren't compatible yet.
|
||||
# - wasm32-unknown-emscripten
|
||||
# Linux
|
||||
- aarch64-unknown-linux-gnu
|
||||
- arm-unknown-linux-gnueabi
|
||||
- armv7-unknown-linux-gnueabihf
|
||||
- i686-unknown-linux-gnu
|
||||
- i686-unknown-linux-musl
|
||||
- mips-unknown-linux-gnu
|
||||
- mips64-unknown-linux-gnuabi64
|
||||
- mips64el-unknown-linux-gnuabi64
|
||||
- mipsel-unknown-linux-gnu
|
||||
- powerpc-unknown-linux-gnu
|
||||
- powerpc64-unknown-linux-gnu
|
||||
- powerpc64le-unknown-linux-gnu
|
||||
- s390x-unknown-linux-gnu
|
||||
- x86_64-unknown-linux-gnu
|
||||
- x86_64-unknown-linux-musl
|
||||
# Android
|
||||
- aarch64-linux-android
|
||||
- arm-linux-androideabi
|
||||
- armv7-linux-androideabi
|
||||
- i686-linux-android
|
||||
- x86_64-linux-android
|
||||
# *BSD
|
||||
# The FreeBSD targets can have issues linking so they are disabled
|
||||
# by default.
|
||||
# - i686-unknown-freebsd
|
||||
# - x86_64-unknown-freebsd
|
||||
- x86_64-unknown-netbsd
|
||||
# Solaris
|
||||
- sparcv9-sun-solaris
|
||||
# Bare Metal
|
||||
# These are no-std embedded targets, so they will only build if your
|
||||
# crate is `no_std` compatible.
|
||||
# - thumbv6m-none-eabi
|
||||
# - thumbv7em-none-eabi
|
||||
# - thumbv7em-none-eabihf
|
||||
# - thumbv7m-none-eabi
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/download-artifact@v1
|
||||
with:
|
||||
name: cross-linux-musl
|
||||
path: /tmp/
|
||||
- run: chmod +x /tmp/cross
|
||||
|
||||
- run: ci/set_rust_version.bash stable ${{ matrix.target }}
|
||||
- run: ci/build.bash /tmp/cross ${{ matrix.target }} RELEASE
|
||||
- run: tar -czvf ${{ env.BIN }}.tar.gz --directory=target/${{ matrix.target }}/release ${{ env.BIN }}
|
||||
- uses: XAMPPRocky/create-release@v1.0.2
|
||||
id: create_release
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ github.ref }}
|
||||
release_name: ${{ github.ref }}
|
||||
draft: false
|
||||
prerelease: true
|
||||
- name: Upload Release Asset
|
||||
id: upload-release-asset
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: ${{ env.BIN }}.tar.gz
|
||||
asset_name: ${{ env.BIN }}-${{ matrix.target }}.tar.gz
|
||||
asset_content_type: application/gzip
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -6,3 +6,4 @@ src/test
|
|||
*.rustfmt
|
||||
.DS_Store
|
||||
.tokeirc
|
||||
node_modules
|
||||
|
|
|
@ -23,7 +23,6 @@ yaml = ["serde_yaml"]
|
|||
[profile.release]
|
||||
lto = true
|
||||
panic = "abort"
|
||||
debug = true
|
||||
|
||||
[badges.appveyor]
|
||||
repository = "XAMPPRocky/tokei"
|
||||
|
|
42
actions/get-github-release/README.md
Normal file
42
actions/get-github-release/README.md
Normal file
|
@ -0,0 +1,42 @@
|
|||
# run-github-release
|
||||
|
||||
The `run-github-release` action allows you to run any binary release on GitHub.
|
||||
See [`actions.yml`] for configuration options.
|
||||
|
||||
[`actions.yml`]: ./actions.yml
|
||||
|
||||
## Example
|
||||
This example builds an mdbook project on linux.
|
||||
|
||||
```yaml
|
||||
- uses: rust-lang/simpleinfra/github-actions/run-github-release@master
|
||||
with:
|
||||
args: build
|
||||
regex: unknown-linux-gnu
|
||||
repo: mdbook
|
||||
token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
```
|
||||
|
||||
## Development
|
||||
|
||||
The action is written in NodeJS 12, and you can install the dependencies with:
|
||||
|
||||
```
|
||||
npm install
|
||||
```
|
||||
|
||||
### Running
|
||||
|
||||
```
|
||||
npm start
|
||||
```
|
||||
|
||||
GitHub Actions requires all the dependencies to be committed, so before
|
||||
creating a commit you need to run:
|
||||
|
||||
```
|
||||
npm run build
|
||||
```
|
||||
|
||||
The command will bundle everything in `dist/index.js`. That file will need to
|
||||
be committed.
|
23
actions/get-github-release/action.yml
Normal file
23
actions/get-github-release/action.yml
Normal file
|
@ -0,0 +1,23 @@
|
|||
name: Get GitHub Release
|
||||
description: Installs the latest binary from GitHub Releases.
|
||||
|
||||
inputs:
|
||||
owner:
|
||||
description: The owner of the GitHub repository e.g. `rust-lang`
|
||||
required: true
|
||||
repo:
|
||||
description: The name of the repository containing the releases.
|
||||
required: true
|
||||
matches:
|
||||
description: The regex to match against the name of the asset release.
|
||||
required: true
|
||||
token:
|
||||
description: GitHub token for authenication.
|
||||
required: true
|
||||
install_path:
|
||||
description: The path to install the binary. Defaults to /tmp/<repo name>
|
||||
required: false
|
||||
|
||||
runs:
|
||||
using: node12
|
||||
main: dist/index.js
|
1
actions/get-github-release/dist/index.js
vendored
Normal file
1
actions/get-github-release/dist/index.js
vendored
Normal file
File diff suppressed because one or more lines are too long
13
actions/get-github-release/index.js
Normal file
13
actions/get-github-release/index.js
Normal file
|
@ -0,0 +1,13 @@
|
|||
// GitHub Actions script.
|
||||
const actions = require('@actions/core')
|
||||
|
||||
const { getGitHubRelease } = require('./lib.js')
|
||||
|
||||
// Configuration
|
||||
const repo = actions.getInput('repo', { required: true })
|
||||
const installPath = actions.getInput('install_path') || undefined
|
||||
const owner = actions.getInput('owner', { required: true })
|
||||
const matches = new RegExp(actions.getInput('matches', { required: true }))
|
||||
const token = actions.getInput('token', { required: true })
|
||||
|
||||
getGitHubRelease(owner, repo, matches, token, installPath)
|
51
actions/get-github-release/lib.js
Normal file
51
actions/get-github-release/lib.js
Normal file
|
@ -0,0 +1,51 @@
|
|||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const process = require('process')
|
||||
const util = require('util')
|
||||
|
||||
const writeFile = util.promisify(fs.writeFile)
|
||||
|
||||
// Third Party libraries
|
||||
const core = require('@actions/core')
|
||||
const exec = require('@actions/exec')
|
||||
const github = require('@actions/github')
|
||||
const fetch = require('node-fetch')
|
||||
|
||||
/**
|
||||
* Fetches the latest release from `owner/repo` on GitHub that matches the
|
||||
* `matches` regular expression, and installs the binary to `installPath`. By
|
||||
* default the install path is `/tmp/<repo name>`. This function requires a valid
|
||||
* GitHub `token` that is able to read the repository.
|
||||
*
|
||||
* @param {string} owner - The owner of the repository.
|
||||
* @param {string} repo - The name of the repository
|
||||
* @param {Regex} matches - The regex to match against the name pick the
|
||||
* specific asset in the release.
|
||||
* @param {string} token - A GitHub token, with `read` permissions on
|
||||
* the repository.
|
||||
* @param {string} [installPath='/tmp/${repo}'] - The path to install the binary.
|
||||
*/
|
||||
exports.getGitHubRelease = async function (owner, repo, matches, token, installPath = `/tmp/${repo}`) {
|
||||
try {
|
||||
// Change to be in the installation directory.
|
||||
process.chdir(path.dirname(installPath))
|
||||
const octokit = new github.GitHub(token)
|
||||
const tarFile = `${installPath}.tar.gz`
|
||||
|
||||
// Retrieve first release that matched `regex` and download a tar archive of
|
||||
// the binary.
|
||||
const url = (await octokit.repos.getLatestRelease({ owner, repo }))
|
||||
.data
|
||||
.assets
|
||||
.find(asset => asset.name.match(matches))
|
||||
.browser_download_url
|
||||
|
||||
await writeFile(tarFile, await (await fetch(url)).buffer())
|
||||
await exec.exec('tar', ['-xvzf', tarFile])
|
||||
core.setOutput('install_path', installPath)
|
||||
return installPath
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
process.exit(1)
|
||||
}
|
||||
}
|
21
actions/get-github-release/package.json
Normal file
21
actions/get-github-release/package.json
Normal file
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"name": "run-github-release",
|
||||
"version": "1.0.0",
|
||||
"description": "Run any GitHub release binary",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"start": "node index.js",
|
||||
"build": "node_modules/.bin/ncc build --minify index.js"
|
||||
},
|
||||
"author": "",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.1.1",
|
||||
"@actions/exec": "^1.0.1",
|
||||
"@actions/github": "^2.0.1",
|
||||
"node-fetch": "^2.6.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@zeit/ncc": "^0.20.5"
|
||||
}
|
||||
}
|
12
actions/get-github-release/test.sh
Executable file
12
actions/get-github-release/test.sh
Executable file
|
@ -0,0 +1,12 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
INPUT_REPO=mdbook \
|
||||
INPUT_MATCHES=apple \
|
||||
INPUT_OWNER=rust-lang \
|
||||
INPUT_TOKEN=$GITHUB_API_KEY \
|
||||
RUNNER_TEMP=./node_modules/temp/runner \
|
||||
RUNNER_TOOL_CACHE=./node_modules/temp/cache \
|
||||
node index.js
|
||||
/tmp/mdbook -h
|
|
@ -1,22 +0,0 @@
|
|||
# This script takes care of packaging the build artifacts that will go in the
|
||||
# release zipfile
|
||||
|
||||
$SRC_DIR = $pwd.Path
|
||||
$STAGE = [System.Guid]::NewGuid().ToString()
|
||||
|
||||
Set-Location $env:TEMP
|
||||
New-Item -Type Directory -Name $STAGE
|
||||
Set-Location $STAGE
|
||||
|
||||
$ZIP = "$SRC_DIR\$($env:CRATE_NAME)-$($env:APPVEYOR_REPO_TAG_NAME)-$($env:TARGET).zip"
|
||||
|
||||
Copy-Item "$SRC_DIR\target\$($env:TARGET)\release\$($env:CRATE_NAME).exe" '.\'
|
||||
|
||||
7z a "$ZIP" *
|
||||
|
||||
Push-AppveyorArtifact "$ZIP"
|
||||
|
||||
Remove-Item *.* -Force
|
||||
Set-Location ..
|
||||
Remove-Item $STAGE
|
||||
Set-Location $SRC_DIR
|
|
@ -1,32 +0,0 @@
|
|||
# This script takes care of building your crate and packaging it for release
|
||||
|
||||
set -ex
|
||||
|
||||
main() {
|
||||
local src=$(pwd) \
|
||||
stage=
|
||||
|
||||
case $TRAVIS_OS_NAME in
|
||||
linux)
|
||||
stage=$(mktemp -d)
|
||||
;;
|
||||
osx)
|
||||
stage=$(mktemp -d -t tmp)
|
||||
;;
|
||||
esac
|
||||
|
||||
test -f Cargo.lock || cargo generate-lockfile
|
||||
|
||||
cross build --bin tokei --target $TARGET --release --all-features
|
||||
|
||||
# TODO Update this to package the right artifacts
|
||||
cp target/$TARGET/release/tokei $stage/
|
||||
|
||||
cd $stage
|
||||
tar czf $src/$CRATE_NAME-$TRAVIS_TAG-$TARGET.tar.gz *
|
||||
cd $src
|
||||
|
||||
rm -rf $stage
|
||||
}
|
||||
|
||||
main
|
23
ci/build.bash
Executable file
23
ci/build.bash
Executable file
|
@ -0,0 +1,23 @@
|
|||
#!/usr/bin/env bash
|
||||
# Script for building your rust projects.
|
||||
set -e
|
||||
|
||||
source ci/common.bash
|
||||
|
||||
# $1 {path} = Path to cross/cargo executable
|
||||
CROSS=$1
|
||||
# $1 {string} = <Target Triple>
|
||||
TARGET_TRIPLE=$2
|
||||
# $3 {boolean} = Whether or not building for release or not.
|
||||
RELEASE_BUILD=$3
|
||||
|
||||
required_arg $CROSS 'CROSS'
|
||||
required_arg $TARGET_TRIPLE '<Target Triple>'
|
||||
|
||||
if [ -z "$RELEASE_BUILD" ]; then
|
||||
$CROSS build --target $TARGET_TRIPLE
|
||||
$CROSS build --target $TARGET_TRIPLE --all-features
|
||||
else
|
||||
$CROSS build --target $TARGET_TRIPLE --all-features --release
|
||||
fi
|
||||
|
6
ci/common.bash
Normal file
6
ci/common.bash
Normal file
|
@ -0,0 +1,6 @@
|
|||
required_arg() {
|
||||
if [ -z "$1" ]; then
|
||||
echo "Required argument $2 missing"
|
||||
exit 1
|
||||
fi
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
set -ex
|
||||
|
||||
main() {
|
||||
local target=
|
||||
if [ $TRAVIS_OS_NAME = linux ]; then
|
||||
target=x86_64-unknown-linux-musl
|
||||
sort=sort
|
||||
else
|
||||
target=x86_64-apple-darwin
|
||||
sort=gsort # for `sort --sort-version`, from brew's coreutils.
|
||||
fi
|
||||
|
||||
# Builds for iOS are done on OSX, but require the specific target to be
|
||||
# installed.
|
||||
case $TARGET in
|
||||
aarch64-apple-ios)
|
||||
rustup target install aarch64-apple-ios
|
||||
;;
|
||||
armv7-apple-ios)
|
||||
rustup target install armv7-apple-ios
|
||||
;;
|
||||
armv7s-apple-ios)
|
||||
rustup target install armv7s-apple-ios
|
||||
;;
|
||||
i386-apple-ios)
|
||||
rustup target install i386-apple-ios
|
||||
;;
|
||||
x86_64-apple-ios)
|
||||
rustup target install x86_64-apple-ios
|
||||
;;
|
||||
esac
|
||||
|
||||
# This fetches latest stable release
|
||||
local tag=$(git ls-remote --tags --refs --exit-code https://github.com/japaric/cross \
|
||||
| cut -d/ -f3 \
|
||||
| grep -E '^v[0.1.0-9.]+$' \
|
||||
| $sort --version-sort \
|
||||
| tail -n1)
|
||||
curl -LSfs https://japaric.github.io/trust/install.sh | \
|
||||
sh -s -- \
|
||||
--force \
|
||||
--git japaric/cross \
|
||||
--tag $tag \
|
||||
--target $target
|
||||
}
|
||||
|
||||
main
|
26
ci/script.sh
26
ci/script.sh
|
@ -1,26 +0,0 @@
|
|||
# This script takes care of testing your crate
|
||||
|
||||
set -ex
|
||||
|
||||
main() {
|
||||
cross build --target $TARGET
|
||||
cross build --target $TARGET --all-features
|
||||
cross build --target $TARGET --release
|
||||
|
||||
if [ ! -z $DISABLE_TESTS ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
cross test --target $TARGET
|
||||
cross test --target $TARGET --all-features
|
||||
cross test --target $TARGET --release
|
||||
|
||||
cross run --target $TARGET
|
||||
cross run --target $TARGET --all-features
|
||||
cross run --target $TARGET --release
|
||||
}
|
||||
|
||||
# we don't run the "test phase" when doing deploys
|
||||
if [ -z $TRAVIS_TAG ]; then
|
||||
main
|
||||
fi
|
4
ci/set_rust_version.bash
Executable file
4
ci/set_rust_version.bash
Executable file
|
@ -0,0 +1,4 @@
|
|||
#!/usr/bin/env bash
|
||||
set -e
|
||||
rustup default $1
|
||||
rustup target add $2
|
16
ci/test.bash
Executable file
16
ci/test.bash
Executable file
|
@ -0,0 +1,16 @@
|
|||
#!/usr/bin/env bash
|
||||
# Script for building your rust projects.
|
||||
set -e
|
||||
|
||||
source ci/common.bash
|
||||
|
||||
# $1 {path} = Path to cross/cargo executable
|
||||
CROSS=$1
|
||||
# $1 {string} = <Target Triple>
|
||||
TARGET_TRIPLE=$2
|
||||
|
||||
required_arg $CROSS 'CROSS'
|
||||
required_arg $TARGET_TRIPLE '<Target Triple>'
|
||||
|
||||
$CROSS test --target $TARGET_TRIPLE
|
||||
$CROSS build --target $TARGET_TRIPLE --all-features
|
Loading…
Reference in New Issue
Block a user