Add smoke test #9
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
on: [push, pull_request] | |
name: Test | |
jobs: | |
smoke: | |
name: Smoke Test | |
runs-on: ubuntu-latest | |
services: | |
gitlab: | |
image: gitlab/gitlab-ee:latest | |
options: --shm-size 256m | |
ports: | |
- 80:80 | |
- 443:443 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Start gitlab-cargo-shim | |
run: | | |
docker build . -t gitlab-cargo-shim | |
docker run --detach --rm \ | |
--name gitlab-cargo-shim \ | |
--mount type=bind,source=$(pwd)/test/config.toml,target=/app/config.toml \ | |
--network host \ | |
gitlab-cargo-shim \ | |
/app/gitlab-cargo-shim -c /app/config.toml | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y python3-pip jq openssh-client | |
pip3 install requests beautifulsoup4 | |
- name: Wait for GitLab to boot | |
run: timeout 20m bash -c 'until curl -s http://127.0.0.1/users/sign_in | grep csrf-token; do sleep 5; done' | |
- name: Create GitLab package | |
run: | | |
export ROOT_PASSWORD=$(docker exec gitlab grep 'Password:' /etc/gitlab/initial_root_password | sed 's/Password: //') | |
export ROOT_PAT=$(python3 ./test/create_pat.py) | |
curl -s --request POST --header "PRIVATE-TOKEN: $ROOT_PAT" --header "Content-Type: application/json" \ | |
--data '{"name": "example-lib"}' \ | |
--url 'http://127.0.0.1/api/v4/projects/' | |
- name: Packaging example-lib | |
run: | | |
cd test/example-lib | |
cargo package | |
cargo metadata --format-version 1 > metadata.json | |
- name: Uploading example-lib to GitLab | |
run: | | |
curl --header "PRIVATE-TOKEN: $ROOT_PAT" --upload-file test/example-lib/target/package/example-lib-0.1.0.crate http://127.0.0.1/api/v4/projects/root%2Fexample-lib/packages/generic/example-lib/0.1.0/example-lib-0.1.0.crate | |
curl --header "PRIVATE-TOKEN: $ROOT_PAT" --upload-file test/example-lib/metadata.json http://127.0.0.1/api/v4/projects/root%2Fexample-lib/packages/generic/example-lib/0.1.0/metadata.json | |
- name: Creating SSH key to identify with gitlab-cargo-shim | |
run: | | |
ssh-keygen -t ed25519 -C testkey -N '' -f ~/.ssh/id_ed25519 | |
- name: Fetching public keys from gitlab-cargo-shim and storing in known_hosts | |
run: | | |
ssh-keyscan -p 2233 127.0.0.1 > ~/.ssh/known_hosts | |
echo -e "Host 127.0.0.1\n\tUser personal-token:$ROOT_PAT" >> ~/.ssh/config | |
- name: Building example-bin using example-lib from registry | |
run: | | |
cd test/example-bin | |
CARGO_NET_GIT_FETCH_WITH_CLI=true cargo check |