Skip to content

ci: hash_to_args => hash_to_argv #5

ci: hash_to_args => hash_to_argv

ci: hash_to_args => hash_to_argv #5

Workflow file for this run

name: build rs-crate (cross)
# auto-task.start-build-time = ?
on:
schedule:
- cron: '30 20 20 */2 *'
push:
paths:
- .github/workflows/cross-x64.yml
- ci/cross.dockerfile
env:
default_ci_shell: ruby cinnabar/ci/preload.rb {0}
RUBYOPT: "--disable=gems"
cargo_build_profile: thin
ghcr_repo: 'ghcr.io/2cd/pkgs'
cargo_target: 'x86_64-unknown-linux-musl'
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
shell: ${{env.default_ci_shell}}
env:
CARGO_TARGET_DIR: /tmp/rs
steps:
- uses: actions/checkout@v4
with:
ref: main
repository: cross-rs/cross
- name: clone cinnabar
uses: actions/checkout@v4
with:
repository: 2moe/cinnabar
path: cinnabar
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
${{env.CARGO_TARGET_DIR}}
key: ${{ runner.os }}-cargo-cross
- name: add cargo profile
run: |
File.open('Cargo.toml', 'a') do
_1.puts <<~'TOML'
[profile.${{env.cargo_build_profile}}]
inherits = "release"
panic = "abort"
opt-level = 3
strip = true
lto = "thin"
TOML
end
- name: cargo build
run: |
pp `cargo -Vv`
%w[rustup target add ${{env.cargo_target}}].then(&run)
apt = %w[sudo apt-get]
apt.dup.push('update').then(&run)
apt.concat(%w[install -y musl-tools]).then(&run)
{
cargo: nil,
build: nil,
profile: '${{env.cargo_build_profile}}',
target: '${{env.cargo_target}}',
}
.then(&hash_to_argv)
.then(&run)
- uses: actions/checkout@v4
with:
path: pkgs
- name: tree
run: "%w[tree -L 2].then(&run)"
- name: build & push docker image
run: |
require_ci 'compression'
require_ci 'docker/build'
require_ci 'docker/manifest'
%w[tree -L 2]
.push('${{env.CARGO_TARGET_DIR}}')
.then(&run)
cfg = {
tag: 'cross-x64',
os: 'linux',
arch: 'x64',
docker_repo: '${{env.ghcr_repo}}',
docker_file: 'pkgs/ci/cross.dockerfile',
pkg_name: 'cross',
suffix: '',
target: '${{env.cargo_target}}',
}
[cfg, cfg.merge({pkg_name: 'cross-util'})].each do |x|
FileCompressor.new(x)
.cp_target_file_to_context
end
DockerBuild.new(cfg).build