Skip to content

Commit

Permalink
Chore/remove yarn lock from root (#27)
Browse files Browse the repository at this point in the history
- simplify tests and improve version check so that tests run
  • Loading branch information
mitchcivic authored Mar 11, 2025
1 parent bdbcbf0 commit 591b262
Show file tree
Hide file tree
Showing 23 changed files with 1,492 additions and 3,929 deletions.
131 changes: 74 additions & 57 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,50 +8,66 @@ on:

jobs:
check-version:
runs-on: ubuntu-latest
outputs:
version_changed: ${{ env.version_changed }}
steps:
- uses: actions/checkout@v4

- name: Check Versions
id: check-version
run: |
AUTH_BETA_VERSION=$(npm view @civic/auth@beta version)
AUTH_PROD_VERSION=$(npm view @civic/auth version)
WEB3_BETA_VERSION=$(npm view @civic/auth-web3@beta version)
WEB3_PROD_VERSION=$(npm view @civic/auth-web3 version)
runs-on: ubuntu-latest
outputs:
version_changed: ${{ steps.check-version.outputs.version_changed }}
steps:
- uses: actions/checkout@v4

- name: Check Versions
id: check-version
run: |
# Default to false
echo "version_changed=false" >> $GITHUB_OUTPUT
AUTH_BETA_VERSION=$(npm view @civic/auth@beta version)
AUTH_PROD_VERSION=$(npm view @civic/auth version)
WEB3_BETA_VERSION=$(npm view @civic/auth-web3@beta version)
WEB3_PROD_VERSION=$(npm view @civic/auth-web3 version)
echo "Auth Beta version: $AUTH_BETA_VERSION"
echo "Auth Production version: $AUTH_PROD_VERSION"
echo "Web3 Beta version: $WEB3_BETA_VERSION"
echo "Web3 Production version: $WEB3_PROD_VERSION"
if [ -f .civic-versions ]; then
PREV_VERSIONS=$(cat .civic-versions)
PREV_AUTH_BETA=$(echo "$PREV_VERSIONS" | sed -n '1p')
PREV_AUTH_PROD=$(echo "$PREV_VERSIONS" | sed -n '2p')
PREV_WEB3_BETA=$(echo "$PREV_VERSIONS" | sed -n '3p')
PREV_WEB3_PROD=$(echo "$PREV_VERSIONS" | sed -n '4p')
echo "Auth Beta version: $AUTH_BETA_VERSION"
echo "Auth Production version: $AUTH_PROD_VERSION"
echo "Web3 Beta version: $WEB3_BETA_VERSION"
echo "Web3 Production version: $WEB3_PROD_VERSION"
# Always echo previous versions for confirmation
echo "Previous versions:"
echo "Auth Beta: $PREV_AUTH_BETA"
echo "Auth Prod: $PREV_AUTH_PROD"
echo "Web3 Beta: $PREV_WEB3_BETA"
echo "Web3 Prod: $PREV_WEB3_PROD"
if [ -f .civic-versions ]; then
PREV_VERSIONS=$(cat .civic-versions)
PREV_AUTH_BETA=$(echo "$PREV_VERSIONS" | sed -n '1p')
PREV_AUTH_PROD=$(echo "$PREV_VERSIONS" | sed -n '2p')
PREV_WEB3_BETA=$(echo "$PREV_VERSIONS" | sed -n '3p')
PREV_WEB3_PROD=$(echo "$PREV_VERSIONS" | sed -n '4p')
if [ "$AUTH_BETA_VERSION" != "$PREV_AUTH_BETA" ] || \
[ "$AUTH_PROD_VERSION" != "$PREV_AUTH_PROD" ] || \
[ "$WEB3_BETA_VERSION" != "$PREV_WEB3_BETA" ] || \
[ "$WEB3_PROD_VERSION" != "$PREV_WEB3_PROD" ]; then
echo "version_changed=true" >> $GITHUB_ENV
echo "Changed from:"
echo "Auth Beta: $PREV_AUTH_BETA -> $AUTH_BETA_VERSION"
echo "Auth Prod: $PREV_AUTH_PROD -> $AUTH_PROD_VERSION"
echo "Web3 Beta: $PREV_WEB3_BETA -> $WEB3_BETA_VERSION"
echo "Web3 Prod: $PREV_WEB3_PROD -> $WEB3_PROD_VERSION"
fi
if [ "$AUTH_BETA_VERSION" != "$PREV_AUTH_BETA" ] || \
[ "$AUTH_PROD_VERSION" != "$PREV_AUTH_PROD" ] || \
[ "$WEB3_BETA_VERSION" != "$PREV_WEB3_BETA" ] || \
[ "$WEB3_PROD_VERSION" != "$PREV_WEB3_PROD" ]; then
echo "version_changed=true" >> $GITHUB_OUTPUT
echo "Changed from:"
echo "Auth Beta: $PREV_AUTH_BETA -> $AUTH_BETA_VERSION"
echo "Auth Prod: $PREV_AUTH_PROD -> $AUTH_PROD_VERSION"
echo "Web3 Beta: $PREV_WEB3_BETA -> $WEB3_BETA_VERSION"
echo "Web3 Prod: $PREV_WEB3_PROD -> $WEB3_PROD_VERSION"
else
echo "No version changes detected"
fi
# Write new versions to file
echo "$AUTH_BETA_VERSION" > .civic-versions
echo "$AUTH_PROD_VERSION" >> .civic-versions
echo "$WEB3_BETA_VERSION" >> .civic-versions
echo "$WEB3_PROD_VERSION" >> .civic-versions
else
# If the file doesn't exist, it's the first run, so we consider it changed
echo "First run - no previous versions file found"
echo "version_changed=true" >> $GITHUB_OUTPUT
fi
# Write new versions to file
echo "$AUTH_BETA_VERSION" > .civic-versions
echo "$AUTH_PROD_VERSION" >> .civic-versions
echo "$WEB3_BETA_VERSION" >> .civic-versions
echo "$WEB3_PROD_VERSION" >> .civic-versions
build:
needs: check-version
Expand All @@ -74,29 +90,31 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies

- name: Force upgrade civic/auth and civic/auth-web3
shell: bash
run: yarn install
working-directory: ./
run: yarn upgrade @civic/auth @civic/auth-web3 --latest

- name: Build
working-directory: ./
run: yarn build

- name: Start the nextjs example app
uses: JarvusInnovations/background-action@v1.0.7
with:
run: yarn dev &
working-directory: packages/civic-auth/nextjs
wait-on: http://localhost:3000
wait-for: 60s
wait-on: http-get://localhost:3000
wait-for: 120s
log-output-if: true

- name: Start the reactjs example app
uses: JarvusInnovations/background-action@v1.0.7
with:
run: yarn dev &
working-directory: packages/civic-auth/reactjs
wait-on: http://localhost:3001
wait-on: http://localhost:3001/
wait-for: 60s
log-output-if: true

Expand All @@ -105,7 +123,7 @@ jobs:
with:
run: yarn dev &
working-directory: packages/civic-auth/server/express
wait-on: http://localhost:3002
wait-on: http://localhost:3002/
wait-for: 60s
log-output-if: true

Expand All @@ -114,23 +132,23 @@ jobs:
with:
run: yarn dev &
working-directory: packages/civic-auth/server/fastify
wait-on: http://localhost:3003
wait-on: http://localhost:3003/
wait-for: 60s
log-output-if: true

- name: Start the hono example app
working-directory: ./packages/civic-auth/server/hono
run: |
bun add @hono/node-server
yarn dev & npx wait-on http://localhost:3004
yarn dev & npx wait-on http://localhost:3004/
timeout-minutes: 1

- name: Start the wagmi example app
uses: JarvusInnovations/background-action@v1.0.7
with:
run: yarn dev &
working-directory: packages/civic-auth-web3/wagmi
wait-on: http://localhost:3005
wait-on: http://localhost:3005/
wait-for: 60s
log-output-if: true

Expand All @@ -139,7 +157,7 @@ jobs:
with:
run: yarn dev &
working-directory: packages/civic-auth-web3/solana
wait-on: http://localhost:3006
wait-on: http://localhost:3006/
wait-for: 60s
log-output-if: true

Expand All @@ -162,18 +180,17 @@ jobs:
HONO_BASE_URL: 'http://localhost:3004'
WAGMI_BASE_URL: 'http://localhost:3005'
SOLANA_BASE_URL: 'http://localhost:3006'
CYPRESS_TEST_TAG: '@prod'
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}

- name: Send Slack Notification on Failure
if: failure()
uses: slackapi/slack-github-action@v1.27.0
with:
payload: |
{
"channel": "#build",
"text": "Example repo Cypress tests failed in civicteam/civic-auth-examples.\n\nThese tests are run after new beta and prod versions of civic/auth and civic/auth-web3, so there may be an issue with the new version(s). Check the recording of the test failure here https://cloud.cypress.io/projects/cmyigw/runs.\n\n Alternatively, see the full GitHub Actions run details here ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}.",
}
{
"channel": "#build",
"text": "<!subteam^S012Q4F3TRB> <@UCBGV5J12> Example repo Cypress tests failed in civicteam/civic-auth-examples.\n\nThese tests are run after new beta and prod versions of civic/auth and civic/auth-web3, so there may be an issue with the new version(s). Check the recording of the test failure here https://cloud.cypress.io/projects/cmyigw/runs.\n\n Alternatively, see the full GitHub Actions run details here ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}."
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
9 changes: 3 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,11 @@
},
"packageManager": "yarn@1.22.22",
"resolutions": {
"next": "15.0.3",
"react": "19.0.0-rc-66855b96-20241106",
"react-dom": "19.0.0-rc-66855b96-20241106",
"vite": "6.0.1"
"@civic/auth-web3": "*",
"@civic/auth": "*"
},
"devDependencies": {
"@vitejs/plugin-react": "^4.3.4",
"turbo": "latest",
"vite": "6.0.1"
"turbo": "latest"
}
}
Loading

0 comments on commit 591b262

Please sign in to comment.