mirror of
https://github.com/docker/setup-qemu-action.git
synced 2025-04-20 19:58:59 +00:00
Compare commits
No commits in common. "master" and "v1" have entirely different histories.
@ -1,12 +1 @@
|
|||||||
/coverage
|
/node_modules
|
||||||
|
|
||||||
# Dependency directories
|
|
||||||
node_modules/
|
|
||||||
jspm_packages/
|
|
||||||
|
|
||||||
# yarn v2
|
|
||||||
.yarn/cache
|
|
||||||
.yarn/unplugged
|
|
||||||
.yarn/build-state.yml
|
|
||||||
.yarn/install-state.gz
|
|
||||||
.pnp.*
|
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
/dist/**
|
|
||||||
/coverage/**
|
|
||||||
/node_modules/**
|
|
@ -1,24 +0,0 @@
|
|||||||
{
|
|
||||||
"env": {
|
|
||||||
"node": true,
|
|
||||||
"es6": true,
|
|
||||||
"jest": true
|
|
||||||
},
|
|
||||||
"extends": [
|
|
||||||
"eslint:recommended",
|
|
||||||
"plugin:@typescript-eslint/eslint-recommended",
|
|
||||||
"plugin:@typescript-eslint/recommended",
|
|
||||||
"plugin:jest/recommended",
|
|
||||||
"plugin:prettier/recommended"
|
|
||||||
],
|
|
||||||
"parser": "@typescript-eslint/parser",
|
|
||||||
"parserOptions": {
|
|
||||||
"ecmaVersion": "latest",
|
|
||||||
"sourceType": "module"
|
|
||||||
},
|
|
||||||
"plugins": [
|
|
||||||
"@typescript-eslint",
|
|
||||||
"jest",
|
|
||||||
"prettier"
|
|
||||||
]
|
|
||||||
}
|
|
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -1,4 +1,2 @@
|
|||||||
/.yarn/releases/** binary
|
|
||||||
/.yarn/plugins/** binary
|
|
||||||
/dist/** linguist-generated=true
|
/dist/** linguist-generated=true
|
||||||
/lib/** linguist-generated=true
|
/lib/** linguist-generated=true
|
||||||
|
1
.github/CODEOWNERS
vendored
Normal file
1
.github/CODEOWNERS
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
* @crazy-max
|
3
.github/CODE_OF_CONDUCT.md
vendored
3
.github/CODE_OF_CONDUCT.md
vendored
@ -1,3 +0,0 @@
|
|||||||
# Code of conduct
|
|
||||||
|
|
||||||
- [Moby community guidelines](https://github.com/moby/moby/blob/master/CONTRIBUTING.md#moby-community-guidelines)
|
|
2
.github/CONTRIBUTING.md
vendored
2
.github/CONTRIBUTING.md
vendored
@ -14,7 +14,7 @@ to the public under the [project's open source license](LICENSE).
|
|||||||
5. Format code and build javascript artifacts: `docker buildx bake pre-checkin`
|
5. Format code and build javascript artifacts: `docker buildx bake pre-checkin`
|
||||||
6. Validate all code has correctly formatted and built: `docker buildx bake validate`
|
6. Validate all code has correctly formatted and built: `docker buildx bake validate`
|
||||||
7. Push to your fork and [submit a pull request](https://github.com/docker/setup-qemu-action/compare)
|
7. Push to your fork and [submit a pull request](https://github.com/docker/setup-qemu-action/compare)
|
||||||
8. Pat yourself on the back and wait for your pull request to be reviewed and merged.
|
8. Pat your self on the back and wait for your pull request to be reviewed and merged.
|
||||||
|
|
||||||
Here are a few things you can do that will increase the likelihood of your pull request being accepted:
|
Here are a few things you can do that will increase the likelihood of your pull request being accepted:
|
||||||
|
|
||||||
|
101
.github/ISSUE_TEMPLATE/bug.yml
vendored
101
.github/ISSUE_TEMPLATE/bug.yml
vendored
@ -1,101 +0,0 @@
|
|||||||
# https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema
|
|
||||||
name: Bug Report
|
|
||||||
description: Report a bug
|
|
||||||
labels:
|
|
||||||
- status/triage
|
|
||||||
|
|
||||||
body:
|
|
||||||
- type: markdown
|
|
||||||
attributes:
|
|
||||||
value: |
|
|
||||||
Thank you for taking the time to report a bug!
|
|
||||||
If this is a security issue please report it to the [Docker Security team](mailto:security@docker.com).
|
|
||||||
|
|
||||||
- type: checkboxes
|
|
||||||
attributes:
|
|
||||||
label: Contributing guidelines
|
|
||||||
description: >
|
|
||||||
Make sure you've read the contributing guidelines before proceeding.
|
|
||||||
options:
|
|
||||||
- label: I've read the [contributing guidelines](https://github.com/docker/setup-qemu-action/blob/master/.github/CONTRIBUTING.md) and wholeheartedly agree
|
|
||||||
required: true
|
|
||||||
|
|
||||||
- type: checkboxes
|
|
||||||
attributes:
|
|
||||||
label: "I've found a bug, and:"
|
|
||||||
description: |
|
|
||||||
Make sure that your request fulfills all of the following requirements.
|
|
||||||
If one requirement cannot be satisfied, explain in detail why.
|
|
||||||
options:
|
|
||||||
- label: The documentation does not mention anything about my problem
|
|
||||||
- label: There are no open or closed issues that are related to my problem
|
|
||||||
|
|
||||||
- type: textarea
|
|
||||||
attributes:
|
|
||||||
label: Description
|
|
||||||
description: >
|
|
||||||
Provide a brief description of the bug in 1-2 sentences.
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
|
|
||||||
- type: textarea
|
|
||||||
attributes:
|
|
||||||
label: Expected behaviour
|
|
||||||
description: >
|
|
||||||
Describe precisely what you'd expect to happen.
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
|
|
||||||
- type: textarea
|
|
||||||
attributes:
|
|
||||||
label: Actual behaviour
|
|
||||||
description: >
|
|
||||||
Describe precisely what is actually happening.
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
|
|
||||||
- type: input
|
|
||||||
attributes:
|
|
||||||
label: Repository URL
|
|
||||||
description: >
|
|
||||||
Enter the URL of the repository where you are experiencing the
|
|
||||||
issue. If your repository is private, provide a link to a minimal
|
|
||||||
repository that reproduces the issue.
|
|
||||||
|
|
||||||
- type: input
|
|
||||||
attributes:
|
|
||||||
label: Workflow run URL
|
|
||||||
description: >
|
|
||||||
Enter the URL of the GitHub Action workflow run if public (e.g.
|
|
||||||
`https://github.com/<user>/<repo>/actions/runs/<id>`)
|
|
||||||
|
|
||||||
- type: textarea
|
|
||||||
attributes:
|
|
||||||
label: YAML workflow
|
|
||||||
description: |
|
|
||||||
Provide the YAML of the workflow that's causing the issue.
|
|
||||||
Make sure to remove any sensitive information.
|
|
||||||
render: yaml
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
|
|
||||||
- type: textarea
|
|
||||||
attributes:
|
|
||||||
label: Workflow logs
|
|
||||||
description: >
|
|
||||||
[Attach](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/attaching-files)
|
|
||||||
the [log file of your workflow run](https://docs.github.com/en/actions/managing-workflow-runs/using-workflow-run-logs#downloading-logs)
|
|
||||||
and make sure to remove any sensitive information.
|
|
||||||
|
|
||||||
- type: textarea
|
|
||||||
attributes:
|
|
||||||
label: BuildKit logs
|
|
||||||
description: >
|
|
||||||
If applicable, provide the [BuildKit container logs](https://docs.docker.com/build/ci/github-actions/configure-builder/#buildkit-container-logs)
|
|
||||||
render: text
|
|
||||||
|
|
||||||
- type: textarea
|
|
||||||
attributes:
|
|
||||||
label: Additional info
|
|
||||||
description: |
|
|
||||||
Provide any additional information that could be useful.
|
|
34
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
34
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
---
|
||||||
|
name: Bug report
|
||||||
|
about: Create a report to help us improve
|
||||||
|
---
|
||||||
|
|
||||||
|
### Behaviour
|
||||||
|
|
||||||
|
#### Steps to reproduce this issue
|
||||||
|
|
||||||
|
1.
|
||||||
|
2.
|
||||||
|
3.
|
||||||
|
|
||||||
|
#### Expected behaviour
|
||||||
|
|
||||||
|
> Tell us what should happen
|
||||||
|
|
||||||
|
#### Actual behaviour
|
||||||
|
|
||||||
|
> Tell us what happens instead
|
||||||
|
|
||||||
|
### Configuration
|
||||||
|
|
||||||
|
* Repository URL (if public):
|
||||||
|
* Build URL (if public):
|
||||||
|
|
||||||
|
```yml
|
||||||
|
# paste your YAML workflow file here and remove sensitive data
|
||||||
|
```
|
||||||
|
|
||||||
|
### Logs
|
||||||
|
|
||||||
|
> Download the [log file of your build](https://docs.github.com/en/actions/managing-workflow-runs/using-workflow-run-logs#downloading-logs)
|
||||||
|
> and [attach it](https://docs.github.com/en/github/managing-your-work-on-github/file-attachments-on-issues-and-pull-requests) to this issue.
|
9
.github/ISSUE_TEMPLATE/config.yml
vendored
9
.github/ISSUE_TEMPLATE/config.yml
vendored
@ -1,9 +0,0 @@
|
|||||||
# https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/configuring-issue-templates-for-your-repository#configuring-the-template-chooser
|
|
||||||
blank_issues_enabled: true
|
|
||||||
contact_links:
|
|
||||||
- name: Questions and Discussions
|
|
||||||
url: https://github.com/docker/setup-qemu-action/discussions/new
|
|
||||||
about: Use Github Discussions to ask questions and/or open discussion topics.
|
|
||||||
- name: Documentation
|
|
||||||
url: https://docs.docker.com/build/ci/github-actions/
|
|
||||||
about: Read the documentation.
|
|
15
.github/ISSUE_TEMPLATE/feature.yml
vendored
15
.github/ISSUE_TEMPLATE/feature.yml
vendored
@ -1,15 +0,0 @@
|
|||||||
# https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema
|
|
||||||
name: Feature request
|
|
||||||
description: Missing functionality? Come tell us about it!
|
|
||||||
labels:
|
|
||||||
- kind/enhancement
|
|
||||||
- status/triage
|
|
||||||
|
|
||||||
body:
|
|
||||||
- type: textarea
|
|
||||||
id: description
|
|
||||||
attributes:
|
|
||||||
label: Description
|
|
||||||
description: What is the feature you want to see?
|
|
||||||
validations:
|
|
||||||
required: true
|
|
12
.github/SECURITY.md
vendored
12
.github/SECURITY.md
vendored
@ -1,12 +0,0 @@
|
|||||||
# Reporting security issues
|
|
||||||
|
|
||||||
The project maintainers take security seriously. If you discover a security
|
|
||||||
issue, please bring it to their attention right away!
|
|
||||||
|
|
||||||
**Please _DO NOT_ file a public issue**, instead send your report privately to
|
|
||||||
[security@docker.com](mailto:security@docker.com).
|
|
||||||
|
|
||||||
Security reports are greatly appreciated, and we will publicly thank you for it.
|
|
||||||
We also like to send gifts—if you'd like Docker swag, make sure to let
|
|
||||||
us know. We currently do not offer a paid security bounty program, but are not
|
|
||||||
ruling it out in the future.
|
|
31
.github/SUPPORT.md
vendored
Normal file
31
.github/SUPPORT.md
vendored
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
# Support [](https://isitmaintained.com/project/docker/setup-qemu-action)
|
||||||
|
|
||||||
|
First, [be a good guy](https://github.com/kossnocorp/etiquette/blob/master/README.md).
|
||||||
|
|
||||||
|
## Reporting an issue
|
||||||
|
|
||||||
|
Please do a search in [open issues](https://github.com/docker/setup-qemu-action/issues?utf8=%E2%9C%93&q=) to see if the issue or feature request has already been filed.
|
||||||
|
|
||||||
|
If you find your issue already exists, make relevant comments and add your [reaction](https://github.com/blog/2119-add-reactions-to-pull-requests-issues-and-comments). Use a reaction in place of a "+1" comment.
|
||||||
|
|
||||||
|
:+1: - upvote
|
||||||
|
|
||||||
|
:-1: - downvote
|
||||||
|
|
||||||
|
If you cannot find an existing issue that describes your bug or feature, submit an issue using the guidelines below.
|
||||||
|
|
||||||
|
## Writing good bug reports and feature requests
|
||||||
|
|
||||||
|
File a single issue per problem and feature request.
|
||||||
|
|
||||||
|
* Do not enumerate multiple bugs or feature requests in the same issue.
|
||||||
|
* Do not add your issue as a comment to an existing issue unless it's for the identical input. Many issues look similar, but have different causes.
|
||||||
|
|
||||||
|
The more information you can provide, the more likely someone will be successful reproducing the issue and finding a fix.
|
||||||
|
|
||||||
|
You are now ready to [create a new issue](https://github.com/docker/setup-qemu-action/issues/new/choose)!
|
||||||
|
|
||||||
|
## Closure policy
|
||||||
|
|
||||||
|
* Issues that don't have the information requested above (when applicable) will be closed immediately and the poster directed to the support guidelines.
|
||||||
|
* Issues that go a week without a response from original poster are subject to closure at our discretion.
|
13
.github/dependabot.yml
vendored
13
.github/dependabot.yml
vendored
@ -4,16 +4,19 @@ updates:
|
|||||||
directory: "/"
|
directory: "/"
|
||||||
schedule:
|
schedule:
|
||||||
interval: "daily"
|
interval: "daily"
|
||||||
|
time: "06:00"
|
||||||
|
timezone: "Europe/Paris"
|
||||||
labels:
|
labels:
|
||||||
- "dependencies"
|
- ":game_die: dependencies"
|
||||||
- "bot"
|
- ":robot: bot"
|
||||||
- package-ecosystem: "npm"
|
- package-ecosystem: "npm"
|
||||||
directory: "/"
|
directory: "/"
|
||||||
schedule:
|
schedule:
|
||||||
interval: "daily"
|
interval: "daily"
|
||||||
versioning-strategy: "increase"
|
time: "06:00"
|
||||||
|
timezone: "Europe/Paris"
|
||||||
allow:
|
allow:
|
||||||
- dependency-type: "production"
|
- dependency-type: "production"
|
||||||
labels:
|
labels:
|
||||||
- "dependencies"
|
- ":game_die: dependencies"
|
||||||
- "bot"
|
- ":robot: bot"
|
||||||
|
76
.github/workflows/ci.yml
vendored
76
.github/workflows/ci.yml
vendored
@ -1,12 +1,8 @@
|
|||||||
name: ci
|
name: ci
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '0 10 * * *'
|
- cron: '0 10 * * *' # everyday at 10am
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- 'master'
|
- 'master'
|
||||||
@ -14,22 +10,11 @@ on:
|
|||||||
tags:
|
tags:
|
||||||
- 'v*'
|
- 'v*'
|
||||||
pull_request:
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- 'master'
|
||||||
|
- 'releases/v*'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
default:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
-
|
|
||||||
name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
-
|
|
||||||
name: Set up QEMU
|
|
||||||
id: qemu
|
|
||||||
uses: ./
|
|
||||||
-
|
|
||||||
name: Available platforms
|
|
||||||
run: echo ${{ steps.qemu.outputs.platforms }}
|
|
||||||
|
|
||||||
main:
|
main:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
@ -44,7 +29,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v2
|
||||||
-
|
-
|
||||||
name: Set up QEMU
|
name: Set up QEMU
|
||||||
id: qemu
|
id: qemu
|
||||||
@ -55,17 +40,20 @@ jobs:
|
|||||||
-
|
-
|
||||||
name: Available platforms
|
name: Available platforms
|
||||||
run: echo ${{ steps.qemu.outputs.platforms }}
|
run: echo ${{ steps.qemu.outputs.platforms }}
|
||||||
|
-
|
||||||
|
name: Dump context
|
||||||
|
uses: crazy-max/ghaction-dump-context@v1
|
||||||
|
|
||||||
error:
|
error:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v2
|
||||||
-
|
-
|
||||||
name: Stop docker
|
name: Stop docker
|
||||||
run: |
|
run: |
|
||||||
sudo systemctl stop docker docker.socket
|
sudo systemctl stop docker
|
||||||
-
|
-
|
||||||
name: Set up QEMU
|
name: Set up QEMU
|
||||||
id: qemu
|
id: qemu
|
||||||
@ -79,45 +67,7 @@ jobs:
|
|||||||
echo "::error::Should have failed"
|
echo "::error::Should have failed"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cache-image:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
cache:
|
|
||||||
- true
|
|
||||||
- false
|
|
||||||
steps:
|
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Dump context
|
||||||
uses: actions/checkout@v4
|
if: always()
|
||||||
-
|
uses: crazy-max/ghaction-dump-context@v1
|
||||||
name: Set up QEMU
|
|
||||||
id: qemu
|
|
||||||
uses: ./
|
|
||||||
with:
|
|
||||||
image: tonistiigi/binfmt:master
|
|
||||||
cache-image: ${{ matrix.cache }}
|
|
||||||
-
|
|
||||||
name: Available platforms
|
|
||||||
run: echo ${{ steps.qemu.outputs.platforms }}
|
|
||||||
|
|
||||||
version:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
image:
|
|
||||||
- tonistiigi/binfmt:master
|
|
||||||
- tonistiigi/binfmt:latest
|
|
||||||
- tonistiigi/binfmt:qemu-v7.0.0
|
|
||||||
steps:
|
|
||||||
-
|
|
||||||
name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
-
|
|
||||||
name: Set up QEMU
|
|
||||||
uses: ./
|
|
||||||
with:
|
|
||||||
image: ${{ matrix.image }}
|
|
||||||
|
21
.github/workflows/publish.yml
vendored
21
.github/workflows/publish.yml
vendored
@ -1,21 +0,0 @@
|
|||||||
name: publish
|
|
||||||
|
|
||||||
on:
|
|
||||||
release:
|
|
||||||
types:
|
|
||||||
- published
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
publish:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
id-token: write
|
|
||||||
packages: write
|
|
||||||
steps:
|
|
||||||
-
|
|
||||||
name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
-
|
|
||||||
name: Publish
|
|
||||||
uses: actions/publish-immutable-action@v0.0.4
|
|
28
.github/workflows/test.yml
vendored
28
.github/workflows/test.yml
vendored
@ -1,28 +0,0 @@
|
|||||||
name: test
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- 'master'
|
|
||||||
- 'releases/v*'
|
|
||||||
pull_request:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
-
|
|
||||||
name: Test
|
|
||||||
uses: docker/bake-action@v6
|
|
||||||
with:
|
|
||||||
targets: test
|
|
||||||
-
|
|
||||||
name: Upload coverage
|
|
||||||
uses: codecov/codecov-action@v5
|
|
||||||
with:
|
|
||||||
files: ./coverage/clover.xml
|
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
|
33
.github/workflows/validate.yml
vendored
33
.github/workflows/validate.yml
vendored
@ -1,43 +1,24 @@
|
|||||||
name: validate
|
name: validate
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- 'master'
|
- 'master'
|
||||||
- 'releases/v*'
|
- 'releases/v*'
|
||||||
pull_request:
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- 'master'
|
||||||
|
- 'releases/v*'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
prepare:
|
validate:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
|
||||||
targets: ${{ steps.generate.outputs.targets }}
|
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v2
|
||||||
-
|
|
||||||
name: List targets
|
|
||||||
id: generate
|
|
||||||
uses: docker/bake-action/subaction/list-targets@v6
|
|
||||||
with:
|
|
||||||
target: validate
|
|
||||||
|
|
||||||
validate:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs:
|
|
||||||
- prepare
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
target: ${{ fromJson(needs.prepare.outputs.targets) }}
|
|
||||||
steps:
|
|
||||||
-
|
-
|
||||||
name: Validate
|
name: Validate
|
||||||
uses: docker/bake-action@v6
|
uses: docker/bake-action@v1
|
||||||
with:
|
with:
|
||||||
targets: ${{ matrix.target }}
|
targets: validate
|
||||||
|
71
.gitignore
vendored
71
.gitignore
vendored
@ -1,5 +1,12 @@
|
|||||||
# https://raw.githubusercontent.com/github/gitignore/main/Node.gitignore
|
/.dev
|
||||||
|
node_modules
|
||||||
|
lib
|
||||||
|
|
||||||
|
# Jetbrains
|
||||||
|
/.idea
|
||||||
|
/*.iml
|
||||||
|
|
||||||
|
# Rest of the file pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
|
||||||
# Logs
|
# Logs
|
||||||
logs
|
logs
|
||||||
*.log
|
*.log
|
||||||
@ -7,7 +14,6 @@ npm-debug.log*
|
|||||||
yarn-debug.log*
|
yarn-debug.log*
|
||||||
yarn-error.log*
|
yarn-error.log*
|
||||||
lerna-debug.log*
|
lerna-debug.log*
|
||||||
.pnpm-debug.log*
|
|
||||||
|
|
||||||
# Diagnostic reports (https://nodejs.org/api/report.html)
|
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||||
@ -18,14 +24,34 @@ pids
|
|||||||
*.seed
|
*.seed
|
||||||
*.pid.lock
|
*.pid.lock
|
||||||
|
|
||||||
|
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||||
|
lib-cov
|
||||||
|
|
||||||
# Coverage directory used by tools like istanbul
|
# Coverage directory used by tools like istanbul
|
||||||
coverage
|
coverage
|
||||||
*.lcov
|
*.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
|
# Dependency directories
|
||||||
node_modules/
|
|
||||||
jspm_packages/
|
jspm_packages/
|
||||||
|
|
||||||
|
# TypeScript v1 declaration files
|
||||||
|
typings/
|
||||||
|
|
||||||
# TypeScript cache
|
# TypeScript cache
|
||||||
*.tsbuildinfo
|
*.tsbuildinfo
|
||||||
|
|
||||||
@ -35,19 +61,36 @@ jspm_packages/
|
|||||||
# Optional eslint cache
|
# Optional eslint cache
|
||||||
.eslintcache
|
.eslintcache
|
||||||
|
|
||||||
|
# Optional REPL history
|
||||||
|
.node_repl_history
|
||||||
|
|
||||||
|
# Output of 'npm pack'
|
||||||
|
*.tgz
|
||||||
|
|
||||||
# Yarn Integrity file
|
# Yarn Integrity file
|
||||||
.yarn-integrity
|
.yarn-integrity
|
||||||
|
|
||||||
# dotenv environment variable files
|
# dotenv environment variables file
|
||||||
.env
|
.env
|
||||||
.env.development.local
|
.env.test
|
||||||
.env.test.local
|
|
||||||
.env.production.local
|
|
||||||
.env.local
|
|
||||||
|
|
||||||
# yarn v2
|
# parcel-bundler cache (https://parceljs.org/)
|
||||||
.yarn/cache
|
.cache
|
||||||
.yarn/unplugged
|
|
||||||
.yarn/build-state.yml
|
# next.js build output
|
||||||
.yarn/install-state.gz
|
.next
|
||||||
.pnp.*
|
|
||||||
|
# nuxt.js build output
|
||||||
|
.nuxt
|
||||||
|
|
||||||
|
# vuepress build output
|
||||||
|
.vuepress/dist
|
||||||
|
|
||||||
|
# Serverless directories
|
||||||
|
.serverless/
|
||||||
|
|
||||||
|
# FuseBox cache
|
||||||
|
.fusebox/
|
||||||
|
|
||||||
|
# DynamoDB Local files
|
||||||
|
.dynamodb/
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
# Dependency directories
|
|
||||||
node_modules/
|
|
||||||
jspm_packages/
|
|
||||||
|
|
||||||
# yarn v2
|
|
||||||
.yarn/
|
|
541
.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
vendored
541
.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
vendored
File diff suppressed because one or more lines are too long
13
.yarnrc.yml
13
.yarnrc.yml
@ -1,13 +0,0 @@
|
|||||||
logFilters:
|
|
||||||
- code: YN0013
|
|
||||||
level: discard
|
|
||||||
- code: YN0019
|
|
||||||
level: discard
|
|
||||||
- code: YN0076
|
|
||||||
level: discard
|
|
||||||
|
|
||||||
nodeLinker: node-modules
|
|
||||||
|
|
||||||
plugins:
|
|
||||||
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
|
|
||||||
spec: "@yarnpkg/plugin-interactive-tools"
|
|
62
README.md
62
README.md
@ -1,8 +1,6 @@
|
|||||||
[](https://github.com/docker/setup-qemu-action/releases/latest)
|
[](https://github.com/docker/setup-qemu-action/releases/latest)
|
||||||
[](https://github.com/marketplace/actions/docker-setup-qemu)
|
[](https://github.com/marketplace/actions/docker-setup-qemu)
|
||||||
[](https://github.com/docker/setup-qemu-action/actions?workflow=ci)
|
[](https://github.com/docker/setup-qemu-action/actions?workflow=ci)
|
||||||
[](https://github.com/docker/setup-qemu-action/actions?workflow=test)
|
|
||||||
[](https://codecov.io/gh/docker/setup-qemu-action)
|
|
||||||
|
|
||||||
## About
|
## About
|
||||||
|
|
||||||
@ -15,8 +13,7 @@ ___
|
|||||||
* [Usage](#usage)
|
* [Usage](#usage)
|
||||||
* [Customizing](#customizing)
|
* [Customizing](#customizing)
|
||||||
* [inputs](#inputs)
|
* [inputs](#inputs)
|
||||||
* [outputs](#outputs)
|
* [Keep up-to-date with GitHub Dependabot](#keep-up-to-date-with-github-dependabot)
|
||||||
* [Contributing](#contributing)
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
@ -30,45 +27,52 @@ jobs:
|
|||||||
qemu:
|
qemu:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
-
|
||||||
|
name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
-
|
-
|
||||||
name: Set up QEMU
|
name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v3
|
id: qemu
|
||||||
|
uses: docker/setup-qemu-action@v1
|
||||||
|
with:
|
||||||
|
image: tonistiigi/binfmt:latest
|
||||||
|
platforms: all
|
||||||
|
-
|
||||||
|
name: Available platforms
|
||||||
|
run: echo ${{ steps.qemu.outputs.platforms }}
|
||||||
```
|
```
|
||||||
|
|
||||||
> [!NOTE]
|
|
||||||
> If you are using [`docker/setup-buildx-action`](https://github.com/docker/setup-buildx-action),
|
|
||||||
> this action should come before it:
|
|
||||||
>
|
|
||||||
> ```yaml
|
|
||||||
> -
|
|
||||||
> name: Set up QEMU
|
|
||||||
> uses: docker/setup-qemu-action@v3
|
|
||||||
> -
|
|
||||||
> name: Set up Docker Buildx
|
|
||||||
> uses: docker/setup-buildx-action@v3
|
|
||||||
> ```
|
|
||||||
|
|
||||||
## Customizing
|
## Customizing
|
||||||
|
|
||||||
### inputs
|
### inputs
|
||||||
|
|
||||||
The following inputs can be used as `step.with` keys:
|
Following inputs can be used as `step.with` keys
|
||||||
|
|
||||||
| Name | Type | Default | Description |
|
| Name | Type | Description |
|
||||||
|---------------|--------|-------------------------------------------------------------------------------|----------------------------------------------------|
|
|------------------|---------|------------------------------------|
|
||||||
| `image` | String | [`tonistiigi/binfmt:latest`](https://hub.docker.com/r/tonistiigi/binfmt/tags) | QEMU static binaries Docker image |
|
| `image` | String | QEMU static binaries Docker image (default [`tonistiigi/binfmt:latest`](https://hub.docker.com/r/tonistiigi/binfmt/tags)) |
|
||||||
| `platforms` | String | `all` | Platforms to install (e.g., `arm64,riscv64,arm`) |
|
| `platforms` | String | Platforms to install (e.g. `arm64,riscv64,arm` ; default `all`) |
|
||||||
| `cache-image` | Bool | `true` | Cache binfmt image to GitHub Actions cache backend |
|
|
||||||
|
|
||||||
### outputs
|
### outputs
|
||||||
|
|
||||||
The following outputs are available:
|
Following outputs are available
|
||||||
|
|
||||||
| Name | Type | Description |
|
| Name | Type | Description |
|
||||||
|---------------|---------|---------------------------------------|
|
|---------------|---------|---------------------------------------|
|
||||||
| `platforms` | String | Available platforms (comma separated) |
|
| `platforms` | String | Available platforms (comma separated) |
|
||||||
|
|
||||||
## Contributing
|
## Keep up-to-date with GitHub Dependabot
|
||||||
|
|
||||||
Want to contribute? Awesome! You can find information about contributing to
|
Since [Dependabot](https://docs.github.com/en/github/administering-a-repository/keeping-your-actions-up-to-date-with-github-dependabot)
|
||||||
this project in the [CONTRIBUTING.md](/.github/CONTRIBUTING.md)
|
has [native GitHub Actions support](https://docs.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates#package-ecosystem),
|
||||||
|
to enable it on your GitHub repo all you need to do is add the `.github/dependabot.yml` file:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
# Maintain dependencies for GitHub Actions
|
||||||
|
- package-ecosystem: "github-actions"
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: "daily"
|
||||||
|
```
|
||||||
|
@ -1,72 +0,0 @@
|
|||||||
import {beforeEach, describe, expect, test} from '@jest/globals';
|
|
||||||
|
|
||||||
import * as context from '../src/context';
|
|
||||||
|
|
||||||
describe('getInputs', () => {
|
|
||||||
beforeEach(() => {
|
|
||||||
process.env = Object.keys(process.env).reduce((object, key) => {
|
|
||||||
if (!key.startsWith('INPUT_')) {
|
|
||||||
object[key] = process.env[key];
|
|
||||||
}
|
|
||||||
return object;
|
|
||||||
}, {});
|
|
||||||
});
|
|
||||||
|
|
||||||
// prettier-ignore
|
|
||||||
test.each([
|
|
||||||
[
|
|
||||||
0,
|
|
||||||
new Map<string, string>([
|
|
||||||
['cache-image', 'true'],
|
|
||||||
]),
|
|
||||||
{
|
|
||||||
image: 'docker.io/tonistiigi/binfmt:latest',
|
|
||||||
platforms: 'all',
|
|
||||||
cacheImage: true,
|
|
||||||
} as context.Inputs
|
|
||||||
],
|
|
||||||
[
|
|
||||||
1,
|
|
||||||
new Map<string, string>([
|
|
||||||
['image', 'docker/binfmt:latest'],
|
|
||||||
['platforms', 'arm64,riscv64,arm'],
|
|
||||||
['cache-image', 'false'],
|
|
||||||
]),
|
|
||||||
{
|
|
||||||
image: 'docker/binfmt:latest',
|
|
||||||
platforms: 'arm64,riscv64,arm',
|
|
||||||
cacheImage: false,
|
|
||||||
} as context.Inputs
|
|
||||||
],
|
|
||||||
[
|
|
||||||
2,
|
|
||||||
new Map<string, string>([
|
|
||||||
['platforms', 'arm64, riscv64, arm '],
|
|
||||||
['cache-image', 'true'],
|
|
||||||
]),
|
|
||||||
{
|
|
||||||
image: 'docker.io/tonistiigi/binfmt:latest',
|
|
||||||
platforms: 'arm64,riscv64,arm',
|
|
||||||
cacheImage: true,
|
|
||||||
} as context.Inputs
|
|
||||||
]
|
|
||||||
])(
|
|
||||||
'[%d] given %p as inputs, returns %p',
|
|
||||||
async (num: number, inputs: Map<string, string>, expected: context.Inputs) => {
|
|
||||||
inputs.forEach((value: string, name: string) => {
|
|
||||||
setInput(name, value);
|
|
||||||
});
|
|
||||||
const res = await context.getInputs();
|
|
||||||
expect(res).toEqual(expected);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
// See: https://github.com/actions/toolkit/blob/master/packages/core/src/core.ts#L67
|
|
||||||
function getInputName(name: string): string {
|
|
||||||
return `INPUT_${name.replace(/ /g, '_').toUpperCase()}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
function setInput(name: string, value: string): void {
|
|
||||||
process.env[getInputName(name)] = value;
|
|
||||||
}
|
|
@ -9,22 +9,17 @@ branding:
|
|||||||
inputs:
|
inputs:
|
||||||
image:
|
image:
|
||||||
description: 'QEMU static binaries Docker image (e.g. tonistiigi/binfmt:latest)'
|
description: 'QEMU static binaries Docker image (e.g. tonistiigi/binfmt:latest)'
|
||||||
default: 'docker.io/tonistiigi/binfmt:latest'
|
default: 'tonistiigi/binfmt:latest'
|
||||||
required: false
|
required: false
|
||||||
platforms:
|
platforms:
|
||||||
description: 'Platforms to install (e.g. arm64,riscv64,arm)'
|
description: 'Platforms to install (e.g. arm64,riscv64,arm)'
|
||||||
default: 'all'
|
default: 'all'
|
||||||
required: false
|
required: false
|
||||||
cache-image:
|
|
||||||
description: 'Cache binfmt image to GitHub Actions cache backend'
|
|
||||||
default: 'true'
|
|
||||||
required: false
|
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
platforms:
|
platforms:
|
||||||
description: 'Available platforms (comma separated)'
|
description: 'Available platforms (comma separated)'
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: 'node20'
|
using: 'node12'
|
||||||
main: 'dist/index.js'
|
main: 'dist/index.js'
|
||||||
post: 'dist/index.js'
|
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
comment: false
|
|
||||||
github_checks:
|
|
||||||
annotations: false
|
|
@ -1,80 +0,0 @@
|
|||||||
# syntax=docker/dockerfile:1
|
|
||||||
|
|
||||||
ARG NODE_VERSION=20
|
|
||||||
|
|
||||||
FROM node:${NODE_VERSION}-alpine AS base
|
|
||||||
RUN apk add --no-cache cpio findutils git
|
|
||||||
WORKDIR /src
|
|
||||||
RUN --mount=type=bind,target=.,rw \
|
|
||||||
--mount=type=cache,target=/src/.yarn/cache <<EOT
|
|
||||||
corepack enable
|
|
||||||
yarn --version
|
|
||||||
yarn config set --home enableTelemetry 0
|
|
||||||
EOT
|
|
||||||
|
|
||||||
FROM base AS deps
|
|
||||||
RUN --mount=type=bind,target=.,rw \
|
|
||||||
--mount=type=cache,target=/src/.yarn/cache \
|
|
||||||
--mount=type=cache,target=/src/node_modules \
|
|
||||||
yarn install && mkdir /vendor && cp yarn.lock /vendor
|
|
||||||
|
|
||||||
FROM scratch AS vendor-update
|
|
||||||
COPY --from=deps /vendor /
|
|
||||||
|
|
||||||
FROM deps AS vendor-validate
|
|
||||||
RUN --mount=type=bind,target=.,rw <<EOT
|
|
||||||
set -e
|
|
||||||
git add -A
|
|
||||||
cp -rf /vendor/* .
|
|
||||||
if [ -n "$(git status --porcelain -- yarn.lock)" ]; then
|
|
||||||
echo >&2 'ERROR: Vendor result differs. Please vendor your package with "docker buildx bake vendor"'
|
|
||||||
git status --porcelain -- yarn.lock
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
EOT
|
|
||||||
|
|
||||||
FROM deps AS build
|
|
||||||
RUN --mount=type=bind,target=.,rw \
|
|
||||||
--mount=type=cache,target=/src/.yarn/cache \
|
|
||||||
--mount=type=cache,target=/src/node_modules \
|
|
||||||
yarn run build && mkdir /out && cp -Rf dist /out/
|
|
||||||
|
|
||||||
FROM scratch AS build-update
|
|
||||||
COPY --from=build /out /
|
|
||||||
|
|
||||||
FROM build AS build-validate
|
|
||||||
RUN --mount=type=bind,target=.,rw <<EOT
|
|
||||||
set -e
|
|
||||||
git add -A
|
|
||||||
cp -rf /out/* .
|
|
||||||
if [ -n "$(git status --porcelain -- dist)" ]; then
|
|
||||||
echo >&2 'ERROR: Build result differs. Please build first with "docker buildx bake build"'
|
|
||||||
git status --porcelain -- dist
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
EOT
|
|
||||||
|
|
||||||
FROM deps AS format
|
|
||||||
RUN --mount=type=bind,target=.,rw \
|
|
||||||
--mount=type=cache,target=/src/.yarn/cache \
|
|
||||||
--mount=type=cache,target=/src/node_modules \
|
|
||||||
yarn run format \
|
|
||||||
&& mkdir /out && find . -name '*.ts' -not -path './node_modules/*' -not -path './.yarn/*' | cpio -pdm /out
|
|
||||||
|
|
||||||
FROM scratch AS format-update
|
|
||||||
COPY --from=format /out /
|
|
||||||
|
|
||||||
FROM deps AS lint
|
|
||||||
RUN --mount=type=bind,target=.,rw \
|
|
||||||
--mount=type=cache,target=/src/.yarn/cache \
|
|
||||||
--mount=type=cache,target=/src/node_modules \
|
|
||||||
yarn run lint
|
|
||||||
|
|
||||||
FROM deps AS test
|
|
||||||
RUN --mount=type=bind,target=.,rw \
|
|
||||||
--mount=type=cache,target=/src/.yarn/cache \
|
|
||||||
--mount=type=cache,target=/src/node_modules \
|
|
||||||
yarn run test --coverage --coverageDirectory=/tmp/coverage
|
|
||||||
|
|
||||||
FROM scratch AS test-coverage
|
|
||||||
COPY --from=test /tmp/coverage /
|
|
1925
dist/index.js
generated
vendored
1925
dist/index.js
generated
vendored
File diff suppressed because one or more lines are too long
1
dist/index.js.map
generated
vendored
1
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
3869
dist/licenses.txt
generated
vendored
3869
dist/licenses.txt
generated
vendored
File diff suppressed because it is too large
Load Diff
1
dist/sourcemap-register.js
generated
vendored
1
dist/sourcemap-register.js
generated
vendored
File diff suppressed because one or more lines are too long
@ -1,6 +1,10 @@
|
|||||||
target "_common" {
|
variable "NODE_VERSION" {
|
||||||
|
default = "12"
|
||||||
|
}
|
||||||
|
|
||||||
|
target "node-version" {
|
||||||
args = {
|
args = {
|
||||||
BUILDKIT_CONTEXT_KEEP_GIT_DIR = 1
|
NODE_VERSION = NODE_VERSION
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -9,58 +13,48 @@ group "default" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group "pre-checkin" {
|
group "pre-checkin" {
|
||||||
targets = ["vendor", "format", "build"]
|
targets = ["vendor-update", "format", "build"]
|
||||||
}
|
}
|
||||||
|
|
||||||
group "validate" {
|
group "validate" {
|
||||||
targets = ["lint", "build-validate", "vendor-validate"]
|
targets = ["format-validate", "build-validate", "vendor-validate"]
|
||||||
}
|
}
|
||||||
|
|
||||||
target "build" {
|
target "build" {
|
||||||
inherits = ["_common"]
|
inherits = ["node-version"]
|
||||||
dockerfile = "dev.Dockerfile"
|
dockerfile = "./hack/build.Dockerfile"
|
||||||
target = "build-update"
|
target = "build-update"
|
||||||
output = ["."]
|
output = ["."]
|
||||||
}
|
}
|
||||||
|
|
||||||
target "build-validate" {
|
target "build-validate" {
|
||||||
inherits = ["_common"]
|
inherits = ["node-version"]
|
||||||
dockerfile = "dev.Dockerfile"
|
dockerfile = "./hack/build.Dockerfile"
|
||||||
target = "build-validate"
|
target = "build-validate"
|
||||||
output = ["type=cacheonly"]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
target "format" {
|
target "format" {
|
||||||
inherits = ["_common"]
|
inherits = ["node-version"]
|
||||||
dockerfile = "dev.Dockerfile"
|
dockerfile = "./hack/build.Dockerfile"
|
||||||
target = "format-update"
|
target = "format-update"
|
||||||
output = ["."]
|
output = ["."]
|
||||||
}
|
}
|
||||||
|
|
||||||
target "lint" {
|
target "format-validate" {
|
||||||
inherits = ["_common"]
|
inherits = ["node-version"]
|
||||||
dockerfile = "dev.Dockerfile"
|
dockerfile = "./hack/build.Dockerfile"
|
||||||
target = "lint"
|
target = "format-validate"
|
||||||
output = ["type=cacheonly"]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
target "vendor" {
|
target "vendor-update" {
|
||||||
inherits = ["_common"]
|
inherits = ["node-version"]
|
||||||
dockerfile = "dev.Dockerfile"
|
dockerfile = "./hack/vendor.Dockerfile"
|
||||||
target = "vendor-update"
|
target = "update"
|
||||||
output = ["."]
|
output = ["."]
|
||||||
}
|
}
|
||||||
|
|
||||||
target "vendor-validate" {
|
target "vendor-validate" {
|
||||||
inherits = ["_common"]
|
inherits = ["node-version"]
|
||||||
dockerfile = "dev.Dockerfile"
|
dockerfile = "./hack/vendor.Dockerfile"
|
||||||
target = "vendor-validate"
|
target = "validate"
|
||||||
output = ["type=cacheonly"]
|
|
||||||
}
|
|
||||||
|
|
||||||
target "test" {
|
|
||||||
inherits = ["_common"]
|
|
||||||
dockerfile = "dev.Dockerfile"
|
|
||||||
target = "test-coverage"
|
|
||||||
output = ["./coverage"]
|
|
||||||
}
|
}
|
||||||
|
42
hack/build.Dockerfile
Normal file
42
hack/build.Dockerfile
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
# syntax=docker/dockerfile:1.2
|
||||||
|
ARG NODE_VERSION
|
||||||
|
|
||||||
|
FROM node:${NODE_VERSION}-alpine AS base
|
||||||
|
RUN apk add --no-cache cpio findutils git
|
||||||
|
WORKDIR /src
|
||||||
|
|
||||||
|
FROM base AS deps
|
||||||
|
RUN --mount=type=bind,target=.,rw \
|
||||||
|
--mount=type=cache,target=/src/node_modules \
|
||||||
|
yarn install
|
||||||
|
|
||||||
|
FROM deps AS build
|
||||||
|
RUN --mount=type=bind,target=.,rw \
|
||||||
|
--mount=type=cache,target=/src/node_modules \
|
||||||
|
yarn run build && mkdir /out && cp -Rf dist /out/
|
||||||
|
|
||||||
|
FROM scratch AS build-update
|
||||||
|
COPY --from=build /out /
|
||||||
|
|
||||||
|
FROM build AS build-validate
|
||||||
|
RUN --mount=type=bind,target=.,rw \
|
||||||
|
git add -A && cp -rf /out/* .; \
|
||||||
|
if [ -n "$(git status --porcelain -- dist)" ]; then \
|
||||||
|
echo >&2 'ERROR: Build result differs. Please build first with "docker buildx bake build"'; \
|
||||||
|
git status --porcelain -- dist; \
|
||||||
|
exit 1; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
FROM deps AS format
|
||||||
|
RUN --mount=type=bind,target=.,rw \
|
||||||
|
--mount=type=cache,target=/src/node_modules \
|
||||||
|
yarn run format \
|
||||||
|
&& mkdir /out && find . -name '*.ts' -not -path './node_modules/*' | cpio -pdm /out
|
||||||
|
|
||||||
|
FROM scratch AS format-update
|
||||||
|
COPY --from=format /out /
|
||||||
|
|
||||||
|
FROM deps AS format-validate
|
||||||
|
RUN --mount=type=bind,target=.,rw \
|
||||||
|
--mount=type=cache,target=/src/node_modules \
|
||||||
|
yarn run format-check \
|
23
hack/vendor.Dockerfile
Normal file
23
hack/vendor.Dockerfile
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# syntax=docker/dockerfile:1.2
|
||||||
|
ARG NODE_VERSION
|
||||||
|
|
||||||
|
FROM node:${NODE_VERSION}-alpine AS base
|
||||||
|
RUN apk add --no-cache git
|
||||||
|
WORKDIR /src
|
||||||
|
|
||||||
|
FROM base AS vendored
|
||||||
|
RUN --mount=type=bind,target=.,rw \
|
||||||
|
--mount=type=cache,target=/src/node_modules \
|
||||||
|
yarn install && mkdir /out && cp yarn.lock /out
|
||||||
|
|
||||||
|
FROM scratch AS update
|
||||||
|
COPY --from=vendored /out /
|
||||||
|
|
||||||
|
FROM vendored AS validate
|
||||||
|
RUN --mount=type=bind,target=.,rw \
|
||||||
|
git add -A && cp -rf /out/* .; \
|
||||||
|
if [ -n "$(git status --porcelain -- yarn.lock)" ]; then \
|
||||||
|
echo >&2 'ERROR: Vendor result differs. Please vendor your package with "docker buildx bake vendor-update"'; \
|
||||||
|
git status --porcelain -- yarn.lock; \
|
||||||
|
exit 1; \
|
||||||
|
fi
|
@ -1,29 +0,0 @@
|
|||||||
import fs from 'fs';
|
|
||||||
import os from 'os';
|
|
||||||
import path from 'path';
|
|
||||||
|
|
||||||
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'docker-setup-qemu-action-'));
|
|
||||||
|
|
||||||
process.env = Object.assign({}, process.env, {
|
|
||||||
TEMP: tmpDir,
|
|
||||||
GITHUB_REPOSITORY: 'docker/setup-qemu-action',
|
|
||||||
RUNNER_TEMP: path.join(tmpDir, 'runner-temp'),
|
|
||||||
RUNNER_TOOL_CACHE: path.join(tmpDir, 'runner-tool-cache')
|
|
||||||
}) as {
|
|
||||||
[key: string]: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
clearMocks: true,
|
|
||||||
moduleFileExtensions: ['js', 'ts'],
|
|
||||||
testMatch: ['**/*.test.ts'],
|
|
||||||
transform: {
|
|
||||||
'^.+\\.ts$': 'ts-jest'
|
|
||||||
},
|
|
||||||
moduleNameMapper: {
|
|
||||||
'^csv-parse/sync': '<rootDir>/node_modules/csv-parse/dist/cjs/sync.cjs'
|
|
||||||
},
|
|
||||||
collectCoverageFrom: ['src/**/{!(main.ts),}.ts'],
|
|
||||||
coveragePathIgnorePatterns: ['lib/', 'node_modules/', '__mocks__/', '__tests__/'],
|
|
||||||
verbose: true
|
|
||||||
};
|
|
45
package.json
45
package.json
@ -1,16 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "docker-setup-qemu",
|
"name": "docker-setup-qemu",
|
||||||
"description": "Install QEMU static binaries",
|
"description": "Install QEMU static binaries",
|
||||||
"main": "src/main.ts",
|
"main": "lib/main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "ncc build src/main.ts --source-map --minify --license licenses.txt",
|
"build": "tsc && ncc build",
|
||||||
"lint": "yarn run prettier && yarn run eslint",
|
"format": "prettier --write **/*.ts",
|
||||||
"format": "yarn run prettier:fix && yarn run eslint:fix",
|
"format-check": "prettier --check **/*.ts",
|
||||||
"eslint": "eslint --max-warnings=0 .",
|
"pre-checkin": "yarn run format && yarn run build"
|
||||||
"eslint:fix": "eslint --fix .",
|
|
||||||
"prettier": "prettier --check \"./**/*.ts\"",
|
|
||||||
"prettier:fix": "prettier --write \"./**/*.ts\"",
|
|
||||||
"test": "jest"
|
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@ -21,26 +17,23 @@
|
|||||||
"docker",
|
"docker",
|
||||||
"qemu"
|
"qemu"
|
||||||
],
|
],
|
||||||
"author": "Docker Inc.",
|
"author": "Docker",
|
||||||
|
"contributors": [
|
||||||
|
{
|
||||||
|
"name": "CrazyMax",
|
||||||
|
"url": "https://crazymax.dev"
|
||||||
|
}
|
||||||
|
],
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"packageManager": "yarn@3.6.3",
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.11.1",
|
"@actions/core": "^1.3.0",
|
||||||
"@docker/actions-toolkit": "^0.56.0"
|
"@actions/exec": "^1.0.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^20.12.12",
|
"@types/node": "^14.0.14",
|
||||||
"@typescript-eslint/eslint-plugin": "^7.9.0",
|
"@vercel/ncc": "^0.23.0",
|
||||||
"@typescript-eslint/parser": "^7.9.0",
|
"prettier": "^2.0.5",
|
||||||
"@vercel/ncc": "^0.38.1",
|
"typescript": "^3.9.5",
|
||||||
"eslint": "^8.57.0",
|
"typescript-formatter": "^7.2.2"
|
||||||
"eslint-config-prettier": "^9.1.0",
|
|
||||||
"eslint-plugin-jest": "^28.5.0",
|
|
||||||
"eslint-plugin-prettier": "^5.1.3",
|
|
||||||
"jest": "^29.7.0",
|
|
||||||
"prettier": "^3.2.5",
|
|
||||||
"ts-jest": "^29.1.2",
|
|
||||||
"ts-node": "^10.9.2",
|
|
||||||
"typescript": "^5.4.5"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
import * as core from '@actions/core';
|
|
||||||
import {Util} from '@docker/actions-toolkit/lib/util';
|
|
||||||
|
|
||||||
export interface Inputs {
|
|
||||||
image: string;
|
|
||||||
platforms: string;
|
|
||||||
cacheImage: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getInputs(): Inputs {
|
|
||||||
return {
|
|
||||||
image: core.getInput('image') || 'docker.io/tonistiigi/binfmt:latest',
|
|
||||||
platforms: Util.getInputList('platforms').join(',') || 'all',
|
|
||||||
cacheImage: core.getBooleanInput('cache-image')
|
|
||||||
};
|
|
||||||
}
|
|
34
src/exec.ts
Normal file
34
src/exec.ts
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
import * as actionsExec from '@actions/exec';
|
||||||
|
import {ExecOptions} from '@actions/exec';
|
||||||
|
|
||||||
|
export interface ExecResult {
|
||||||
|
success: boolean;
|
||||||
|
stdout: string;
|
||||||
|
stderr: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const exec = async (command: string, args: string[] = [], silent: boolean): Promise<ExecResult> => {
|
||||||
|
let stdout: string = '';
|
||||||
|
let stderr: string = '';
|
||||||
|
|
||||||
|
const options: ExecOptions = {
|
||||||
|
silent: silent,
|
||||||
|
ignoreReturnCode: true
|
||||||
|
};
|
||||||
|
options.listeners = {
|
||||||
|
stdout: (data: Buffer) => {
|
||||||
|
stdout += data.toString();
|
||||||
|
},
|
||||||
|
stderr: (data: Buffer) => {
|
||||||
|
stderr += data.toString();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const returnCode: number = await actionsExec.exec(command, args, options);
|
||||||
|
|
||||||
|
return {
|
||||||
|
success: returnCode === 0,
|
||||||
|
stdout: stdout.trim(),
|
||||||
|
stderr: stderr.trim()
|
||||||
|
};
|
||||||
|
};
|
95
src/main.ts
95
src/main.ts
@ -1,70 +1,53 @@
|
|||||||
import * as context from './context';
|
import * as mexec from './exec';
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import * as actionsToolkit from '@docker/actions-toolkit';
|
import * as exec from '@actions/exec';
|
||||||
|
import {issueCommand} from '@actions/core/lib/command';
|
||||||
import {Docker} from '@docker/actions-toolkit/lib/docker/docker';
|
|
||||||
|
|
||||||
interface Platforms {
|
interface Platforms {
|
||||||
supported: string[];
|
supported: string[];
|
||||||
available: string[];
|
available: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
actionsToolkit.run(
|
async function run(): Promise<void> {
|
||||||
// main
|
try {
|
||||||
async () => {
|
core.startGroup(`Docker info`);
|
||||||
const input: context.Inputs = context.getInputs();
|
await exec.exec('docker', ['version']);
|
||||||
|
await exec.exec('docker', ['info']);
|
||||||
|
core.endGroup();
|
||||||
|
|
||||||
await core.group(`Docker info`, async () => {
|
const image: string = core.getInput('image') || 'tonistiigi/binfmt:latest';
|
||||||
await Docker.printVersion();
|
const platforms: string = core.getInput('platforms') || 'all';
|
||||||
await Docker.printInfo();
|
|
||||||
});
|
|
||||||
|
|
||||||
await core.group(`Pulling binfmt Docker image`, async () => {
|
core.startGroup(`Pulling binfmt Docker image`);
|
||||||
await Docker.pull(input.image, input.cacheImage);
|
await exec.exec('docker', ['pull', image]);
|
||||||
});
|
core.endGroup();
|
||||||
|
|
||||||
await core.group(`Image info`, async () => {
|
core.startGroup(`Image info`);
|
||||||
await Docker.getExecOutput(['image', 'inspect', input.image], {
|
await exec.exec('docker', ['image', 'inspect', image]);
|
||||||
ignoreReturnCode: true
|
core.endGroup();
|
||||||
}).then(res => {
|
|
||||||
if (res.stderr.length > 0 && res.exitCode != 0) {
|
|
||||||
throw new Error(res.stderr.match(/(.*)\s*$/)?.[0]?.trim() ?? 'unknown error');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
await core.group(`Binfmt version`, async () => {
|
core.startGroup(`Installing QEMU static binaries`);
|
||||||
await Docker.getExecOutput(['run', '--rm', '--privileged', input.image, '--version'], {
|
await exec.exec('docker', ['run', '--rm', '--privileged', image, '--install', platforms]);
|
||||||
ignoreReturnCode: true
|
core.endGroup();
|
||||||
}).then(res => {
|
|
||||||
if (res.stderr.length > 0 && res.exitCode != 0) {
|
|
||||||
throw new Error(res.stderr.match(/(.*)\s*$/)?.[0]?.trim() ?? 'unknown error');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
await core.group(`Installing QEMU static binaries`, async () => {
|
core.startGroup(`Extracting available platforms`);
|
||||||
await Docker.getExecOutput(['run', '--rm', '--privileged', input.image, '--install', input.platforms], {
|
await mexec.exec(`docker`, ['run', '--rm', '--privileged', image], true).then(res => {
|
||||||
ignoreReturnCode: true
|
if (res.stderr != '' && !res.success) {
|
||||||
}).then(res => {
|
throw new Error(res.stderr);
|
||||||
if (res.stderr.length > 0 && res.exitCode != 0) {
|
}
|
||||||
throw new Error(res.stderr.match(/(.*)\s*$/)?.[0]?.trim() ?? 'unknown error');
|
const platforms: Platforms = JSON.parse(res.stdout.trim());
|
||||||
}
|
core.info(`${platforms.supported.join(',')}`);
|
||||||
});
|
setOutput('platforms', platforms.supported.join(','));
|
||||||
});
|
|
||||||
|
|
||||||
await core.group(`Extracting available platforms`, async () => {
|
|
||||||
await Docker.getExecOutput(['run', '--rm', '--privileged', input.image], {
|
|
||||||
ignoreReturnCode: true,
|
|
||||||
silent: true
|
|
||||||
}).then(res => {
|
|
||||||
if (res.stderr.length > 0 && res.exitCode != 0) {
|
|
||||||
throw new Error(res.stderr.match(/(.*)\s*$/)?.[0]?.trim() ?? 'unknown error');
|
|
||||||
}
|
|
||||||
const platforms: Platforms = JSON.parse(res.stdout.trim());
|
|
||||||
core.info(`${platforms.supported.join(',')}`);
|
|
||||||
core.setOutput('platforms', platforms.supported.join(','));
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
core.endGroup();
|
||||||
|
} catch (error) {
|
||||||
|
core.setFailed(error.message);
|
||||||
}
|
}
|
||||||
);
|
}
|
||||||
|
|
||||||
|
// FIXME: Temp fix https://github.com/actions/toolkit/issues/777
|
||||||
|
function setOutput(name: string, value: any): void {
|
||||||
|
issueCommand('set-output', {name}, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
run();
|
||||||
|
@ -1,21 +1,18 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"esModuleInterop": true,
|
|
||||||
"target": "es6",
|
"target": "es6",
|
||||||
"module": "commonjs",
|
"module": "commonjs",
|
||||||
"strict": true,
|
"lib": [
|
||||||
|
"es6",
|
||||||
|
"dom"
|
||||||
|
],
|
||||||
"newLine": "lf",
|
"newLine": "lf",
|
||||||
"outDir": "./lib",
|
"outDir": "./lib",
|
||||||
"rootDir": "./src",
|
"rootDir": "./src",
|
||||||
"forceConsistentCasingInFileNames": true,
|
"strict": true,
|
||||||
"noImplicitAny": false,
|
"noImplicitAny": false,
|
||||||
"resolveJsonModule": true,
|
"esModuleInterop": true,
|
||||||
"useUnknownInCatchVariables": false,
|
"sourceMap": true
|
||||||
},
|
},
|
||||||
"exclude": [
|
"exclude": ["node_modules", "**/*.test.ts"]
|
||||||
"./__tests__/**/*",
|
|
||||||
"./lib/**/*",
|
|
||||||
"node_modules",
|
|
||||||
"jest.config.ts"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user