fix(docs): improve first install with scripting (#47) #209
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: Test | |
on: | |
pull_request: | |
types: | |
- closed | |
push: | |
branches: | |
- "*" | |
paths-ignore: | |
- "**.md" | |
jobs: | |
publish-test-server: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: "./packages/test-server" | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: vexilla | |
password: ${{secrets.GITHUB_TOKEN}} | |
- name: Build Test Server Image | |
run: | | |
docker build . --tag ghcr.io/vexilla/test-server:latest | |
docker push ghcr.io/vexilla/test-server:latest | |
test-bazel: | |
runs-on: ubuntu-22.04 | |
needs: ["publish-test-server"] | |
services: | |
test-server: | |
credentials: | |
username: vexilla | |
password: ${{secrets.GITHUB_TOKEN}} | |
image: ghcr.io/vexilla/test-server:latest | |
ports: | |
- 3000:3000 | |
options: | | |
--health-cmd "curl -f http://localhost:3000/manifest.json" | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Cache Bazel | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/bazel | |
key: ${{ runner.os }}-bazel-${{ hashFiles('.bazelversion', '.bazelrc', 'WORKSPACE', 'WORKSPACE.bazel', 'MODULE.bazel') }} | |
restore-keys: | | |
${{ runner.os }}-bazel- | |
- run: bazel build //... | |
- run: bazel coverage --combined_report=lcov //... | |
env: | |
TEST_SERVER_HOST: test-server | |
test-elixir: | |
runs-on: ubuntu-latest | |
container: elixir:1.15.7 | |
needs: ["publish-test-server"] | |
services: | |
test-server: | |
credentials: | |
username: vexilla | |
password: ${{secrets.GITHUB_TOKEN}} | |
image: ghcr.io/vexilla/test-server:latest | |
ports: | |
- 3000:3000 | |
options: | | |
--health-cmd "curl -f http://localhost:3000/manifest.json" | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Cache Mix dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
/clients/elixir/_build | |
/clients/elixir/deps | |
key: ${{ runner.os }}-elixir-${{ hashFiles('clients/elixir/mix.lock') }} | |
restore-keys: | | |
${{ runner.os }}-elixir- | |
- run: | | |
cd ./clients/elixir | |
mix deps.get | |
mix local.hex --force | |
mix test --cover --export-coverage default | |
mix test.coverage | |
env: | |
TEST_SERVER_HOST: test-server:3000 | |
test-kotlin: | |
runs-on: ubuntu-latest | |
needs: ["publish-test-server"] | |
services: | |
test-server: | |
credentials: | |
username: vexilla | |
password: ${{secrets.GITHUB_TOKEN}} | |
image: ghcr.io/vexilla/test-server:latest | |
ports: | |
- 3000:3000 | |
options: | | |
--health-cmd "curl -f http://localhost:3000/manifest.json" | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: corretto | |
java-version: 8 | |
- name: Setup Gradle | |
uses: gradle/gradle-build-action@v2 | |
- name: Execute Gradle build and then test | |
run: | | |
cd clients/kotlin | |
./gradlew build | |
./gradlew test | |
# test-server not available on local network | |
# env: | |
# TEST_SERVER_HOST: test-server | |
test-ocaml: | |
runs-on: ubuntu-latest | |
needs: ["publish-test-server"] | |
services: | |
test-server: | |
credentials: | |
username: vexilla | |
password: ${{secrets.GITHUB_TOKEN}} | |
image: ghcr.io/vexilla/test-server:latest | |
ports: | |
- 3000:3000 | |
options: | | |
--health-cmd "curl -f http://localhost:3000/manifest.json" | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set-up OCaml 4.14 | |
uses: ocaml/setup-ocaml@v2 | |
with: | |
ocaml-compiler: "4.14" | |
- name: Cache Dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/ocaml | |
/clients/ocaml/opam | |
key: ${{ runner.os }}-ocaml-${{ hashFiles('**/*.opam.locked') }} | |
restore-keys: | | |
${{ runner.os }}-ocaml- | |
- run: | | |
cd ./clients/ocaml | |
opam install . --deps-only --with-test --locked | |
opam install alcotest alcotest-lwt | |
opam exec -- dune build | |
opam exec -- dune test | |
env: | |
TEST_SERVER_HOST: test-server:3000 | |
test-php: | |
runs-on: ubuntu-latest | |
container: php:7.4.33-fpm | |
needs: ["publish-test-server"] | |
services: | |
test-server: | |
credentials: | |
username: vexilla | |
password: ${{secrets.GITHUB_TOKEN}} | |
image: ghcr.io/vexilla/test-server:latest | |
ports: | |
- 3000:3000 | |
options: | | |
--health-cmd "curl -f http://localhost:3000/manifest.json" | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Cache Composer dependencies | |
uses: actions/cache@v3 | |
with: | |
path: /tmp/composer-cache | |
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-php- | |
- name: Install Composer | |
run: | | |
apt-get update | |
apt-get install git unzip -y | |
pecl install pcov | |
cp /usr/local/etc/php/php.ini-development /usr/local/etc/php/php.ini | |
echo "extension=pcov.so\n" >> /usr/local/etc/php/php.ini | |
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" | |
# php -r "if (hash_file('sha384', 'composer-setup.php') === 'e21205b207c3ff031906575712edab6f13eb0b361f2085f1f1237b7126d785e826a450292b6cfd1d64d92e6563bbde02') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" | |
php composer-setup.php --install-dir=/usr/local/bin --filename=composer | |
php -r "unlink('composer-setup.php');" | |
- run: | | |
cd ./clients/php | |
composer install | |
composer test | |
env: | |
TEST_SERVER_HOST: test-server:3000 | |
test-python: | |
runs-on: ubuntu-latest | |
container: python:3.6.15 | |
needs: ["publish-test-server"] | |
services: | |
test-server: | |
credentials: | |
username: vexilla | |
password: ${{secrets.GITHUB_TOKEN}} | |
image: ghcr.io/vexilla/test-server:latest | |
ports: | |
- 3000:3000 | |
options: | | |
--health-cmd "curl -f http://localhost:3000/manifest.json" | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Cache Dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/Pipfile.lock') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- run: pip3 install pipenv | |
- run: | | |
cd ./clients/python | |
pipenv install | |
pipenv run pytest --cov=vexilla_client | |
env: | |
TEST_SERVER_HOST: test-server:3000 | |
test-swift: | |
runs-on: ubuntu-latest | |
container: swift:5.5-focal | |
needs: ["publish-test-server"] | |
services: | |
test-server: | |
credentials: | |
username: vexilla | |
password: ${{secrets.GITHUB_TOKEN}} | |
image: ghcr.io/vexilla/test-server:latest | |
ports: | |
- 3000:3000 | |
options: | | |
--health-cmd "curl -f http://localhost:3000/manifest.json" | |
steps: | |
- uses: actions/checkout@v3 | |
- run: | | |
swift build | |
swift test | |
env: | |
TEST_SERVER_HOST: test-server:3000 |