mirror of
				https://github.com/koalaman/shellcheck.git
				synced 2025-11-04 18:28:23 +08:00 
			
		
		
		
	Set up Travis build matrix
This commit is contained in:
		@@ -1,18 +1,10 @@
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
# This script compile shellcheck binaries
 | 
			
		||||
set -ex
 | 
			
		||||
 | 
			
		||||
# Remove all tests to reduce binary size
 | 
			
		||||
./striptests
 | 
			
		||||
 | 
			
		||||
mkdir -p deploy
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
 | 
			
		||||
_cleanup(){
 | 
			
		||||
  rm -rf dist shellcheck || true
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
if [ "$TRAVIS_OS_NAME" = 'linux' ]
 | 
			
		||||
then
 | 
			
		||||
build_linux() {
 | 
			
		||||
  # Linux Docker image
 | 
			
		||||
  name="$DOCKER_BASE"
 | 
			
		||||
  DOCKER_BUILDS="$DOCKER_BUILDS $name"
 | 
			
		||||
@@ -38,14 +30,20 @@ then
 | 
			
		||||
  sed -e '/DELETE-MARKER/,$d' Dockerfile > Dockerfile.alpine
 | 
			
		||||
  docker build -f Dockerfile.alpine -t "$name:current" .
 | 
			
		||||
  docker run "$name:current" sh -c 'shellcheck --version'
 | 
			
		||||
  _cleanup
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
build_aarch64() {
 | 
			
		||||
  # Linux aarch64 static executable
 | 
			
		||||
  docker run -v "$PWD:/mnt" koalaman/aarch64-builder 'buildsc'
 | 
			
		||||
  for tag in $TAGS
 | 
			
		||||
  do
 | 
			
		||||
    cp "shellcheck" "deploy/shellcheck-$tag.linux-aarch64"
 | 
			
		||||
  done
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
build_armv6hf() {
 | 
			
		||||
  # Linux armv6hf static executable
 | 
			
		||||
  docker run -v "$PWD:/mnt" koalaman/armv6hf-builder -c 'compile-shellcheck'
 | 
			
		||||
  for tag in $TAGS
 | 
			
		||||
@@ -53,7 +51,9 @@ then
 | 
			
		||||
    cp "shellcheck" "deploy/shellcheck-$tag.linux-armv6hf"; 
 | 
			
		||||
  done
 | 
			
		||||
  _cleanup
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
build_windows() {
 | 
			
		||||
  # Windows .exe
 | 
			
		||||
  docker run --user="$UID" -v "$PWD:/appdata" koalaman/winghc cuib
 | 
			
		||||
  for tag in $TAGS
 | 
			
		||||
@@ -61,18 +61,22 @@ then
 | 
			
		||||
    cp "dist/build/ShellCheck/shellcheck.exe" "deploy/shellcheck-$tag.exe"; 
 | 
			
		||||
  done
 | 
			
		||||
  _cleanup
 | 
			
		||||
fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
if [ "$TRAVIS_OS_NAME" = 'osx' ];
 | 
			
		||||
then
 | 
			
		||||
build_osx() {
 | 
			
		||||
  # Darwin x86_64 static executable
 | 
			
		||||
  brew install cabal-install pandoc gnu-tar
 | 
			
		||||
  sudo ln -s /usr/local/bin/gsha512sum /usr/local/bin/sha512sum
 | 
			
		||||
  brew install cabal-install pandoc
 | 
			
		||||
  sudo ln -s /usr/local/bin/gtar /usr/local/bin/tar
 | 
			
		||||
  export PATH="/usr/local/bin:$PATH"
 | 
			
		||||
 | 
			
		||||
  cabal update
 | 
			
		||||
  cabal new-build shellcheck
 | 
			
		||||
  cabal install --dependencies-only
 | 
			
		||||
  cabal build shellcheck
 | 
			
		||||
  for tag in $TAGS
 | 
			
		||||
  do 
 | 
			
		||||
    cp "$HOME/.cabal/dist/build/shellcheck/shellcheck" "deploy/shellcheck-$tag.darwin-x86_64";
 | 
			
		||||
    cp "dist/build/shellcheck/shellcheck" "deploy/shellcheck-$tag.darwin-x86_64";
 | 
			
		||||
  done
 | 
			
		||||
  _cleanup
 | 
			
		||||
fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -51,17 +51,13 @@ do
 | 
			
		||||
  rm "shellcheck"
 | 
			
		||||
done
 | 
			
		||||
 | 
			
		||||
if [ "$TRAVIS_OS_NAME" = 'osx' ];
 | 
			
		||||
then
 | 
			
		||||
  brew install gnu-tar
 | 
			
		||||
  for file in *.darwin-x86_64
 | 
			
		||||
  do
 | 
			
		||||
    base="${file%.*}"
 | 
			
		||||
    cp "$file" "shellcheck"
 | 
			
		||||
    gtar -cJf "$base.darwin.x86_64.tar.xz" --transform="s:^:$base/:" README.txt LICENSE.txt shellcheck
 | 
			
		||||
      rm "shellcheck"
 | 
			
		||||
  done
 | 
			
		||||
fi
 | 
			
		||||
for file in *.darwin-x86_64
 | 
			
		||||
do
 | 
			
		||||
  base="${file%.*}"
 | 
			
		||||
  cp "$file" "shellcheck"
 | 
			
		||||
  tar -cJf "$base.darwin.x86_64.tar.xz" --transform="s:^:$base/:" README.txt LICENSE.txt shellcheck
 | 
			
		||||
  rm "shellcheck"
 | 
			
		||||
done
 | 
			
		||||
 | 
			
		||||
for file in ./*
 | 
			
		||||
do
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										23
									
								
								.travis.yml
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								.travis.yml
									
									
									
									
									
								
							@@ -1,3 +1,4 @@
 | 
			
		||||
 | 
			
		||||
sudo: required
 | 
			
		||||
 | 
			
		||||
language: sh
 | 
			
		||||
@@ -5,9 +6,18 @@ language: sh
 | 
			
		||||
services:
 | 
			
		||||
  - docker
 | 
			
		||||
 | 
			
		||||
os:
 | 
			
		||||
  - linux
 | 
			
		||||
  - osx
 | 
			
		||||
matrix:
 | 
			
		||||
  include:
 | 
			
		||||
    - os: linux
 | 
			
		||||
      env: BUILD=linux
 | 
			
		||||
    - os: linux
 | 
			
		||||
      env: BUILD=windows
 | 
			
		||||
    - os: linux
 | 
			
		||||
      env: BUILD=armv6hf
 | 
			
		||||
    - os: linux
 | 
			
		||||
      env: BUILD=aarch64
 | 
			
		||||
    - os: osx
 | 
			
		||||
      env: BUILD=osx
 | 
			
		||||
 | 
			
		||||
before_install: |
 | 
			
		||||
  DOCKER_BASE="$DOCKER_USERNAME/shellcheck"
 | 
			
		||||
@@ -18,11 +28,14 @@ before_install: |
 | 
			
		||||
  echo "Tags are $TAGS"
 | 
			
		||||
 | 
			
		||||
script:
 | 
			
		||||
  - ./.compile_binaries
 | 
			
		||||
  - mkdir -p deploy
 | 
			
		||||
  - source ./.compile_binaries
 | 
			
		||||
  - ./striptests
 | 
			
		||||
  - set -x; build_"$BUILD"; set +x;
 | 
			
		||||
  - ./.prepare_deploy
 | 
			
		||||
 | 
			
		||||
after_success: |
 | 
			
		||||
  if [ "$TRAVIS_OS_NAME" = "linux" ]; then
 | 
			
		||||
  if [ "$BUILD" = "linux" ]; then
 | 
			
		||||
    docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
 | 
			
		||||
    for repo in $DOCKER_BUILDS; do
 | 
			
		||||
      for tag in $TAGS; do
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user