Skip to content

Commit

Permalink
Try #829: --target mips64-unknown-linux-muslabi64
Browse files Browse the repository at this point in the history
  • Loading branch information
bors[bot] authored Jun 28, 2022
2 parents 7ad8357 + cd9934a commit 94f6077
Show file tree
Hide file tree
Showing 8 changed files with 183 additions and 8 deletions.
2 changes: 2 additions & 0 deletions .github/actions/cargo-install-upload-artifacts/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ runs:
--root ${{ steps.metadata.outputs.out-dir }}
--bins
use-cross: true
env:
RUSTFLAGS: "" # Make sure to unset RUSTFLAGS

- name: Archive artifacts
id: archive
Expand Down
67 changes: 67 additions & 0 deletions .github/actions/cargo-llvm-cov/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: llvm coverage
description: Sets up everything that is needed for coverage. Makes artifacts available for processing later, prefixed with _coverage-
inputs:
name:
description: 'the name of the artifact'
required: true
outputs:
artifact-name:
description: 'the name of the artifact'
value: ${{ steps.cov.outputs.artifact-name }}
runs:
using: composite
steps:
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@v1
with:
tool: cargo-llvm-cov
- run: rustup component add llvm-tools-preview
shell: bash
- name: LLVM instrument coverage
id: cov
uses: ./.github/actions/post
if: always()
with:
main: |
pwd=$(pwd)
if which cygpath; then
pwd="$(cygpath -w "$(pwd)")"
fi
echo RUSTFLAGS=" -C instrument-coverage --remap-path-prefix ${pwd}=" >> $GITHUB_ENV
echo LLVM_PROFILE_FILE="${pwd}/target/cross-%m.profraw" >> $GITHUB_ENV
echo CARGO_INCREMENTAL="0" >> $GITHUB_ENV
echo RUST_TEST_THREADS="1" >> $GITHUB_ENV
echo "::set-output name=artifact-name::_coverage-${name}"
post: |
# XXX(emilgardis): Upload early?
pwd=$(pwd)
if which cygpath; then
pwd="$(cygpath -w "$(pwd)")"
fi
# No pwd needed here, we're in the root
export LLVM_PROFILE_FILE="${pwd}/target/cross-%m.profraw"
export CARGO_LLVM_COV_TARGET_DIR="${pwd}/target"
mkdir coverage
echo $(ls target)
cargo llvm-cov --no-run --remap-path-prefix --lcov --output-path "coverage/lcov.${name}.info" -vv || ( echo "::error title=Coverage merge failed::" && exit 0 )
rm target/*.profraw
npm install @actions/artifact
npm install glob
cat <<-EOT | node - || ( echo "::error title=Coverage upload failed::" && exit 0 )
(async function main() {
var artifact = require('@actions/artifact');
var glob = require('glob')
const artifactClient = artifact.create();
const artifactName = '_coverage-' + process.env.name;
const files = glob.sync("coverage/*");
if (!files.length) {
process.exit(0);
}
console.log("${files}")
const options = { retentionDays: 2 };
const upload = await artifactClient.uploadArtifact(artifactName, files, "coverage", options);
})()
EOT
env:
name: ${{ inputs.name }}
4 changes: 2 additions & 2 deletions .github/actions/cargo-publish/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ runs:
shell: bash
env:
GITHUB_TOKEN: ${{ inputs.github-token }}

- name: Create GitHub release
if: >
github.event_name == 'push' && (
Expand All @@ -54,7 +54,7 @@ runs:
prerelease: ${{ startsWith(github.ref, 'refs/tags/v') && contains(github.ref_name, '-') }}
draft: ${{ !startsWith(github.ref, 'refs/tags/v') && steps.changelog-reader.outputs.status == 'unreleased' }}
files: |
${{ steps.download-artifacts.outputs.download-path }}/*/*
${{ steps.download-artifacts.outputs.download-path }}/cross-*/*
- name: Publish crate
uses: actions-rs/cargo@v1
Expand Down
14 changes: 14 additions & 0 deletions .github/actions/post/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# adapted from https://github.com/actions/runner/issues/1478
name: With post step
description: 'Generic JS Action to execute a main command and set a command in a post step.'
inputs:
main:
description: 'Main command/script.'
required: true
post:
description: 'Post command/script.'
required: true
runs:
using: 'node16'
main: 'main.js'
post: 'main.js'
26 changes: 26 additions & 0 deletions .github/actions/post/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// adapted from https://github.com/actions/runner/issues/1478
const { exec } = require("child_process");

function run(cmd) {
exec(cmd, { shell: "bash" }, (error, stdout, stderr) => {
if (stdout.length != 0) {
console.log(`${stdout}`);
}
if (stderr.length != 0) {
console.error(`${stderr}`);
}
if (error) {
process.exitCode = error.code;
console.error(`${error}`);
}
});
}

if (process.env[`STATE_POST`] != undefined) {
// Are we in the 'post' step?
run(process.env.INPUT_POST);
} else {
// Otherwise, this is the main step
console.log(`::save-state name=POST::true`);
run(process.env.INPUT_MAIN);
}
14 changes: 14 additions & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
comment: false
codecov:
branch: main
coverage:
status:
project:
default:
informational: true
patch:
default:
informational: true
flag_management:
default_rules: # the rules that will be followed for any flag added, generally
carryforward: true
57 changes: 53 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ jobs:
- uses: actions/checkout@v3

- uses: ./.github/actions/setup-rust
- uses: ./.github/actions/cargo-llvm-cov
with:
name: test-${{matrix.os}}

- name: Run unit tests
uses: actions-rs/cargo@v1
Expand Down Expand Up @@ -217,6 +220,7 @@ jobs:
outputs:
has-image: ${{ steps.prepare-meta.outputs.has-image }}
images: ${{ steps.build-docker-image.outputs.images && fromJSON(steps.build-docker-image.outputs.images) }}
coverage-artifact: ${{ steps.cov.outputs.artifact-name }}
steps:
- uses: actions/checkout@v3

Expand All @@ -226,12 +230,9 @@ jobs:
if: runner.os == 'Linux'
uses: docker/setup-buildx-action@v1

- name: Install cross
if: matrix.deploy
run: cargo install --path . --force

- name: Build xtask
run: cargo build -p xtask

- name: Prepare Meta
id: prepare-meta
timeout-minutes: 60
Expand All @@ -240,6 +241,18 @@ jobs:
TARGET: ${{ matrix.target }}
SUB: ${{ matrix.sub }}
shell: bash

- name: LLVM instrument coverage
id: cov
uses: ./.github/actions/cargo-llvm-cov
if: steps.prepare-meta.outputs.has-image
with:
name: cross-${{matrix.pretty}}

- name: Install cross
if: matrix.deploy
run: cargo install --path . --force --debug

- name: Docker Meta
if: steps.prepare-meta.outputs.has-image
id: docker-meta
Expand Down Expand Up @@ -332,3 +345,39 @@ jobs:
"$(jq -r 'all(.result as $result | (["success", "skipped"] | contains([$result])))' <<< "${needs}")"
env:
needs: ${{ toJson(needs) }}

code-cov:
name: Coverage
needs: [test, build, conclusion, generate-matrix]
# should check that there are any artifacts, if not skip
if: always() && (needs.build.result == 'success' || needs.build.result == 'skipped') && needs.test.result == 'success'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-rust
- uses: actions/download-artifact@v3
with:
path: ${{ runner.temp }}/artifacts
- name: Grab PR number
run: echo "::set-output name=pr::"$(echo $commit_message | sed -ne 's/.*\#\(.*\):/\1/p')
id: pr-number
if: ${{ !github.event.pull_request.number }}
env:
commit_message: >
${{
((
startsWith(github.event.head_commit.message, 'Try #') &&
github.event.head_commit.author.username == 'bors[bot]'
) && github.event.head_commit.message) || ''
}}
- name: Upload to codecov.io
run: |
set -x
curl -Os https://uploader.codecov.io/latest/linux/codecov
chmod +x codecov
sha_rev=$(git rev-parse HEAD)
find ${artifacts} -name "lcov.*.info" -exec ./codecov -F $(echo {} | sed -n 's/lcov\.\(.*\)\.info/\1/p') \
${pr:+-P ${pr}} -f {} --sha ${sha_rev} -n $(echo {} | sed -n 's/lcov\.\(.*\)\.info/\1/p') \;
env:
pr: ${{ steps.pr-number.outputs.pr || '' }}
artifacts: ${{ runner.temp }}/artifacts
7 changes: 5 additions & 2 deletions ci/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ main() {
local td=

retry cargo fetch
cargo install --force --path .
cargo install --force --path . --debug

# Unset RUSTFLAGS
export RUSTFLAGS=""

export QEMU_STRACE=1

Expand Down Expand Up @@ -165,7 +168,7 @@ main() {
--depth 1 \
--recursive \
https://github.com/cross-rs/test-workspace "${td}"

pushd "${td}"
TARGET="${TARGET}" workspace_test --manifest-path="./workspace/Cargo.toml"
pushd "workspace"
Expand Down

0 comments on commit 94f6077

Please sign in to comment.