Skip to content

build(deps): bump actions/upload-artifact from 3 to 4 #436

build(deps): bump actions/upload-artifact from 3 to 4

build(deps): bump actions/upload-artifact from 3 to 4 #436

Workflow file for this run

name: CI
on: [push]
env:
PIPING_SERVER_CHECK_VERSION: 0.13.1
jobs:
build_x64_executables:
runs-on: ubuntu-20.04
strategy:
matrix:
pkg_target_without_node:
- linuxstatic-x64
- linux-x64
- mac-x64
- alpine-x64
- win-x64
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/setup-node@v3.8.1
with:
node-version: '18'
- run: npm ci
- run: |
set -xeu
npm run piping-build
./node_modules/.bin/pkg --out-path=piping-server-pkg-${{ matrix.pkg_target_without_node }} --targets=node18-${{ matrix.pkg_target_without_node }} ./piping-server
- name: tar.gz or zip
run: |
set -xeu
if [ "${{ matrix.pkg_target_without_node }}" = "win-x64" ]; then
zip -r piping-server-pkg-${{ matrix.pkg_target_without_node }}.zip ./piping-server-pkg-${{ matrix.pkg_target_without_node }}
else
tar czvf piping-server-pkg-${{ matrix.pkg_target_without_node }}.tar.gz ./piping-server-pkg-${{ matrix.pkg_target_without_node }}
fi
- uses: actions/upload-artifact@v4
with:
name: build_x64
path: |
piping-server-pkg-*.tar.gz
piping-server-pkg-*.zip
build_arm_executables:
runs-on: ubuntu-20.04
strategy:
matrix:
pkg_target_without_node:
- linuxstatic-arm64
- linuxstatic-armv7
- linux-arm64
- mac-arm64
- alpine-arm64
- win-arm64
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- run: |
set -xeu
# NOTE: Using node:18 takes over 21 minutes
docker run --rm -i -v $PWD:/app --platform=linux/arm64/v8 node:20 bash << 'EOF'
set -xeu
# Install ldid for macos-arm64 signing
curl -LO https://github.com/ProcursusTeam/ldid/releases/download/v2.1.5-procursus2/ldid_linux_aarch64
chmod +x ldid_linux_aarch64
mv ./ldid_linux_aarch64 /usr/local/bin/ldid
cd /app
npm ci
npm run piping-build
./node_modules/.bin/pkg --out-path=piping-server-pkg-${{ matrix.pkg_target_without_node }} --targets=node18-${{ matrix.pkg_target_without_node }} ./piping-server
EOF
- name: tar.gz or zip
run: |
set -xeu
if [ "${{ matrix.pkg_target_without_node }}" = "win-arm64" ]; then
zip -r piping-server-pkg-${{ matrix.pkg_target_without_node }}.zip ./piping-server-pkg-${{ matrix.pkg_target_without_node }}
else
tar czvf piping-server-pkg-${{ matrix.pkg_target_without_node }}.tar.gz ./piping-server-pkg-${{ matrix.pkg_target_without_node }}
fi
- uses: actions/upload-artifact@v4
with:
name: build_arm
path: |
piping-server-pkg-*.tar.gz
piping-server-pkg-*.zip
linux_piping_server_check:
runs-on: ubuntu-20.04
needs: build_x64_executables
steps:
- uses: actions/download-artifact@v3
with:
name: build_x64
path: .
- name: Unarchive tar.gz
run: tar xvf piping-server-pkg-linuxstatic-x64.tar.gz
- name: Create certificates
run: cd /tmp && mkdir ssl_certs && cd ssl_certs && openssl req -x509 -newkey rsa:4096 -keyout server.key -out server.crt -days 365 -sha256 -nodes --subj '/CN=localhost/'
- name: Install piping-server-check
run: cd /tmp && wget -O piping-server-check.deb https://github.com/nwtgck/piping-server-check/releases/download/v${PIPING_SERVER_CHECK_VERSION}/piping-server-check-${PIPING_SERVER_CHECK_VERSION}-linux-amd64.deb && sudo dpkg -i piping-server-check.deb
- name: piping-server-check
run: piping-server-check --http1.1 --http1.1-tls --h2 --tls-skip-verify --concurrency 100 --server-command="${SERVER_COMMAND}" --n-simultaneous-requests=60 --transfer-speed-byte $((1024 * 1024 * 1024 * 1024)) --transfer-span 3s --transfer-span 10s --transfer-span 1m --transfer-span 2m --transfer-span 3m
env:
SERVER_COMMAND: 'mkdir -p /tmp/logs && exec ./piping-server-pkg-linuxstatic-x64/piping-server --http-port=$HTTP_PORT --enable-https --https-port=$HTTPS_PORT --crt-path=/tmp/ssl_certs/server.crt --key-path=/tmp/ssl_certs/server.key 2>&1 | tee /tmp/logs/$SERVER_RUN_ID.log > /dev/stderr'
timeout-minutes: 4.5
- name: Show server logs from piping-server-check
if: ${{ always() }}
run: tail -n +1 /tmp/logs/*
alpine_piping_server_check:
runs-on: ubuntu-20.04
needs: build_x64_executables
steps:
- uses: actions/download-artifact@v3
with:
name: build_x64
path: .
- name: Unarchive tar.gz
run: tar xvf piping-server-pkg-alpine-x64.tar.gz
- run: mkdir /tmp/shared
- name: Create certificates
run: cd /tmp/shared && mkdir ssl_certs && cd ssl_certs && openssl req -x509 -newkey rsa:4096 -keyout server.key -out server.crt -days 365 -sha256 -nodes --subj '/CN=localhost/'
- name: Install piping-server-check
run: cd /tmp/ && curl -L https://github.com/nwtgck/piping-server-check/releases/download/v${PIPING_SERVER_CHECK_VERSION}/piping-server-check-${PIPING_SERVER_CHECK_VERSION}-linux-amd64.tar.gz | tar xzf -
- name: piping-server-check
run: |
docker run --rm -i -e SERVER_COMMAND="${SERVER_COMMAND}" -v $PWD:/app -v /tmp/piping-server-check:/usr/local/bin/piping-server-check -v /tmp/shared:/tmp/shared alpine:3.14 /bin/sh << 'EOF'
set -xeu
export GITHUB_ACTIONS=true
piping-server-check --http1.1 --http1.1-tls --h2 --tls-skip-verify --concurrency 100 --server-command="${SERVER_COMMAND}" --n-simultaneous-requests=60 --transfer-speed-byte $((1024 * 1024 * 1024 * 1024)) --transfer-span 3s --transfer-span 10s --transfer-span 1m --transfer-span 2m --transfer-span 3m
EOF
env:
SERVER_COMMAND: 'mkdir -p /tmp/shared/logs && exec /app/piping-server-pkg-alpine-x64/piping-server --http-port=$HTTP_PORT --enable-https --https-port=$HTTPS_PORT --crt-path=/tmp/shared/ssl_certs/server.crt --key-path=/tmp/shared/ssl_certs/server.key 2>&1 | tee /tmp/shared/logs/$SERVER_RUN_ID.log > /dev/stderr'
timeout-minutes: 4.5
- name: Show server logs from piping-server-check
if: ${{ always() }}
run: tail -n +1 /tmp/shared/logs/*
macos_piping_server_check:
runs-on: macos-11
needs: build_x64_executables
steps:
- uses: actions/download-artifact@v3
with:
name: build_x64
path: .
- name: Unarchive tar.gz
run: tar xvf piping-server-pkg-mac-x64.tar.gz
- name: Create certificates
run: cd /tmp && mkdir ssl_certs && cd ssl_certs && openssl req -x509 -newkey rsa:4096 -keyout server.key -out server.crt -days 365 -sha256 -nodes --subj '/CN=localhost/'
- name: Install piping-server-check
run: cd /tmp && curl -L https://github.com/nwtgck/piping-server-check/releases/download/v${PIPING_SERVER_CHECK_VERSION}/piping-server-check-${PIPING_SERVER_CHECK_VERSION}-darwin-amd64.tar.gz | tar xf - && sudo mv piping-server-check /usr/local/bin
- name: piping-server-check
run: piping-server-check --http1.1 --http1.1-tls --h2 --tls-skip-verify --concurrency 100 --server-command="${SERVER_COMMAND}" --n-simultaneous-requests=60 --transfer-speed-byte $((1024 * 1024 * 1024 * 1024)) --transfer-span 3s --transfer-span 10s --transfer-span 1m --transfer-span 2m --transfer-span 3m
env:
SERVER_COMMAND: 'mkdir -p /tmp/logs && exec ./piping-server-pkg-mac-x64/piping-server --http-port=$HTTP_PORT --enable-https --https-port=$HTTPS_PORT --crt-path=/tmp/ssl_certs/server.crt --key-path=/tmp/ssl_certs/server.key 2>&1 | tee /tmp/logs/$SERVER_RUN_ID.log > /dev/stderr'
timeout-minutes: 4.5
- name: Show server logs from piping-server-check
if: ${{ always() }}
run: tail -n +1 /tmp/logs/*
windows_operational_test:
runs-on: windows-2019
needs: build_x64_executables
steps:
- uses: actions/download-artifact@v3
with:
name: build_x64
path: .
- name: Unarchive zip
run: unzip piping-server-pkg-win-x64.zip
- name: Create certificates
run: |
mkdir ssl_certs
cd ssl_certs
openssl genrsa 2048 > server.key
openssl req -new -key server.key -subj "/C=JP" > server.csr
cat server.csr | openssl x509 -req -days 3650 -signkey server.key > server.crt
- name: Operational test
run: |
# Run a server in background
$args = @("--http-port=8080", "--enable-https", "--https-port=8443", "--key-path=.\ssl_certs\server.key", "--crt-path=.\ssl_certs\server.crt")
$server_pid = Start-Process -PassThru -FilePath .\piping-server-pkg-win-x64\piping-server.exe -ArgumentList $args | foreach { $_.Id }
# Wait for server running
sleep 1
# Create a file to send
echo 'hello, world' > C:\Temp\hello.txt
# Send and wait for a receiver
curl -T C:\Temp\hello.txt localhost:8080/mypath &
# Get data as a file
curl localhost:8080/mypath > C:\Temp\download.txt
# Print downloaded file
cat C:\Temp\download.txt
# Test the equality
diff C:\Temp\hello.txt C:\Temp\download.txt
# Send and wait for a receiver
curl -kT C:\Temp\hello.txt https://localhost:8443/mypath &
# Get data as a file
curl -k https://localhost:8443/mypath > C:\Temp\download_https.txt
# Print downloaded file
cat C:\Temp\download_https.txt
# Test the equality
diff C:\Temp\hello.txt C:\Temp\download_https.txt
# Stop the server
kill $server_pid
release_executables:
if: startsWith( github.ref, 'refs/tags/')
needs:
- linux_piping_server_check
- alpine_piping_server_check
- macos_piping_server_check
- windows_operational_test
- build_arm_executables
runs-on: ubuntu-20.04
steps:
- uses: actions/download-artifact@v3
with:
name: build_x64
path: .
- uses: actions/download-artifact@v3
with:
name: build_arm
path: .
- run: |
set -xeu
mkdir ./publish_dir
mv piping-server-pkg-* ./publish_dir
# Show and create checksums
(cd publish_dir && sha256sum * | tee /dev/stderr > sha256sums.txt)
TAG=$(echo $GITHUB_REF | cut -d / -f 3)
VERSION=$TAG
REPO=$(echo $GITHUB_REPOSITORY | cut -d / -f 2)
curl -L https://github.com/tcnksm/ghr/releases/download/v0.14.0/ghr_v0.14.0_linux_amd64.tar.gz | tar xzf -
./ghr_v0.14.0_linux_amd64/ghr -t ${{ secrets.GITHUB_TOKEN }} -u ${GITHUB_ACTOR} -r ${REPO} -c ${GITHUB_SHA} -delete -n ${VERSION} ${VERSION} ./publish_dir