Nightly Examples Tests #34
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: Nightly Examples Tests | |
on: | |
schedule: | |
# run this workflow every day at 1:30 AM UTC | |
- cron: "30 1 * * *" | |
# Allows triggering the workflow manually | |
workflow_dispatch: | |
jobs: | |
prepare-matrix-master-only: | |
name: Prepare matrix JSON | |
runs-on: ubuntu-latest | |
outputs: | |
matrix-json: ${{ steps.get-matrix.outputs.matrix }} | |
steps: | |
# prepares JSON object representing strategy matrix with only the master branch | |
- name: Get matrix JSON | |
id: get-matrix | |
run: echo "::set-output name=matrix::{\"include\":[{\"branch\":\"master\"}]}" | |
goth-tests: | |
runs-on: [goth2, ubuntu-22.10] | |
needs: prepare-matrix-master-only | |
strategy: | |
matrix: ${{ fromJson(needs.prepare-matrix-master-only.outputs.matrix-json) }} | |
fail-fast: false | |
name: Run example tests (nightly) on ${{ matrix.branch }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Configure node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Build golem-js | |
run: | | |
sudo apt-get update -y | |
sudo apt-get install -y build-essential | |
npm install | |
npm run build | |
npm install --prefix examples | |
npm install ts-node | |
- name: Configure python | |
continue-on-error: true | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Install goth | |
run: | | |
pip install goth>=0.15.3 | |
rm -rf ../goth/assets | |
python -m goth create-assets ../goth/assets | |
sed -Ezi 's/(use\-proxy:\s)(True)/\1False/mg' ../goth/assets/goth-config.yml | |
sed -Ezi 's/(use\-prerelease:\s)(false)/\1true\n release-tag: "0.13.0-rc21"/mg' ../goth/assets/goth-config.yml | |
sed -i '/^ENTRYPOINT/i ENV YAGNA_AUTOCONF_APPKEY=try_golem' ../goth/assets/docker/yagna-goth-deb.Dockerfile | |
- name: Cleanup Docker | |
if: always() | |
run: | | |
c=$(docker ps -q) && [[ $c ]] && docker kill $c | |
docker system prune -af | |
- name: Log in to GitHub Docker repository | |
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login docker.pkg.github.com -u ${{github.actor}} --password-stdin | |
- name: Run test suite | |
env: | |
GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
npm run test:examples | |
- name: Upload test logs | |
uses: actions/upload-artifact@v2 | |
if: always() | |
with: | |
name: goth-logs | |
path: /tmp/goth-tests | |
# Only relevant for self-hosted runners | |
- name: Remove test logs | |
if: always() | |
run: rm -rf /tmp/goth-tests | |
- name: Cleanup Docker | |
if: always() | |
run: | | |
c=$(docker ps -q) && [[ $c ]] && docker kill $c | |
docker system prune -af |