Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Only use cross if a custom target is configured #55

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 21 additions & 11 deletions dist/build-crates-debian-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -127169,13 +127169,6 @@ var promises_ = __nccwpck_require__(73292);
var lib_core = __nccwpck_require__(42186);
// EXTERNAL MODULE: ./node_modules/@actions/artifact/lib/artifact.js
var artifact = __nccwpck_require__(79450);
// EXTERNAL MODULE: external "os"
var external_os_ = __nccwpck_require__(22037);
// EXTERNAL MODULE: external "path"
var external_path_ = __nccwpck_require__(71017);
var external_path_default = /*#__PURE__*/__nccwpck_require__.n(external_path_);
// EXTERNAL MODULE: ./node_modules/@actions/cache/lib/cache.js
var cache = __nccwpck_require__(27799);
;// CONCATENATED MODULE: ./node_modules/smol-toml/dist/error.js
/*!
* Copyright (c) Squirrel Chat et al., All rights reserved.
Expand Down Expand Up @@ -128139,6 +128132,13 @@ function parse(toml) {



// EXTERNAL MODULE: external "os"
var external_os_ = __nccwpck_require__(22037);
// EXTERNAL MODULE: external "path"
var external_path_ = __nccwpck_require__(71017);
var external_path_default = /*#__PURE__*/__nccwpck_require__.n(external_path_);
// EXTERNAL MODULE: ./node_modules/@actions/cache/lib/cache.js
var cache = __nccwpck_require__(27799);
// EXTERNAL MODULE: external "child_process"
var external_child_process_ = __nccwpck_require__(32081);
;// CONCATENATED MODULE: ./src/command.ts
Expand Down Expand Up @@ -128445,6 +128445,7 @@ function fromFiles(output, ...files) {




const build_crates_debian_artifact = new artifact.DefaultArtifactClient();
function setup() {
const repo = lib_core.getInput("repo", { required: true });
Expand All @@ -128467,10 +128468,19 @@ async function main(input) {
const repo = input.repo.split("/")[1];
const remote = `https://${input.githubToken}@github.com/${input.repo}.git`;
sh(`git clone --recursive --branch ${input.branch} --single-branch ${remote}`);
const crossContents = await promises_.readFile(external_path_default().join(repo, "Cross.toml"), "utf-8");
const crossManifest = parse(crossContents);
sh(`rustup target add ${input.target}`, { cwd: repo });
sh(`cross build --release --bins --lib --target ${input.target}`, {
cwd: repo,
});
if (input.target in crossManifest.target) {
sh(`cross build --release --bins --lib --target ${input.target}`, {
cwd: repo,
});
}
else {
sh(`cargo build --release --bins --lib --target ${input.target}`, {
cwd: repo,
});
}
const packages = await packagesDebian(repo);
lib_core.info(`Building ${packages.map(p => p.name).join(", ")}`);
for (const package_ of packages) {
Expand Down Expand Up @@ -128500,7 +128510,7 @@ const artifactRegExp = /^.*-debian\.zip$/;
async function cleanup(input) {
const repoPath = input.repo.split("/")[1];
lib_core.info(`Deleting repository ${repoPath}`);
await (0,promises_.rm)(repoPath, { recursive: true, force: true });
await promises_.rm(repoPath, { recursive: true, force: true });
}


Expand Down
26 changes: 18 additions & 8 deletions dist/publish-crates-debian-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -127237,10 +127237,6 @@ async function withIdentity(privateKey, passphrase, fn) {
// EXTERNAL MODULE: external "path"
var external_path_ = __nccwpck_require__(71017);
var external_path_default = /*#__PURE__*/__nccwpck_require__.n(external_path_);
// EXTERNAL MODULE: external "os"
var external_os_ = __nccwpck_require__(22037);
// EXTERNAL MODULE: ./node_modules/@actions/cache/lib/cache.js
var lib_cache = __nccwpck_require__(27799);
;// CONCATENATED MODULE: ./node_modules/smol-toml/dist/error.js
/*!
* Copyright (c) Squirrel Chat et al., All rights reserved.
Expand Down Expand Up @@ -128204,6 +128200,10 @@ function parse(toml) {



// EXTERNAL MODULE: external "os"
var external_os_ = __nccwpck_require__(22037);
// EXTERNAL MODULE: ./node_modules/@actions/cache/lib/cache.js
var lib_cache = __nccwpck_require__(27799);
;// CONCATENATED MODULE: ./src/config.ts
const config_config = __nccwpck_require__(16035);
const gitEnv = {
Expand Down Expand Up @@ -128467,6 +128467,7 @@ function fromFiles(output, ...files) {




const build_crates_debian_artifact = new artifact.DefaultArtifactClient();
function setup() {
const repo = core.getInput("repo", { required: true });
Expand All @@ -128489,10 +128490,19 @@ async function main(input) {
const repo = input.repo.split("/")[1];
const remote = `https://${input.githubToken}@github.com/${input.repo}.git`;
sh(`git clone --recursive --branch ${input.branch} --single-branch ${remote}`);
const crossContents = await fs.readFile(path.join(repo, "Cross.toml"), "utf-8");
const crossManifest = toml.parse(crossContents);
sh(`rustup target add ${input.target}`, { cwd: repo });
sh(`cross build --release --bins --lib --target ${input.target}`, {
cwd: repo,
});
if (input.target in crossManifest.target) {
sh(`cross build --release --bins --lib --target ${input.target}`, {
cwd: repo,
});
}
else {
sh(`cargo build --release --bins --lib --target ${input.target}`, {
cwd: repo,
});
}
const packages = await cargo.packagesDebian(repo);
core.info(`Building ${packages.map(p => p.name).join(", ")}`);
for (const package_ of packages) {
Expand Down Expand Up @@ -128522,7 +128532,7 @@ const artifactRegExp = /^.*-debian\.zip$/;
async function cleanup(input) {
const repoPath = input.repo.split("/")[1];
core.info(`Deleting repository ${repoPath}`);
await rm(repoPath, { recursive: true, force: true });
await fs.rm(repoPath, { recursive: true, force: true });
}

;// CONCATENATED MODULE: ./src/publish-crates-debian.ts
Expand Down
26 changes: 18 additions & 8 deletions dist/publish-crates-github-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -127215,10 +127215,6 @@ var external_path_ = __nccwpck_require__(71017);
var external_path_default = /*#__PURE__*/__nccwpck_require__.n(external_path_);
// EXTERNAL MODULE: external "fs/promises"
var promises_ = __nccwpck_require__(73292);
// EXTERNAL MODULE: external "os"
var external_os_ = __nccwpck_require__(22037);
// EXTERNAL MODULE: ./node_modules/@actions/cache/lib/cache.js
var lib_cache = __nccwpck_require__(27799);
;// CONCATENATED MODULE: ./node_modules/smol-toml/dist/error.js
/*!
* Copyright (c) Squirrel Chat et al., All rights reserved.
Expand Down Expand Up @@ -128182,6 +128178,10 @@ function parse(toml) {



// EXTERNAL MODULE: external "os"
var external_os_ = __nccwpck_require__(22037);
// EXTERNAL MODULE: ./node_modules/@actions/cache/lib/cache.js
var lib_cache = __nccwpck_require__(27799);
;// CONCATENATED MODULE: ./src/config.ts
const config_config = __nccwpck_require__(16035);
const gitEnv = {
Expand Down Expand Up @@ -128445,6 +128445,7 @@ function fromFiles(output, ...files) {




const build_crates_debian_artifact = new artifact.DefaultArtifactClient();
function setup() {
const repo = core.getInput("repo", { required: true });
Expand All @@ -128467,10 +128468,19 @@ async function main(input) {
const repo = input.repo.split("/")[1];
const remote = `https://${input.githubToken}@github.com/${input.repo}.git`;
sh(`git clone --recursive --branch ${input.branch} --single-branch ${remote}`);
const crossContents = await fs.readFile(path.join(repo, "Cross.toml"), "utf-8");
const crossManifest = toml.parse(crossContents);
sh(`rustup target add ${input.target}`, { cwd: repo });
sh(`cross build --release --bins --lib --target ${input.target}`, {
cwd: repo,
});
if (input.target in crossManifest.target) {
sh(`cross build --release --bins --lib --target ${input.target}`, {
cwd: repo,
});
}
else {
sh(`cargo build --release --bins --lib --target ${input.target}`, {
cwd: repo,
});
}
const packages = await cargo.packagesDebian(repo);
core.info(`Building ${packages.map(p => p.name).join(", ")}`);
for (const package_ of packages) {
Expand Down Expand Up @@ -128500,7 +128510,7 @@ const artifactRegExp = /^.*-debian\.zip$/;
async function cleanup(input) {
const repoPath = input.repo.split("/")[1];
core.info(`Deleting repository ${repoPath}`);
await rm(repoPath, { recursive: true, force: true });
await fs.rm(repoPath, { recursive: true, force: true });
}

;// CONCATENATED MODULE: ./src/build-crates-standalone.ts
Expand Down
24 changes: 19 additions & 5 deletions src/build-crates-debian.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { rm } from "fs/promises";
import * as fs from "fs/promises";

import * as core from "@actions/core";
import { DefaultArtifactClient } from "@actions/artifact";
import * as toml from "smol-toml";

import * as cargo from "./cargo";
import { sh } from "./command";
Expand Down Expand Up @@ -43,11 +44,20 @@ export async function main(input: Input) {
const remote = `https://${input.githubToken}@github.com/${input.repo}.git`;
sh(`git clone --recursive --branch ${input.branch} --single-branch ${remote}`);

const crossContents = await fs.readFile(path.join(repo, "Cross.toml"), "utf-8");
const crossManifest = toml.parse(crossContents) as CrossManifest;

sh(`rustup target add ${input.target}`, { cwd: repo });

sh(`cross build --release --bins --lib --target ${input.target}`, {
cwd: repo,
});
if (input.target in crossManifest.target) {
sh(`cross build --release --bins --lib --target ${input.target}`, {
cwd: repo,
});
} else {
sh(`cargo build --release --bins --lib --target ${input.target}`, {
cwd: repo,
});
}

const packages = await cargo.packagesDebian(repo);
core.info(`Building ${packages.map(p => p.name).join(", ")}`);
Expand Down Expand Up @@ -77,6 +87,10 @@ export async function main(input: Input) {
}
}

type CrossManifest = {
target: { [target: string]: { image: string } };
};

export function artifactName(repo: string, version: string, target: string): string {
return `${repo}-${version}-${target}-debian.zip`;
}
Expand All @@ -86,5 +100,5 @@ export const artifactRegExp: RegExp = /^.*-debian\.zip$/;
export async function cleanup(input: Input) {
const repoPath = input.repo.split("/")[1];
core.info(`Deleting repository ${repoPath}`);
await rm(repoPath, { recursive: true, force: true });
await fs.rm(repoPath, { recursive: true, force: true });
}