fix: fix duplicate #2728
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: Cypress E2E tests | |
on: | |
pull_request: | |
branches: | |
- master | |
jobs: | |
get-cypress-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
path: ./sphinx-nav-fiber | |
- name: Debug test files | |
working-directory: ./sphinx-nav-fiber | |
run: | | |
find cypress/e2e -name '*.spec.js' -o -name '*.cy.ts' | jq -R -s -c 'split("\n") | map(select(. != ""))' | |
- name: List Cypress test files | |
id: list-tests | |
working-directory: ./sphinx-nav-fiber | |
run: | | |
tests=$(find cypress/e2e -name '*.spec.js' -o -name '*.cy.ts' | jq -R -s -c 'split("\n") | map(select(. != ""))') | |
if [ -z "$tests" ]; then | |
echo "No Cypress test files found." | |
tests="[]" | |
fi | |
echo "::set-output name=tests::$tests" | |
outputs: | |
tests: ${{ steps.list-tests.outputs.tests }} | |
cypress-run: | |
runs-on: ubuntu-latest | |
needs: get-cypress-tests | |
strategy: | |
fail-fast: false | |
matrix: | |
file: ${{ fromJson(needs.get-cypress-tests.outputs.tests) }} | |
steps: | |
- name: Enable docker.host.internal for Ubuntu | |
run: | | |
pwd && sudo bash -c 'echo "172.17.0.1 host.docker.internal" >> /etc/hosts' | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: ".nvmrc" | |
cache: "yarn" | |
- name: Clone Stack | |
run: | | |
git clone -b multipleWorkers https://github.com/stakwork/sphinx-stack.git stack | |
- name: Give Permissions to Sphinx Nav Fiber | |
run: chmod 777 -R relay | |
- name: Give Permissions to Stack | |
working-directory: ./stack | |
run: | | |
chmod 777 ./bitcoind; | |
chmod 777 -R ./relay; | |
chmod 777 -R ./lnd; | |
chmod 777 -R ./proxy; | |
chmod 777 -R ./cln; | |
# - name: Create data working-directory | |
# run: mkdir -p data | |
# - name: Download file | |
# run: | | |
# curl -LO https://machinelearningneo4jbackup.s3.amazonaws.com/neo4j.tar | |
# - name: untar file | |
# run: tar -xf neo4j.tar -C data | |
# - name: Copy Neo4J Data to stack | |
# run: cp -r ./data ./stack/neo4j | |
- name: Check for NODES | |
uses: nick-fields/retry@v3 | |
with: | |
timeout_minutes: 10 | |
max_attempts: 3 | |
command: | | |
export TWITTER_BEARER="Bearer ${{ secrets.TWITTER_BEARER }}" | |
echo $TWITTER_BEARER | |
STAKWORK_TOKEN=daaa3a0894f0658d99781471dfccd3e1 TWITTER_BEARER=$TWITTER_BEARER GITACTION_ENV=gitactionenv docker compose -f ./stack/alts/navfiber.yml --project-directory ./stack up -d; | |
sleep 240; | |
docker ps | |
docker logs meme.sphinx | |
docker logs dave.sphinx | |
docker wait stack_relaysetup_1 | |
cat stack/relay/NODES.json; | |
- name: Copy Node.json | |
uses: canastro/copy-file-action@master | |
with: | |
source: "stack/relay/NODES.json" | |
target: "relay/nodes.json" | |
- name: Sanitize Test File Path | |
run: echo "SANITIZED_FILE=$(echo ${{ matrix.file }} | sed 's/\//_/g')" >> $GITHUB_ENV | |
- name: Install | |
run: yarn --immutable | |
- name: Cypress run | |
# Uses the official Cypress GitHub action https://github.com/cypress-io/github-action | |
uses: cypress-io/github-action@v6 | |
with: | |
install-command: yarn --immutable | |
browser: chrome | |
headless: true | |
start: yarn run start-e2e | |
spec: ${{ matrix.file }} | |
wait-on: "http://localhost:3000" # Waits for above | |
wait-on-timeout: 120 # Waits for 2 minutes | |
# Records to Cypress Dashboard | |
record: false | |
video: true | |
env: | |
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} | |
# created by the GH Action automatically | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# - name: Component tests | |
# run: yarn run cy-comp | |
# continue-on-error: false | |
- name: Upload Cypress logs | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "${{ env.SANITIZED_FILE }}-cypress-logs" | |
path: cypress/videos | |
- name: Stop Stack | |
working-directory: ./stack | |
run: docker compose down |