Bump version to 0.3.2 #67
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Sanity checks" | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
env: | |
PROJECT_NAME: go-r10e-docker | |
jobs: | |
sanity: | |
name: "build and test" | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
go-version: [1.21.x] | |
os: [ubuntu-latest] | |
steps: | |
- name: "install golang" | |
uses: actions/setup-go@v2 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: "checkout code" | |
uses: actions/checkout@v3 | |
with: | |
# Fetch all history for all tags and branches | |
fetch-depth: 0 | |
- name: "build r10edocker" | |
run: | | |
set -euxo pipefail | |
cd ${{ github.workspace }} | |
make build | |
build/r10edocker-linux-amd64 --version | |
- name: "generate r10e scripts using r10edocker" | |
run: | | |
set -euxo pipefail | |
cd ${{ github.workspace }} | |
rm -rf r10e-docker/ | |
build/r10edocker-linux-amd64 -c config.json | |
- name: "r10e-build r10edocker" | |
run: | | |
set -euxo pipefail | |
cd ${{ github.workspace }} | |
bash r10e-docker/build_container.sh | |
- name: "save SUM1 for reproducibility cross-check" | |
run: | | |
set -euxo pipefail | |
cd ${{ github.workspace }} | |
# sha256sum of sha256sums of sorted files in r10e-docker/ | |
echo "SUM1=$(for f in $(find r10e-docker/ -type f | sort); \ | |
do sha256sum "$f"; done \ | |
| sha256sum | cut -f1 -d' ')" >> $GITHUB_ENV | |
- name: "load and run container" | |
run: | | |
set -euxo pipefail | |
cd ${{ github.workspace }} | |
docker load -i "r10e-docker/out/$PROJECT_NAME-latest.tar.gz" | |
docker run --rm -i --entrypoint "/app/r10edocker-linux-amd64" "$PROJECT_NAME:latest" --version | |
- name: "copy r10e executable from container" | |
run: | | |
set -euxo pipefail | |
cd ${{ github.workspace }} | |
./scripts/container_cp.sh "$PROJECT_NAME:latest" "/app/r10edocker-linux-amd64" "build/r10e-r10edocker" | |
# simple test | |
build/r10e-r10edocker --version | |
- name: "generate r10e script using r10e execubtable" | |
run: | | |
set -euxo pipefail | |
cd ${{ github.workspace }} | |
rm -rf r10e-docker/ | |
build/r10e-r10edocker -c config.json | |
- name: "r10e-build r10edocker, second time" | |
run: | | |
set -euxo pipefail | |
cd ${{ github.workspace }} | |
bash r10e-docker/build_container.sh | |
- name: "save SUM2 for reproducibility cross-check" | |
run: | | |
set -euxo pipefail | |
cd ${{ github.workspace }} | |
# sha256sum of sha256sums of sorted files in r10e-docker/ | |
echo "SUM2=$(for f in $(find r10e-docker/ -type f | sort); \ | |
do sha256sum "$f"; done \ | |
| sha256sum | cut -f1 -d' ')" >> $GITHUB_ENV | |
- name: "r10e cross-check" | |
run: | | |
set -euxo pipefail | |
cd ${{ github.workspace }} | |
[ "$SUM1" = "$SUM2" ] || { echo "hash mismatch. r10e cross-check failed"; exit 1; } | |
echo "r10e cross-check succeeded" | |
configs: | |
name: "test configs" | |
needs: sanity | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
go-version: [1.21.x] | |
os: [ubuntu-latest] | |
steps: | |
- name: "install golang" | |
uses: actions/setup-go@v2 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: "checkout code" | |
uses: actions/checkout@v3 | |
- name: "test JSON config files" | |
run: | | |
set -euxo pipefail | |
cd ${{ github.workspace }} | |
./scripts/test_configs.sh | |
shellcheck: | |
name: "shellcheck" | |
strategy: | |
fail-fast: false | |
# Run on linux and macos | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: "Checkout repository" | |
uses: actions/checkout@v3 | |
- if: ${{ matrix.os == 'ubuntu-latest' }} | |
name: Install shellcheck on Ubuntu | |
run: | | |
sudo apt update | |
sudo apt install shellcheck -y | |
shellcheck --version | |
- if: ${{ matrix.os == 'macos-latest' }} | |
name: "Install shellcheck on macos" | |
run: | | |
brew install shellcheck | |
shellcheck --version | |
- name: "Run shellcheck on static files" | |
run: | | |
set -euxo pipefail | |
cd ${{ github.workspace }}/ | |
for f in $(find scripts/ -type f); do | |
if file "$f" | grep "shell script" &>/dev/null; then | |
shellcheck "$f" | |
fi | |
done | |
- name: "Run shellcheck on dynamically generated files" | |
run: | | |
set -euxo pipefail | |
cd ${{ github.workspace }}/ | |
make build | |
# Use same executable name for all runners | |
cp build/r10edocker-* build/r10edocker | |
build/r10edocker -c config.json | |
for f in $(find r10e-docker/ -type f); do | |
if file "$f" | grep "shell script" &>/dev/null; then | |
shellcheck "$f" | |
fi | |
done |