Skip to content

Commit

Permalink
try msrv 1.63.0
Browse files Browse the repository at this point in the history
  • Loading branch information
nwtgck committed Jan 17, 2024
1 parent 96518cc commit 88d6030
Showing 1 changed file with 192 additions and 192 deletions.
384 changes: 192 additions & 192 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,207 +8,207 @@ env:
PIPING_SERVER_CHECK_VERSION: 0.8.1

jobs:
cargo_fmt:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- run: cargo fmt --all -- --check

cargo_test:
strategy:
matrix:
runs-on:
- ubuntu-20.04
- macOS-11
runs-on: ${{ matrix.runs-on }}
steps:
- uses: actions/checkout@v4
- run: cargo test -- --color=always --nocapture
# cargo_fmt:
# runs-on: ubuntu-20.04
# steps:
# - uses: actions/checkout@v4
# - run: cargo fmt --all -- --check
#
# cargo_test:
# strategy:
# matrix:
# runs-on:
# - ubuntu-20.04
# - macOS-11
# runs-on: ${{ matrix.runs-on }}
# steps:
# - uses: actions/checkout@v4
# - run: cargo test -- --color=always --nocapture

# MSRV (minimum supported Rust version)
cargo_test_msrv:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- run: rustup default 1.60.0
- run: rustup default 1.63.0
- run: cargo test -- --color=always --nocapture

cross_build:
strategy:
max-parallel: 8
matrix:
target:
- aarch64-unknown-linux-musl
- arm-linux-androideabi
- arm-unknown-linux-musleabi
- arm-unknown-linux-musleabihf
- armv5te-unknown-linux-musleabi
- armv7-linux-androideabi
- armv7-unknown-linux-musleabihf
- armv7-unknown-linux-musleabi
- i586-unknown-linux-musl
- i686-linux-android
- i686-unknown-linux-musl
- x86_64-linux-android
- x86_64-pc-windows-gnu
- x86_64-unknown-linux-musl
runs-on: ubuntu-20.04
steps:
- run: rustup default ${RUST_VERSION}
- uses: actions/checkout@v4
- name: Install cross
run: cd /tmp && curl -L https://github.com/cross-rs/cross/releases/download/v${CROSS_VERSION}/cross-x86_64-unknown-linux-musl.tar.gz | tar xzf -
- run: /tmp/cross build --target=${{ matrix.target }} --release --locked
- name: Archive binary
run: |
set -eu
mkdir ./piping-server-${{ matrix.target }}
if [[ "${{ matrix.target }}" == *"-windows-"* ]]; then
cp ./target/${{ matrix.target }}/release/piping-server.exe ./piping-server-${{ matrix.target }}
zip -r ./piping-server-${{ matrix.target }}.zip ./piping-server-${{ matrix.target }}
else
cp ./target/${{ matrix.target }}/release/piping-server ./piping-server-${{ matrix.target }}
tar zcf ./piping-server-${{ matrix.target }}.tar.gz ./piping-server-${{ matrix.target }}
fi
- uses: actions/upload-artifact@v3
with:
name: cross_build_artifact
path: |
piping-server-*.tar.gz
piping-server-*.zip
linux_operational_test:
needs:
- cross_build
runs-on: ubuntu-20.04
steps:
- name: Download the artifact (cross build)
uses: actions/download-artifact@v3
with:
name: cross_build_artifact
- name: Extract binary
run: tar xf piping-server-x86_64-unknown-linux-musl.tar.gz
- name: Operational test
run: |
set -xeu
# Create certificates
(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/')
# Run a server
./piping-server-x86_64-unknown-linux-musl/piping-server --http-port=8181 --enable-https --https-port=8443 --crt-path=./ssl_certs/server.crt --key-path=./ssl_certs/server.key &
sleep 3
# Transfer data over HTTP
echo "hello, world" | curl -T - localhost:8181/mypath &
diff <(echo "hello, world") <(curl localhost:8181/mypath)
# Make a large random file
dd if=/dev/urandom iflag=count_bytes count=500M bs=1M of=/tmp/500M.dat
# Transfer large data over HTTP
cat /tmp/500M.dat | curl -T - localhost:8181/mypath &
diff <(cat /tmp/500M.dat) <(curl localhost:8181/mypath)
rm /tmp/500M.dat
# Transfer data over HTTPS
echo "hello, world with HTTPS" | curl -kT - https://localhost:8443/mypath2 &
diff <(echo "hello, world with HTTPS") <(curl -k https://localhost:8443/mypath2)
# Make a large random file
dd if=/dev/urandom iflag=count_bytes count=500M bs=1M of=/tmp/500M.dat
# Transfer large data over HTTPS
cat /tmp/500M.dat | curl -kT - https://localhost:8443/mypath2 &
diff <(cat /tmp/500M.dat) <(curl -k https://localhost:8443/mypath2)
rm /tmp/500M.dat
# cross_build:
# strategy:
# max-parallel: 8
# matrix:
# target:
# - aarch64-unknown-linux-musl
# - arm-linux-androideabi
# - arm-unknown-linux-musleabi
# - arm-unknown-linux-musleabihf
# - armv5te-unknown-linux-musleabi
# - armv7-linux-androideabi
# - armv7-unknown-linux-musleabihf
# - armv7-unknown-linux-musleabi
# - i586-unknown-linux-musl
# - i686-linux-android
# - i686-unknown-linux-musl
# - x86_64-linux-android
# - x86_64-pc-windows-gnu
# - x86_64-unknown-linux-musl
# runs-on: ubuntu-20.04
# steps:
# - run: rustup default ${RUST_VERSION}
# - uses: actions/checkout@v4
# - name: Install cross
# run: cd /tmp && curl -L https://github.com/cross-rs/cross/releases/download/v${CROSS_VERSION}/cross-x86_64-unknown-linux-musl.tar.gz | tar xzf -
# - run: /tmp/cross build --target=${{ matrix.target }} --release --locked
# - name: Archive binary
# run: |
# set -eu
# mkdir ./piping-server-${{ matrix.target }}
# if [[ "${{ matrix.target }}" == *"-windows-"* ]]; then
# cp ./target/${{ matrix.target }}/release/piping-server.exe ./piping-server-${{ matrix.target }}
# zip -r ./piping-server-${{ matrix.target }}.zip ./piping-server-${{ matrix.target }}
# else
# cp ./target/${{ matrix.target }}/release/piping-server ./piping-server-${{ matrix.target }}
# tar zcf ./piping-server-${{ matrix.target }}.tar.gz ./piping-server-${{ matrix.target }}
# fi
# - uses: actions/upload-artifact@v3
# with:
# name: cross_build_artifact
# path: |
# piping-server-*.tar.gz
# piping-server-*.zip

# HTTP/2 support
(echo hello | curl -ksST- https://localhost:8443/mypath3 -o /dev/null -w '%{http_version}:%{http_code}\n' > /tmp/http2_post.txt) &
post_pid=$!
diff <(echo '2:200') <(curl -ksS https://localhost:8443/mypath3 -o /dev/null -w '%{http_version}:%{http_code}\n')
wait $post_pid
diff <(echo '2:200') /tmp/http2_post.txt
# linux_operational_test:
# needs:
# - cross_build
# runs-on: ubuntu-20.04
# steps:
# - name: Download the artifact (cross build)
# uses: actions/download-artifact@v3
# with:
# name: cross_build_artifact
# - name: Extract binary
# run: tar xf piping-server-x86_64-unknown-linux-musl.tar.gz
# - name: Operational test
# run: |
# set -xeu
# # Create certificates
# (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/')
# # Run a server
# ./piping-server-x86_64-unknown-linux-musl/piping-server --http-port=8181 --enable-https --https-port=8443 --crt-path=./ssl_certs/server.crt --key-path=./ssl_certs/server.key &
# sleep 3
#
# # Transfer data over HTTP
# echo "hello, world" | curl -T - localhost:8181/mypath &
# diff <(echo "hello, world") <(curl localhost:8181/mypath)
# # Make a large random file
# dd if=/dev/urandom iflag=count_bytes count=500M bs=1M of=/tmp/500M.dat
# # Transfer large data over HTTP
# cat /tmp/500M.dat | curl -T - localhost:8181/mypath &
# diff <(cat /tmp/500M.dat) <(curl localhost:8181/mypath)
# rm /tmp/500M.dat
#
# # Transfer data over HTTPS
# echo "hello, world with HTTPS" | curl -kT - https://localhost:8443/mypath2 &
# diff <(echo "hello, world with HTTPS") <(curl -k https://localhost:8443/mypath2)
# # Make a large random file
# dd if=/dev/urandom iflag=count_bytes count=500M bs=1M of=/tmp/500M.dat
# # Transfer large data over HTTPS
# cat /tmp/500M.dat | curl -kT - https://localhost:8443/mypath2 &
# diff <(cat /tmp/500M.dat) <(curl -k https://localhost:8443/mypath2)
# rm /tmp/500M.dat
#
# # HTTP/2 support
# (echo hello | curl -ksST- https://localhost:8443/mypath3 -o /dev/null -w '%{http_version}:%{http_code}\n' > /tmp/http2_post.txt) &
# post_pid=$!
# diff <(echo '2:200') <(curl -ksS https://localhost:8443/mypath3 -o /dev/null -w '%{http_version}:%{http_code}\n')
# wait $post_pid
# diff <(echo '2:200') /tmp/http2_post.txt
#
# # Transfer data using multipart
# # Make a large random file
# dd if=/dev/urandom iflag=count_bytes count=500M bs=1M of=/tmp/500M.dat
# # Transfer large data over HTTP
# curl -F myfile=@/tmp/500M.dat localhost:8181/mypath3 &
# diff <(cat /tmp/500M.dat) <(curl localhost:8181/mypath3)
# rm /tmp/500M.dat

# Transfer data using multipart
# Make a large random file
dd if=/dev/urandom iflag=count_bytes count=500M bs=1M of=/tmp/500M.dat
# Transfer large data over HTTP
curl -F myfile=@/tmp/500M.dat localhost:8181/mypath3 &
diff <(cat /tmp/500M.dat) <(curl localhost:8181/mypath3)
rm /tmp/500M.dat
# build_for_mac:
# strategy:
# matrix:
# target:
# - x86_64-apple-darwin
# - aarch64-apple-darwin
# runs-on: macOS-11
# steps:
# - run: rustup default ${RUST_VERSION}
# - uses: actions/checkout@v4
# - run: rustup target add ${{ matrix.target }}
# - run: cargo build --target=${{ matrix.target }} --release --locked
# - name: Archive binary
# run: |
# set -eu
# mkdir ./piping-server-${{ matrix.target }}
# cp ./target/${{ matrix.target }}/release/piping-server ./piping-server-${{ matrix.target }}
# tar zcf ./piping-server-${{ matrix.target }}.tar.gz ./piping-server-${{ matrix.target }}
# - uses: actions/upload-artifact@v3
# with:
# name: mac_build_artifact
# path: |
# piping-server-*.tar.gz

build_for_mac:
strategy:
matrix:
target:
- x86_64-apple-darwin
- aarch64-apple-darwin
runs-on: macOS-11
steps:
- run: rustup default ${RUST_VERSION}
- uses: actions/checkout@v4
- run: rustup target add ${{ matrix.target }}
- run: cargo build --target=${{ matrix.target }} --release --locked
- name: Archive binary
run: |
set -eu
mkdir ./piping-server-${{ matrix.target }}
cp ./target/${{ matrix.target }}/release/piping-server ./piping-server-${{ matrix.target }}
tar zcf ./piping-server-${{ matrix.target }}.tar.gz ./piping-server-${{ matrix.target }}
- uses: actions/upload-artifact@v3
with:
name: mac_build_artifact
path: |
piping-server-*.tar.gz
# docker:
# runs-on: ubuntu-20.04
# steps:
# - uses: actions/checkout@v4
# - run: docker build -t piping-server-rust .
# - 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 --compromise post_cancel_post --compromise get_cancel_get --concurrency 100 --server-command='mkdir -p /tmp/logs && exec docker run -p $HTTP_PORT:8080 -p $HTTPS_PORT:8443 -v /tmp/ssl_certs:/tmp/ssl_certs piping-server-rust --http-port=8080 --enable-https --https-port=8443 --crt-path=/tmp/ssl_certs/server.crt --key-path=/tmp/ssl_certs/server.key 2>&1 | tee /tmp/logs/$(date "+%s%3N").log > /dev/stderr' --transfer-speed-byte $((1024 * 1024 * 1024 * 1024)) --transfer-span 3s --transfer-span 10s --transfer-span 1m --transfer-span 2m --transfer-span 3m --transfer-span 4m
# timeout-minutes: 5
# - name: Show server logs from piping-server-check
# run: cat /tmp/logs/*
# - uses: docker/login-action@v3
# with:
# username: nwtgck
# password: ${{ secrets.DOCKER_HUB_TOKEN }}
# - name: Push if branch is develop
# if: github.ref == 'refs/heads/develop'
# run: |
# set -eu
# GIT_BRANCH=${GITHUB_BASE_REF:-${GITHUB_REF#refs/heads/}}
# docker tag piping-server-rust nwtgck/piping-server-rust:${GIT_BRANCH}
# docker push nwtgck/piping-server-rust:${GIT_BRANCH}

docker:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- run: docker build -t piping-server-rust .
- 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 --compromise post_cancel_post --compromise get_cancel_get --concurrency 100 --server-command='mkdir -p /tmp/logs && exec docker run -p $HTTP_PORT:8080 -p $HTTPS_PORT:8443 -v /tmp/ssl_certs:/tmp/ssl_certs piping-server-rust --http-port=8080 --enable-https --https-port=8443 --crt-path=/tmp/ssl_certs/server.crt --key-path=/tmp/ssl_certs/server.key 2>&1 | tee /tmp/logs/$(date "+%s%3N").log > /dev/stderr' --transfer-speed-byte $((1024 * 1024 * 1024 * 1024)) --transfer-span 3s --transfer-span 10s --transfer-span 1m --transfer-span 2m --transfer-span 3m --transfer-span 4m
timeout-minutes: 5
- name: Show server logs from piping-server-check
run: cat /tmp/logs/*
- uses: docker/login-action@v3
with:
username: nwtgck
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Push if branch is develop
if: github.ref == 'refs/heads/develop'
run: |
set -eu
GIT_BRANCH=${GITHUB_BASE_REF:-${GITHUB_REF#refs/heads/}}
docker tag piping-server-rust nwtgck/piping-server-rust:${GIT_BRANCH}
docker push nwtgck/piping-server-rust:${GIT_BRANCH}
release_if_tag_exits:
needs:
- cargo_fmt
- cargo_test
- linux_operational_test
- build_for_mac
runs-on: ubuntu-20.04
steps:
- name: Download the artifact (cross build)
uses: actions/download-artifact@v3
with:
name: cross_build_artifact
path: ./publish_dir
- name: Download the artifact (macOS)
uses: actions/download-artifact@v3
with:
name: mac_build_artifact
path: ./publish_dir
- run: ls -la ./publish_dir
- name: Release
if: contains(github.ref, 'refs/tags/')
run: |
set -eux
# 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 ${VERSION} ./publish_dir
# release_if_tag_exits:
# needs:
# - cargo_fmt
# - cargo_test
# - linux_operational_test
# - build_for_mac
# runs-on: ubuntu-20.04
# steps:
# - name: Download the artifact (cross build)
# uses: actions/download-artifact@v3
# with:
# name: cross_build_artifact
# path: ./publish_dir
# - name: Download the artifact (macOS)
# uses: actions/download-artifact@v3
# with:
# name: mac_build_artifact
# path: ./publish_dir
# - run: ls -la ./publish_dir
# - name: Release
# if: contains(github.ref, 'refs/tags/')
# run: |
# set -eux
# # 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 ${VERSION} ./publish_dir

0 comments on commit 88d6030

Please sign in to comment.