Files
install-action/.github/workflows/ci.yml
2023-07-19 03:21:43 +09:00

195 lines
10 KiB
YAML

name: CI
permissions:
contents: read
on:
pull_request:
push:
branches:
- main
- dev
schedule:
- cron: '0 1 * * *'
workflow_dispatch:
env:
CARGO_INCREMENTAL: 0
CARGO_NET_GIT_FETCH_WITH_CLI: true
CARGO_NET_RETRY: 10
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
RUSTFLAGS: -D warnings
RUSTUP_MAX_RETRIES: 10
defaults:
run:
shell: bash
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs:
tidy:
uses: taiki-e/workflows/.github/workflows/tidy.yml@main
test:
strategy:
fail-fast: false
matrix:
os:
- ubuntu-20.04
- ubuntu-22.04
tool:
# cargo-watch/watchexec-cli is supported by cargo-binstall (through quickinstall)
# TODO: valgrind installation sometime hangs.
- cargo-dinghy,cargo-hack,cargo-llvm-cov,cargo-make,cargo-minimal-versions,cargo-no-dev-deps,parse-changelog,cargo-udeps,cargo-valgrind,cargo-deny,cross,dprint,just,nextest,protoc,shellcheck,shfmt,wasm-pack,wasmtime,mdbook,mdbook-linkcheck,cargo-watch,grcov,watchexec-cli,cargo-tarpaulin,zola,syft
include:
# Note: Specifying the version of valgrind and cargo-binstall is not supported.
- os: ubuntu-20.04
tool: cargo-dinghy@0.6.4,cargo-hack@0.5.24,cargo-llvm-cov@0.5.3,cargo-make@0.36.11,cargo-minimal-versions@0.1.8,cargo-no-dev-deps@0.1.0,parse-changelog@0.5.2,cargo-udeps@0.1.35,cargo-valgrind@2.1.0,cargo-deny@0.13.5,cross@0.2.4,dprint@0.34.1,just@1.9.0,nextest@0.9.11,protoc@3.21.12,shellcheck@0.9.0,shfmt@3.6.0,wasm-pack@0.10.3,wasmtime@4.0.0,mdbook@0.4.25,mdbook-linkcheck@0.7.7,cargo-watch@8.1.1,grcov@0.8.13,watchexec-cli@1.20.5,cargo-tarpaulin@0.25.0,zola@0.16.1,syft@0.83.0
- os: ubuntu-20.04
tool: cargo-dinghy@0.6,cargo-hack@0.5,cargo-llvm-cov@0.5,cargo-make@0.36,cargo-minimal-versions@0.1,cargo-no-dev-deps@0.1,parse-changelog@0.5,cargo-udeps@0.1,cargo-valgrind@2.1,cargo-deny@0.13,cross@0.2,dprint@0.34,just@1.9,nextest@0.9,protoc@3.21,shellcheck@0.9,shfmt@3.5,wasm-pack@0.10,wasmtime@6.0,mdbook@0.4,mdbook-linkcheck@0.7,cargo-watch@8.1,grcov@0.8,watchexec-cli@1.20,cargo-tarpaulin@0.25,zola@0.16,syft@0.83
- os: ubuntu-20.04
tool: cargo-valgrind@2, just@1,protoc@3 , shfmt@3 ,wasmtime@7,cargo-watch@8,watchexec-cli@1
- os: macos-11
tool: cargo-dinghy,cargo-hack,cargo-llvm-cov,cargo-make,cargo-minimal-versions,cargo-no-dev-deps,parse-changelog,cargo-udeps,cargo-valgrind,cargo-deny,cross,dprint,just,nextest,protoc,shellcheck,shfmt,wasm-pack,wasmtime,mdbook,mdbook-linkcheck,cargo-watch,grcov,watchexec-cli,cargo-tarpaulin,zola,syft
- os: windows-2019
tool: cargo-hack,cargo-llvm-cov,cargo-make,cargo-minimal-versions,cargo-no-dev-deps,parse-changelog,cargo-udeps,cargo-valgrind,cargo-deny,cross,dprint,just,nextest,protoc,shellcheck,shfmt,wasm-pack,wasmtime,mdbook,mdbook-linkcheck,cargo-watch,grcov,watchexec-cli,cargo-tarpaulin,zola,syft
runs-on: ${{ matrix.os }}
timeout-minutes: 60
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false
# cross attempts to install rust-src when Cargo.toml is available even if `cross --version`
- run: rm Cargo.toml
- uses: ./
with:
tool: ${{ matrix.tool }}
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsshell
- name: Test bash
run: just --version; shfmt --version; protoc --version
shell: bash
- name: Test sh
run: just --version; shfmt --version; protoc --version
shell: sh
if: startsWith(matrix.os, 'ubuntu') || startsWith(matrix.os, 'macos')
- name: Test pwsh
run: just --version; shfmt --version; protoc --version
shell: pwsh
- name: Test powershell
run: just --version; shfmt --version; protoc --version
shell: powershell
if: startsWith(matrix.os, 'windows')
# We use the version output to check the version of binstall, but they
# several times change the version output format in the past so we need to
# check it with CI. (e.g., 0.14.0->0.16.0 update change it
# from "cargo-binstall <version>" to "<version>")
- run: |
if [[ "$(cargo binstall -V)" != "$(jq -r '.latest.version' manifests/cargo-binstall.json)" ]]; then
exit 1
fi
test-container:
strategy:
fail-fast: false
matrix:
container:
# glibc >= 2.31
- ubuntu:20.04 # glibc 2.31
- ubuntu:22.04 # glibc 2.35
- debian:11-slim # glibc 2.31
- debian:12-slim # glibc 2.36
- fedora:latest # glibc 2.37 (as of fedora 38)
tool:
# valgrind: installing snap to container is difficult...
- cargo-dinghy,cargo-hack,cargo-llvm-cov,cargo-make,cargo-minimal-versions,cargo-no-dev-deps,parse-changelog,cargo-udeps,cargo-valgrind,cargo-deny,cross,dprint,just,nextest,protoc,shellcheck,shfmt,wasm-pack,wasmtime,mdbook,mdbook-linkcheck,cargo-watch,grcov,watchexec-cli,cargo-tarpaulin,zola,syft
include:
# glibc < 2.31
# zola don't provide prebuilt binaries for musl or old glibc host.
- container: ubuntu:18.04 # glibc 2.27
tool: cargo-dinghy,cargo-hack,cargo-llvm-cov,cargo-make,cargo-minimal-versions,cargo-no-dev-deps,parse-changelog,cargo-udeps,cargo-valgrind,cargo-deny,cross,dprint,just,nextest,protoc,shellcheck,shfmt,wasm-pack,wasmtime,mdbook,mdbook-linkcheck,cargo-watch,grcov,watchexec-cli,cargo-tarpaulin,syft
- container: debian:10-slim # glibc 2.28
tool: cargo-dinghy,cargo-hack,cargo-llvm-cov,cargo-make,cargo-minimal-versions,cargo-no-dev-deps,parse-changelog,cargo-udeps,cargo-valgrind,cargo-deny,cross,dprint,just,nextest,protoc,shellcheck,shfmt,wasm-pack,wasmtime,mdbook,mdbook-linkcheck,cargo-watch,grcov,watchexec-cli,cargo-tarpaulin,syft
- container: rockylinux:8 # glibc 2.28
tool: cargo-dinghy,cargo-hack,cargo-llvm-cov,cargo-make,cargo-minimal-versions,cargo-no-dev-deps,parse-changelog,cargo-udeps,cargo-valgrind,cargo-deny,cross,dprint,just,nextest,protoc,shellcheck,shfmt,wasm-pack,wasmtime,mdbook,mdbook-linkcheck,cargo-watch,grcov,watchexec-cli,cargo-tarpaulin,syft
- container: rockylinux:8-minimal # glibc 2.28
tool: cargo-dinghy,cargo-hack,cargo-llvm-cov,cargo-make,cargo-minimal-versions,cargo-no-dev-deps,parse-changelog,cargo-udeps,cargo-valgrind,cargo-deny,cross,dprint,just,nextest,protoc,shellcheck,shfmt,wasm-pack,wasmtime,mdbook,mdbook-linkcheck,cargo-watch,grcov,watchexec-cli,cargo-tarpaulin,syft
# glibc < 2.27 or musl
- container: centos:7 # glibc 2.17
# protoc,valgrind,wasmtime,mdbook-linkcheck,cargo-watch,zola don't provide prebuilt binaries for musl or old glibc host.
tool: cargo-dinghy,cargo-hack,cargo-llvm-cov,cargo-make,cargo-minimal-versions,cargo-no-dev-deps,parse-changelog,cargo-udeps,cargo-valgrind,cargo-deny,cross,dprint,just,nextest,shellcheck,shfmt,wasm-pack,mdbook,cargo-binstall,grcov,watchexec-cli,cargo-tarpaulin,syft
- container: alpine:latest # musl 1.2.4 (as of alpine 3.18)
# protoc,valgrind,wasmtime,mdbook-linkcheck,cargo-watch,zola don't provide prebuilt binaries for musl host.
tool: cargo-dinghy,cargo-hack,cargo-llvm-cov,cargo-make,cargo-minimal-versions,cargo-no-dev-deps,parse-changelog,cargo-udeps,cargo-valgrind,cargo-deny,cross,dprint,just,nextest,shellcheck,shfmt,wasm-pack,mdbook,cargo-binstall,grcov,watchexec-cli,cargo-tarpaulin,syft
runs-on: ubuntu-latest
timeout-minutes: 60
container: ${{ matrix.container }}
steps:
- name: Install requirements (ubuntu/debian)
run: |
set -euxo pipefail
apt-get -o Acquire::Retries=10 -qq update
apt-get -o Acquire::Retries=10 -qq -o Dpkg::Use-Pty=0 install -y --no-install-recommends cargo
if: startsWith(matrix.container, 'ubuntu') || startsWith(matrix.container, 'debian')
- name: Install requirements (fedora/rockylinux)
run: |
set -euxo pipefail
dnf=dnf
if ! type -P dnf &>/dev/null; then
dnf=microdnf
fi
# tar and gzip are required for actions/checkout on rockylinux:*-minimal
$dnf install -y cargo tar gzip
if: startsWith(matrix.container, 'fedora') || startsWith(matrix.container, 'rockylinux')
- name: Install requirements (centos)
run: |
set -euxo pipefail
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain stable
echo "$HOME/.cargo/bin" >>"${GITHUB_PATH}"
if: startsWith(matrix.container, 'centos')
- name: Install requirements (alpine)
run: |
set -eux
apk --no-cache add bash cargo
shell: sh
if: startsWith(matrix.container, 'alpine')
- uses: actions/checkout@v3
with:
persist-credentials: false
# cross attempts to install rust-src when Cargo.toml is available even if `cross --version`
- run: rm Cargo.toml
- uses: ./
with:
tool: ${{ matrix.tool }}
manifest:
runs-on: ubuntu-latest
timeout-minutes: 60
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false
- name: Install Rust
run: rustup toolchain add nightly --no-self-update && rustup default nightly
- run: tools/manifest.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- id: diff
run: tools/ci/manifest.sh
if: github.repository_owner == 'taiki-e' && (github.event_name == 'schedule' || github.event_name == 'push' && github.ref == 'refs/heads/main')
- uses: peter-evans/create-pull-request@v5
with:
title: Update manifest
body: |
Auto-generated by [create-pull-request](https://github.com/peter-evans/create-pull-request)
branch: update-manifest
token: ${{ secrets.CREATE_PR_TOKEN }}
if: github.repository_owner == 'taiki-e' && (github.event_name == 'schedule' || github.event_name == 'push' && github.ref == 'refs/heads/main') && steps.diff.outputs.success == 'false'
- run: git add -N . && git diff --exit-code