From e5a40e00dd513f8506358bf024b68195b71869c3 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Tue, 27 Apr 2021 15:47:00 +0200 Subject: [PATCH] Remove os limitation --- .github/workflows/ci.yml | 32 +++++++++++++++++++++++++++++++- README.md | 5 ----- dist/index.js | 17 ++++++++--------- src/main.ts | 17 ++++++++--------- 4 files changed, 47 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d7de2a3..1185b06 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,7 +43,6 @@ jobs: driver-opts: network=host - name: Build and push - id: docker_build uses: ./ with: builder: ${{ steps.buildx.outputs.name }} @@ -56,3 +55,34 @@ jobs: name: Dump context if: always() uses: crazy-max/ghaction-dump-context@v1 + + error: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v2 + - + name: Stop docker + run: | + sudo systemctl stop docker + - + name: Build + id: bake + continue-on-error: true + uses: ./ + with: + files: | + ./test/config.hcl + - + name: Check + run: | + echo "${{ toJson(steps.bake) }}" + if [ "${{ steps.bake.outcome }}" != "failure" ] || [ "${{ steps.bake.conclusion }}" != "success" ]; then + echo "::error::Should have failed" + exit 1 + fi + - + name: Dump context + if: always() + uses: crazy-max/ghaction-dump-context@v1 diff --git a/README.md b/README.md index 8398bf7..4cc1e1e 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,6 @@ ___ * [Customizing](#customizing) * [inputs](#inputs) * [Keep up-to-date with GitHub Dependabot](#keep-up-to-date-with-github-dependabot) -* [Limitation](#limitation) ## Usage @@ -102,7 +101,3 @@ updates: schedule: interval: "daily" ``` - -## 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). diff --git a/dist/index.js b/dist/index.js index 1180904..4c3e40d 100644 --- a/dist/index.js +++ b/dist/index.js @@ -516,7 +516,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge }); }; Object.defineProperty(exports, "__esModule", { value: true }); -const os = __importStar(__webpack_require__(87)); const buildx = __importStar(__webpack_require__(295)); const context = __importStar(__webpack_require__(842)); const core = __importStar(__webpack_require__(186)); @@ -524,22 +523,22 @@ const exec = __importStar(__webpack_require__(514)); function run() { return __awaiter(this, void 0, void 0, function* () { try { - if (os.platform() !== 'linux') { - core.setFailed('Only supported on linux platform'); - return; - } + core.startGroup(`Docker info`); + yield exec.exec('docker', ['version']); + yield exec.exec('docker', ['info']); + core.endGroup(); if (!(yield buildx.isAvailable())) { - core.setFailed(`Buildx is required. See https://github.com/docker/setup-buildx-action to set up buildx.`); + core.setFailed(`Docker buildx is required. See https://github.com/docker/setup-buildx-action to set up buildx.`); return; } const buildxVersion = yield buildx.getVersion(); - core.info(`📣 Buildx version: ${buildxVersion}`); + core.info(`Using buildx ${buildxVersion}`); let inputs = yield context.getInputs(); const args = yield context.getArgs(inputs, buildxVersion); - core.startGroup(`💡 Bake definition`); + core.startGroup(`Bake definition`); yield exec.exec('docker', [...args, '--print']); core.endGroup(); - core.info(`🏃 Building...`); + core.info(`Building...`); yield exec.exec('docker', args); } catch (error) { diff --git a/src/main.ts b/src/main.ts index 15a6289..509ce52 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,4 +1,3 @@ -import * as os from 'os'; import * as buildx from './buildx'; import * as context from './context'; import * as core from '@actions/core'; @@ -6,27 +5,27 @@ import * as exec from '@actions/exec'; async function run(): Promise { try { - if (os.platform() !== 'linux') { - core.setFailed('Only supported on linux platform'); - return; - } + core.startGroup(`Docker info`); + await exec.exec('docker', ['version']); + await exec.exec('docker', ['info']); + core.endGroup(); if (!(await buildx.isAvailable())) { - core.setFailed(`Buildx is required. See https://github.com/docker/setup-buildx-action to set up buildx.`); + core.setFailed(`Docker buildx is required. See https://github.com/docker/setup-buildx-action to set up buildx.`); return; } const buildxVersion = await buildx.getVersion(); - core.info(`📣 Buildx version: ${buildxVersion}`); + core.info(`Using buildx ${buildxVersion}`); let inputs: context.Inputs = await context.getInputs(); const args: string[] = await context.getArgs(inputs, buildxVersion); - core.startGroup(`💡 Bake definition`); + core.startGroup(`Bake definition`); await exec.exec('docker', [...args, '--print']); core.endGroup(); - core.info(`🏃 Building...`); + core.info(`Building...`); await exec.exec('docker', args); } catch (error) { core.setFailed(error.message);