-
Notifications
You must be signed in to change notification settings - Fork 390
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
609: switch to GHCR and use more github actions r=reitermarkus a=Emilgardis addresses #607 #571 ## what this does - [x] change default registry to look for cross images to `ghcr.io` - [x] move from azure CI for docker images to GHA - [x] add clippy (that does not fail job, can be made to do this later) and rustfmt - [x] bump QEMU to 5.1 - [ ] Add (better) layer caching ## Some nice things to have/include - [x] Cache docker images, possibly using buildx (probably out of scope of this pr) - [x] Use actions/cache - [ ] make configuration easier to maintain - [ ] possibly replace docker setup with actions Co-authored-by: Emil Gardström <[email protected]> Co-authored-by: Marco A L Barbosa <[email protected]> Co-authored-by: Jesse Szwedko <[email protected]> Co-authored-by: Will <[email protected]> Co-authored-by: Sven-Hendrik Haase <[email protected]> Co-authored-by: Joe Richey <[email protected]> Co-authored-by: Markus Reiter <[email protected]>
- Loading branch information
Showing
31 changed files
with
730 additions
and
415 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,85 @@ | ||
inputs: | ||
target: | ||
description: 'Target' | ||
type: string | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Check if crate has binaries | ||
id: metadata | ||
run: | | ||
metadata="$(cargo metadata --format-version 1 --no-deps)" | ||
package_name="$(jq -r '.packages[0].name' <<< "${metadata}")" | ||
has_binaries="$(jq '.packages[0].targets | any(.kind | contains(["bin"]))' <<< "${metadata}")" | ||
echo "::set-output name=package-name::${package_name}" | ||
echo "::set-output name=has-binaries::${has_binaries}" | ||
out_dir="$(mktemp -d)" | ||
artifacts_dir="$(mktemp -d)" | ||
if which cygpath; then | ||
out_dir="$(cygpath -w "${out_dir}")" | ||
artifacts_dir="$(cygpath -w "${artifacts_dir}")" | ||
fi | ||
echo "::set-output name=out-dir::${out_dir}" | ||
echo "::set-output name=artifacts-dir::${artifacts_dir}" | ||
shell: bash | ||
|
||
- name: Build with all features | ||
if: ${{ fromJson(steps.metadata.outputs.has-binaries) }} | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: install | ||
args: > | ||
--locked | ||
--path . | ||
--target ${{ inputs.target }} | ||
--all-features | ||
--root ${{ steps.metadata.outputs.out-dir }} | ||
--bins | ||
use-cross: true | ||
|
||
- name: Archive artifacts | ||
if: ${{ fromJson(steps.metadata.outputs.has-binaries) }} | ||
id: archive | ||
run: | | ||
set -x | ||
if which cygpath; then | ||
out_dir="$(cygpath -u "${out_dir}")" | ||
artifacts_dir="$(cygpath -u "${artifacts_dir}")" | ||
fi | ||
artifact_name="${package_name}-${target}" | ||
artifact_path="${artifacts_dir}/${artifact_name}.tar.gz" | ||
pushd "${out_dir}/bin" | ||
tar -cvzf "${artifact_path}" * | ||
popd | ||
tar -tf "${artifact_path}" | ||
ls -al "${artifact_path}" | ||
if which cygpath; then | ||
artifact_path="$(cygpath -w "${artifact_path}")" | ||
fi | ||
echo "::set-output name=name::${artifact_name}" | ||
echo "::set-output name=path::${artifact_path}" | ||
env: | ||
package_name: ${{ steps.metadata.outputs.package-name }} | ||
out_dir: ${{ steps.metadata.outputs.out-dir }} | ||
artifacts_dir: ${{ steps.metadata.outputs.artifacts-dir }} | ||
target: ${{ inputs.target }} | ||
shell: bash | ||
|
||
- name: Upload artifacts | ||
if: ${{ steps.archive.outputs.path }} | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ steps.archive.outputs.name }} | ||
path: ${{ steps.archive.outputs.path }} | ||
if-no-files-found: error |
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,51 @@ | ||
inputs: | ||
cargo-registry-token: | ||
description: 'API token for crates.io' | ||
type: string | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Read changelog | ||
id: changelog-reader | ||
uses: mindsers/[email protected] | ||
with: | ||
validation_depth: 10 | ||
version: ${{ (github.ref_type == 'tag' && github.ref_name) || 'Unreleased' }} | ||
path: ./CHANGELOG.md | ||
|
||
- name: Download artifacts | ||
id: download-artifacts | ||
uses: actions/download-artifact@v3 | ||
with: | ||
path: | ||
${{ runner.temp }}/artifacts | ||
|
||
- name: Log into crates.io | ||
if: steps.cargo-toml-publish.outputs.value != 'false' && github.event_name != 'pull_request' | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: login | ||
args: -- ${{ inputs.cargo-registry-token }} | ||
|
||
- name: Create GitHub release | ||
if: > | ||
github.event_name == 'push' && ( | ||
github.ref == format('refs/heads/{0}', github.event.repository.default_branch) || | ||
startsWith(github.ref, 'refs/tags/v') | ||
) | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
tag: ${{ steps.changelog-reader.outputs.version }} | ||
name: ${{ steps.changelog-reader.outputs.version }} | ||
body: ${{ steps.changelog-reader.outputs.changes }} | ||
prerelease: ${{ steps.changelog-reader.outputs.status == 'prereleased' }} | ||
draft: ${{ steps.changelog-reader.outputs.status == 'unreleased' }} | ||
files: | | ||
${{ steps.download-artifacts.outputs.download-path }}/*/* | ||
- name: Publish crate | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: publish | ||
args: ${{ !startsWith(github.ref, 'refs/tags/v') && '--dry-run' || '' }} |
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,25 @@ | ||
inputs: | ||
toolchain: | ||
description: 'Toolchain' | ||
default: 1.58.1 | ||
type: string | ||
target: | ||
description: 'Target' | ||
type: string | ||
components: | ||
description: 'Components' | ||
type: string | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Install Rust toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: ${{ inputs.toolchain }} | ||
target: ${{ inputs.target }} | ||
default: true | ||
components: ${{ inputs.components }} | ||
profile: minimal | ||
|
||
- uses: Swatinem/[email protected] |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
block_labels = ["needs-decision"] | ||
delete_merged_branches = true | ||
required_approvals = 1 | ||
status = ["shellcheck"] | ||
status = ["conclusion"] | ||
timeout_sec = 21600 |
Oops, something went wrong.