Skip to content

Merge pull request #224 from wbbaddons/dependabot/cargo/bcrypt-0.15.0 #1298

Merge pull request #224 from wbbaddons/dependabot/cargo/bcrypt-0.15.0

Merge pull request #224 from wbbaddons/dependabot/cargo/bcrypt-0.15.0 #1298

Workflow file for this run

# Copyright (C) 2013 - 2021 Tim Düsterhus
# Copyright (C) 2021 Maximilian Mader
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http:#www.gnu.org/licenses/>.
#
# SPDX-License-Identifier: AGPL-3.0-or-later
name: Test
on:
push:
pull_request:
env:
CARGO_TERM_COLOR: always
jobs:
cargo_build:
name: cargo build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
shared-key: ci
- uses: actions/setup-node@v3
with:
node-version: "16"
cache: "npm"
- run: npm ci
- run: cargo build --locked --verbose
- uses: actions/upload-artifact@v3
with:
name: tims-package-server
path: target/*/tims-package-server
if-no-files-found: error
retention-days: 2
cargo_test:
name: cargo test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
shared-key: ci
- uses: actions/setup-node@v3
with:
node-version: "16"
cache: "npm"
- run: npm ci
- run: cargo test --locked --verbose
end_to_end_test:
name: End to end test
needs:
- cargo_build
runs-on: ubuntu-latest
steps:
- run: sudo apt-get update
- run: sudo apt-get install -y httpie jq
- run: pip3 install yq
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: tims-package-server
- run: mv */tims-package-server .
- run: chmod +x ./tims-package-server
- run: sudo systemd-run --unit=tims-package-server --same-dir --uid="$(id -u)" ./tims-package-server
- run: systemctl status tims-package-server
- name: Wait for the HTTP service to come up
run: |
set -x
success=
for _ in $(seq 5); do
if [ "200" == "$(curl -s -o /dev/null -w "%{http_code}" http://localhost:9001)" ]; then
success=1
break
fi
sleep 1
done
if [ -z "$success" ]; then
echo "::error::The HTTP service did not come up." >&2
exit 1
fi
- name: Build packages
run: |
set -x
pushd tests/
for package in be.bastelstu.*; do
mkdir "../packages/$package/"
pushd "$package"
for version in *.xml; do
tar cf "../../packages/$package/$(basename "$version" ".xml").tar" $version --transform 's~.*~package.xml~'
done
popd
done
popd
shell: bash
- name: Grab initial ETag
id: etag
run: printf "ETAG=%s" "$(curl -fsSi http://localhost:9001/ |awk '/^etag:/{print $2}' |tr -d '\r\n')" >> $GITHUB_OUTPUT
- run: mv tests/auth.json packages/auth.json
- name: Wait for the ETag to change
run: |
set -x
success=
for _ in $(seq 30); do
if [ "200" == "$(curl -s -o /dev/null -w "%{http_code}" http://localhost:9001/ -H 'if-none-match: ${{ steps.etag.outputs.ETAG }}')" ]; then
success=1
break
fi
sleep 1
done
if [ -z "$success" ]; then
echo "::error::The ETag did not change." >&2
exit 1
fi
if [ "$(curl -fsSi http://localhost:9001/ |awk '/^etag:/{print $2}' |tr -d '\r\n')" = '${{ steps.etag.outputs.ETAg }}' ]; then
echo "::error::The ETag did not change." >&2
exit 1
fi
- run: http --pretty=all -v GET :9001/
- run: sudo systemctl stop tims-package-server