mirror of
https://github.com/taiki-e/install-action.git
synced 2026-05-10 14:40:32 +00:00
Test ubuntu and debian containers in CI
This commit is contained in:
1
.github/.cspell/project-dictionary.txt
vendored
1
.github/.cspell/project-dictionary.txt
vendored
@@ -1,5 +1,6 @@
|
|||||||
binstall
|
binstall
|
||||||
bytecodealliance
|
bytecodealliance
|
||||||
|
Dpkg
|
||||||
jfrimmel
|
jfrimmel
|
||||||
koalaman
|
koalaman
|
||||||
libc
|
libc
|
||||||
|
|||||||
20
.github/workflows/ci.yml
vendored
20
.github/workflows/ci.yml
vendored
@@ -10,7 +10,7 @@ on:
|
|||||||
- main
|
- main
|
||||||
- dev
|
- dev
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '0 0 * * *'
|
- cron: '0 1 * * *'
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
defaults:
|
defaults:
|
||||||
@@ -53,8 +53,14 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
|
- container: ubuntu:20.04
|
||||||
|
# valgrind: installing snap to container is difficult...
|
||||||
|
tool: cargo-hack,cargo-llvm-cov,cargo-minimal-versions,parse-changelog,cargo-udeps,cargo-valgrind,cargo-deny,cross,nextest,protoc,shellcheck,shfmt,wasm-pack,wasmtime,mdbook,mdbook-linkcheck,cargo-watch
|
||||||
|
- container: debian:latest
|
||||||
|
# valgrind: installing snap to container is difficult...
|
||||||
|
tool: cargo-hack,cargo-llvm-cov,cargo-minimal-versions,parse-changelog,cargo-udeps,cargo-valgrind,cargo-deny,cross,nextest,protoc,shellcheck,shfmt,wasm-pack,wasmtime,mdbook,mdbook-linkcheck,cargo-watch
|
||||||
- container: alpine:latest
|
- container: alpine:latest
|
||||||
# cargo-udeps,protoc,valgrind,wasmtime,mdbook,mdbook-linkcheck don't support musl host.
|
# cargo-udeps,protoc,valgrind,wasmtime,mdbook,mdbook-linkcheck,cargo-watch don't provide prebuilt binaries for musl host.
|
||||||
tool: cargo-hack,cargo-llvm-cov,cargo-minimal-versions,parse-changelog,cargo-valgrind,cargo-deny,cross,nextest,shellcheck,shfmt,wasm-pack
|
tool: cargo-hack,cargo-llvm-cov,cargo-minimal-versions,parse-changelog,cargo-valgrind,cargo-deny,cross,nextest,shellcheck,shfmt,wasm-pack
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: ${{ matrix.container }}
|
container: ${{ matrix.container }}
|
||||||
@@ -62,8 +68,14 @@ jobs:
|
|||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
- name: Install requirements
|
- name: Install requirements (ubuntu/debian)
|
||||||
run: apk add cargo curl bash tar xz
|
run: |
|
||||||
|
set -ex
|
||||||
|
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 ca-certificates cargo curl unzip xz-utils
|
||||||
|
if: startsWith(matrix.container, 'ubuntu') || startsWith(matrix.container, 'debian')
|
||||||
|
- name: Install requirements (alpine)
|
||||||
|
run: apk add bash cargo curl tar xz
|
||||||
shell: sh
|
shell: sh
|
||||||
if: startsWith(matrix.container, 'alpine')
|
if: startsWith(matrix.container, 'alpine')
|
||||||
- uses: ./
|
- uses: ./
|
||||||
|
|||||||
38
main.sh
38
main.sh
@@ -137,6 +137,34 @@ cargo_binstall() {
|
|||||||
*) cargo binstall --force --no-confirm --version "${version}" "${tool}" ;;
|
*) cargo binstall --force --no-confirm --version "${version}" "${tool}" ;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
apt_update() {
|
||||||
|
if type -P sudo &>/dev/null; then
|
||||||
|
retry sudo apt-get -o Acquire::Retries=10 -qq update
|
||||||
|
else
|
||||||
|
retry apt-get -o Acquire::Retries=10 -qq update
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
apt_install() {
|
||||||
|
if type -P sudo &>/dev/null; then
|
||||||
|
retry sudo apt-get -o Acquire::Retries=10 -qq -o Dpkg::Use-Pty=0 install -y --no-install-recommends "$@"
|
||||||
|
else
|
||||||
|
retry apt-get -o Acquire::Retries=10 -qq -o Dpkg::Use-Pty=0 install -y --no-install-recommends "$@"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
apt_remove() {
|
||||||
|
if type -P sudo &>/dev/null; then
|
||||||
|
sudo apt-get -qq -o Dpkg::Use-Pty=0 remove -y "$@"
|
||||||
|
else
|
||||||
|
apt-get -qq -o Dpkg::Use-Pty=0 remove -y "$@"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
snap_install() {
|
||||||
|
if type -P sudo &>/dev/null; then
|
||||||
|
retry sudo snap install "$@"
|
||||||
|
else
|
||||||
|
retry snap install "$@"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
if [[ $# -gt 0 ]]; then
|
if [[ $# -gt 0 ]]; then
|
||||||
bail "invalid argument '$1'"
|
bail "invalid argument '$1'"
|
||||||
@@ -313,7 +341,7 @@ for tool in "${tools[@]}"; do
|
|||||||
esac
|
esac
|
||||||
miner_patch_version="${version#*.}"
|
miner_patch_version="${version#*.}"
|
||||||
base_url="https://github.com/${repo}/releases/download/v${miner_patch_version}/protoc-${miner_patch_version}"
|
base_url="https://github.com/${repo}/releases/download/v${miner_patch_version}/protoc-${miner_patch_version}"
|
||||||
# Copying files to /usr/local/include requires sudo.
|
# Copying files to /usr/local/include requires sudo, so do not use it.
|
||||||
bin_dir="${HOME}/.install-action/bin"
|
bin_dir="${HOME}/.install-action/bin"
|
||||||
include_dir="${HOME}/.install-action/include"
|
include_dir="${HOME}/.install-action/include"
|
||||||
if [[ ! -d "${bin_dir}" ]]; then
|
if [[ ! -d "${bin_dir}" ]]; then
|
||||||
@@ -359,7 +387,7 @@ for tool in "${tools[@]}"; do
|
|||||||
case "${OSTYPE}" in
|
case "${OSTYPE}" in
|
||||||
linux*)
|
linux*)
|
||||||
if type -P shellcheck &>/dev/null; then
|
if type -P shellcheck &>/dev/null; then
|
||||||
sudo apt-get -qq -o Dpkg::Use-Pty=0 remove -y shellcheck
|
apt_remove shellcheck
|
||||||
fi
|
fi
|
||||||
url="${base_url}.linux.x86_64.tar.xz"
|
url="${base_url}.linux.x86_64.tar.xz"
|
||||||
;;
|
;;
|
||||||
@@ -411,12 +439,12 @@ for tool in "${tools[@]}"; do
|
|||||||
darwin* | cygwin* | msys*) bail "${tool} for non-linux is not supported yet by this action" ;;
|
darwin* | cygwin* | msys*) bail "${tool} for non-linux is not supported yet by this action" ;;
|
||||||
*) bail "unsupported OSTYPE '${OSTYPE}' for ${tool}" ;;
|
*) bail "unsupported OSTYPE '${OSTYPE}' for ${tool}" ;;
|
||||||
esac
|
esac
|
||||||
retry sudo apt-get -o Acquire::Retries=10 -qq update
|
apt_update
|
||||||
# libc6-dbg is needed to run Valgrind
|
# libc6-dbg is needed to run Valgrind
|
||||||
retry sudo apt-get -o Acquire::Retries=10 -qq -o Dpkg::Use-Pty=0 install -y libc6-dbg
|
apt_install libc6-dbg
|
||||||
# Use snap to install the latest Valgrind
|
# Use snap to install the latest Valgrind
|
||||||
# https://snapcraft.io/install/valgrind/ubuntu
|
# https://snapcraft.io/install/valgrind/ubuntu
|
||||||
retry sudo snap install valgrind --classic
|
snap_install valgrind --classic
|
||||||
;;
|
;;
|
||||||
wasm-pack)
|
wasm-pack)
|
||||||
# https://github.com/rustwasm/wasm-pack/releases
|
# https://github.com/rustwasm/wasm-pack/releases
|
||||||
|
|||||||
Reference in New Issue
Block a user