Skip to content

Commit b9b6975

Browse files
committed
Brand New Build!
Features Linux x86_64 docker builds for all archs
1 parent 15ff87c commit b9b6975

File tree

25 files changed

+460
-253
lines changed

25 files changed

+460
-253
lines changed

.compile_binaries

-73
This file was deleted.

.github/workflows/build.yml

+124
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
name: Build Lol
2+
3+
# Run this workflow every time a new commit pushed to your repository
4+
on: push
5+
6+
jobs:
7+
package_source:
8+
name: Package Source Code
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Install Dependencies
12+
run: |
13+
sudo apt-get update
14+
sudo apt-mark manual ghc # Don't bother installing ghc just to tar up source
15+
sudo apt-get install cabal-install
16+
17+
- name: Checkout repository
18+
uses: actions/checkout@v2
19+
20+
- name: Package Source
21+
run: |
22+
mkdir source
23+
cabal sdist
24+
mv dist/*.tar.gz source/source.tar.gz
25+
26+
- name: Deduce tags
27+
run: |
28+
exec > source/tags
29+
echo "latest"
30+
if tag=$(git describe --exact-match --tags)
31+
then
32+
echo "stable"
33+
echo "$tag"
34+
fi
35+
36+
- name: Upload artifact
37+
uses: actions/upload-artifact@v2
38+
with:
39+
name: source
40+
path: source/
41+
42+
build_source:
43+
name: Build Source Code
44+
needs: package_source
45+
strategy:
46+
matrix:
47+
build: [linux.x86_64, linux.aarch64, linux.armv6hf, darwin.x86_64, windows.x86_64]
48+
runs-on: ubuntu-latest
49+
steps:
50+
- name: Checkout repository
51+
uses: actions/checkout@v2
52+
53+
- name: Download artifacts
54+
uses: actions/download-artifact@v2
55+
56+
- name: Build source
57+
run: |
58+
mkdir -p bin
59+
mkdir -p bin/${{matrix.build}}
60+
( cd bin && ../build/run_builder ../source/source.tar.gz ../build/${{matrix.build}} )
61+
62+
- name: Upload artifact
63+
uses: actions/upload-artifact@v2
64+
with:
65+
name: bin
66+
path: bin/
67+
68+
package_binary:
69+
name: Package Binaries
70+
needs: build_source
71+
runs-on: ubuntu-latest
72+
steps:
73+
- name: Checkout repository
74+
uses: actions/checkout@v2
75+
76+
- name: Download artifacts
77+
uses: actions/download-artifact@v2
78+
79+
- name: Work around GitHub permissions bug
80+
run: chmod +x bin/*/shellcheck*
81+
82+
- name: Package binaries
83+
run: |
84+
export TAGS="$(cat source/tags)"
85+
mkdir -p deploy
86+
cp -r bin/* deploy
87+
cd deploy
88+
../.prepare_deploy
89+
rm -rf */ README* LICENSE*
90+
91+
- name: Upload artifact
92+
uses: actions/upload-artifact@v2
93+
with:
94+
name: deploy
95+
path: deploy/
96+
97+
deploy:
98+
name: Deploy binaries
99+
needs: package_binary
100+
runs-on: ubuntu-latest
101+
environment: Deploy
102+
steps:
103+
- name: Checkout repository
104+
uses: actions/checkout@v2
105+
106+
- name: Download artifacts
107+
uses: actions/download-artifact@v2
108+
109+
- name: Upload to GitHub
110+
env:
111+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
112+
run: |
113+
export TAGS="$(cat source/tags)"
114+
./.github_deploy
115+
116+
- name: Upload to Docker Hub
117+
env:
118+
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
119+
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
120+
DOCKER_EMAIL: ${{ secrets.DOCKER_EMAIL }}
121+
DOCKER_BASE: ${{ secrets.DOCKER_USERNAME }}/shellcheck
122+
run: |
123+
export TAGS="$(cat source/tags)"
124+
( source ./.multi_arch_docker && set -eux && multi_arch_docker::main )

.github_deploy

+3-32
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,10 @@
22
set -x
33
shopt -s extglob
44

5-
if [[ "$TRAVIS_SECURE_ENV_VARS" != "true" ]]
6-
then
7-
echo >&2 "Missing TRAVIS_SECURE_ENV_VARS. Skipping GitHub deployment."
8-
exit 0
9-
fi
10-
11-
install_deps() {
12-
version="2.7.0" # 2.14.1 fails to overwrite duplicates
13-
case "$(uname)" in
14-
Linux)
15-
sudo apt-get update
16-
sudo apt-get install curl
17-
curl -L "https://github.com/github/hub/releases/download/v$version/hub-linux-amd64-$version.tgz" | tar xvz --strip-components=1 "hub-linux-amd64-$version/bin/hub"
18-
;;
19-
Darwin)
20-
curl -L "https://github.com/github/hub/releases/download/v$version/hub-darwin-amd64-$version.tgz" | tar xvz --strip-components=1 "hub-darwin-amd64-$version/bin/hub"
21-
;;
22-
*)
23-
echo "Unknown: $(uname)"
24-
exit 1
25-
;;
26-
esac
27-
28-
hub_path="$PWD/bin/hub"
29-
hub() {
30-
"$hub_path" "$@"
31-
}
32-
}
33-
install_deps
34-
355
export EDITOR="touch"
366

377
# Sanity check
8+
gh --version || exit 1
389
hub release show latest || exit 1
3910

4011
for tag in $TAGS
@@ -51,8 +22,8 @@ do
5122
do
5223
[[ $file == *.@(xz|gz|zip) ]] || continue
5324
[[ $file == *"$tag"* ]] || continue
54-
files+=(-a "$file")
25+
files+=("$file")
5526
done
56-
hub release edit "${files[@]}" "$tag" || exit 1
27+
gh release upload "$tag" "${files[@]}" --clobber || exit 1
5728
done
5829

.multi_arch_docker

+1-8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
#!/bin/bash
22
# This script builds and deploys multi-architecture docker images from the
3-
# binaries previously built and deployed to GCS by the Travis pipeline.
4-
5-
if [[ "$TRAVIS_SECURE_ENV_VARS" != "true" ]]
6-
then
7-
echo >&2 "Missing TRAVIS_SECURE_ENV_VARS. Skipping Docker builds."
8-
exit 0
9-
fi
3+
# binaries previously built and deployed to GitHub.
104

115
function multi_arch_docker::install_docker_buildx() {
126
# Install up-to-date version of docker, with buildx support.
@@ -108,6 +102,5 @@ function multi_arch_docker::main() {
108102
multi_arch_docker::install_docker_buildx
109103
multi_arch_docker::login_to_docker_hub
110104
multi_arch_docker::build_and_push_all
111-
set +x
112105
multi_arch_docker::test_all
113106
}

.prepare_deploy

+20-14
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#!/bin/bash
2-
# This script packages up Travis compiled binaries
2+
# This script packages up compiled binaries
33
set -ex
44
shopt -s nullglob extglob
5-
cd deploy
5+
6+
ls -l
67

78
cp ../LICENSE LICENSE.txt
89
sed -e $'s/$/\r/' > README.txt << END
@@ -22,26 +23,31 @@ This binary was compiled on $(date -u).
2223
$(git log -n 3)
2324
END
2425

25-
for file in ./*.exe
26+
for dir in */
2627
do
27-
zip "${file%.*}.zip" README.txt LICENSE.txt "$file"
28+
cp LICENSE.txt README.txt "$dir"
2829
done
2930

30-
for file in *.{linux,darwin}-*
31+
echo "Tags are $TAGS"
32+
33+
for tag in $TAGS
3134
do
32-
base="${file%.*}"
33-
ext="${file##*.}"
34-
os="${ext%-*}"
35-
arch="${ext##*-}"
36-
cp "$file" "shellcheck"
37-
tar -cJf "$base.$os.$arch.tar.xz" --transform="s:^:$base/:" README.txt LICENSE.txt shellcheck
38-
rm "shellcheck"
39-
done
4035

41-
rm !(*.xz|*.zip)
36+
for dir in windows.*/
37+
do
38+
( cd "$dir" && zip "../shellcheck-$tag.zip" * )
39+
done
40+
41+
for dir in {linux,darwin}.*/
42+
do
43+
base="${dir%/}"
44+
( cd "$dir" && tar -cJf "../shellcheck-$tag.$base.tar.xz" --transform="s:^:shellcheck-$tag/:" * )
45+
done
46+
done
4247

4348
for file in ./*
4449
do
50+
[[ -f "$file" ]] || continue
4551
sha512sum "$file" > "$file.sha512sum"
4652
done
4753

0 commit comments

Comments
 (0)