-
Notifications
You must be signed in to change notification settings - Fork 581
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
- Loading branch information
Showing
20 changed files
with
11,823 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: setup-buildx-ci | ||
|
||
on: | ||
push: | ||
paths: | ||
- .github/workflows/setup-buildx-ci.yml | ||
- setup-buildx/** | ||
pull_request: | ||
paths: | ||
- .github/workflows/setup-buildx-ci.yml | ||
- setup-buildx/** | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
buildx-version: | ||
- latest | ||
- v0.2.2 | ||
steps: | ||
- | ||
name: Runner info | ||
run: | | ||
sudo apt-get install -y hwinfo | ||
sudo hwinfo --short | ||
sudo mount | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v2.3.1 | ||
- | ||
name: Set up Docker Buildx | ||
id: buildx | ||
uses: ./setup-buildx/ | ||
with: | ||
buildx-version: ${{ matrix.buildx-version }} | ||
- | ||
name: Available platforms | ||
run: echo ${{ steps.buildx.outputs.platforms }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: setup-buildx-precheckin | ||
|
||
on: | ||
push: | ||
paths: | ||
- .github/workflows/setup-buildx-precheckin.yml | ||
- setup-buildx/** | ||
pull_request: | ||
paths: | ||
- .github/workflows/setup-buildx-precheckin.yml | ||
- setup-buildx/** | ||
|
||
jobs: | ||
pre-checkin: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v2.3.1 | ||
- | ||
name: Install | ||
run: yarn --cwd ./setup-buildx/ install | ||
- | ||
name: Pre-checkin | ||
run: yarn --cwd ./setup-buildx/ run pre-checkin | ||
- | ||
name: Check for uncommitted changes | ||
run: | | ||
if [[ `git status --porcelain` ]]; then | ||
git status --porcelain | ||
echo "::warning::Found changes. Please run 'yarn --cwd ./setup-buildx/ run pre-checkin' and push" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: setup-buildx-test | ||
|
||
on: | ||
push: | ||
paths: | ||
- .github/workflows/setup-buildx-test.yml | ||
- setup-buildx/** | ||
pull_request: | ||
paths: | ||
- .github/workflows/setup-buildx-test.yml | ||
- setup-buildx/** | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v2.3.1 | ||
- | ||
name: Install | ||
run: yarn install | ||
- | ||
name: Test | ||
run: yarn run test | ||
# - | ||
# name: Upload coverage | ||
# uses: codecov/codecov-action@v1.0.7 | ||
# if: success() | ||
# with: | ||
# token: ${{ secrets.CODECOV_TOKEN }} | ||
# file: ./coverage/clover.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# This file is for unifying the coding style for different editors and IDEs. | ||
# More information at http://editorconfig.org | ||
|
||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/dist/** linguist-generated=true | ||
/lib/** linguist-generated=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
node_modules | ||
lib | ||
|
||
# Jetbrains | ||
/.idea | ||
/*.iml | ||
|
||
# Rest of the file pulled from https://github.com/github/gitignore/blob/master/Node.gitignore | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
|
||
# Diagnostic reports (https://nodejs.org/api/report.html) | ||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
*.lcov | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
jspm_packages/ | ||
|
||
# TypeScript v1 declaration files | ||
typings/ | ||
|
||
# TypeScript cache | ||
*.tsbuildinfo | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
.env | ||
.env.test | ||
|
||
# parcel-bundler cache (https://parceljs.org/) | ||
.cache | ||
|
||
# next.js build output | ||
.next | ||
|
||
# nuxt.js build output | ||
.nuxt | ||
|
||
# vuepress build output | ||
.vuepress/dist | ||
|
||
# Serverless directories | ||
.serverless/ | ||
|
||
# FuseBox cache | ||
.fusebox/ | ||
|
||
# DynamoDB Local files | ||
.dynamodb/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"printWidth": 120, | ||
"tabWidth": 2, | ||
"useTabs": false, | ||
"semi": true, | ||
"singleQuote": true, | ||
"trailingComma": "none", | ||
"bracketSpacing": false, | ||
"arrowParens": "avoid", | ||
"parser": "typescript" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
## About | ||
|
||
GitHub Action to set up Docker [Buildx](https://github.com/docker/buildx). | ||
|
||
___ | ||
|
||
* [Usage](#usage) | ||
* [Quick start](#quick-start) | ||
* [Customizing](#customizing) | ||
* [inputs](#inputs) | ||
* [outputs](#outputs) | ||
* [environment variables](#environment-variables) | ||
* [Limitation](#limitation) | ||
|
||
## Usage | ||
|
||
### Quick start | ||
|
||
```yaml | ||
name: ci | ||
|
||
on: | ||
pull_request: | ||
branches: master | ||
push: | ||
branches: master | ||
tags: | ||
|
||
jobs: | ||
buildx: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v2 | ||
- | ||
name: Set up Docker Buildx | ||
id: buildx | ||
uses: docker/action/setup-buildx@v2 | ||
with: | ||
buildx-version: latest | ||
- | ||
name: Available platforms | ||
run: echo ${{ steps.buildx.outputs.platforms }} | ||
``` | ||
## Customizing | ||
### inputs | ||
Following inputs can be used as `step.with` keys | ||
|
||
| Name | Type | Default | Description | | ||
|------------------|---------|-----------|------------------------------------| | ||
| `buildx-version` | String | `latest` | [Buildx](https://github.com/docker/buildx) version. Example: `v0.3.0` | | ||
|
||
### outputs | ||
|
||
Following outputs are available | ||
|
||
| Name | Type | Description | | ||
|---------------|---------|---------------------------------------| | ||
| `platforms` | String | Available platforms (comma separated) | | ||
|
||
### environment variables | ||
|
||
The following [official docker environment variables](https://docs.docker.com/engine/reference/commandline/cli/#environment-variables) are supported: | ||
|
||
| Name | Type | Default | Description | | ||
|-----------------|---------|-------------|-------------------------------------------------| | ||
| `DOCKER_CONFIG` | String | `~/.docker` | The location of your client configuration files | | ||
|
||
## Limitation | ||
|
||
This action is only available for Linux [virtual environments](https://help.github.com/en/articles/virtual-environments-for-github-actions#supported-virtual-environments-and-hardware-resources). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import * as github from '../src/github'; | ||
|
||
describe('github', () => { | ||
it('returns latest buildx GitHub release', async () => { | ||
const release = await github.getRelease('latest'); | ||
console.log(release); | ||
expect(release).not.toBeNull(); | ||
expect(release?.tag_name).not.toEqual(''); | ||
}); | ||
|
||
it('returns v0.2.2 buildx GitHub release', async () => { | ||
const release = await github.getRelease('v0.2.2'); | ||
console.log(release); | ||
expect(release).not.toBeNull(); | ||
expect(release?.tag_name).toEqual('v0.2.2'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import fs = require('fs'); | ||
import * as installer from '../src/installer'; | ||
import * as path from 'path'; | ||
import * as os from 'os'; | ||
|
||
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'ghaction-docker-buildx-')); | ||
|
||
describe('installer', () => { | ||
it('acquires v0.2.2 version of buildx', async () => { | ||
const buildx = await installer.buildx('v0.2.2', tmpDir); | ||
console.log(buildx); | ||
expect(fs.existsSync(buildx)).toBe(true); | ||
}, 100000); | ||
|
||
it('acquires latest version of buildx', async () => { | ||
const buildx = await installer.buildx('latest', tmpDir); | ||
console.log(buildx); | ||
expect(fs.existsSync(buildx)).toBe(true); | ||
}, 100000); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# https://help.github.com/en/articles/metadata-syntax-for-github-actions | ||
name: 'Docker - Setup Buildx' | ||
description: 'GitHub Action to set up Docker Buildx' | ||
author: 'crazy-max' | ||
branding: | ||
color: 'blue' | ||
icon: 'truck' | ||
|
||
inputs: | ||
buildx-version: | ||
description: 'Buildx version. Example: v0.3.0' | ||
default: 'latest' | ||
required: false | ||
|
||
outputs: | ||
platforms: | ||
description: 'Available platforms (comma separated)' | ||
|
||
runs: | ||
using: 'node12' | ||
main: 'dist/index.js' | ||
post: 'dist/index.js' |
Oops, something went wrong.