mirror of
https://github.com/fluencelabs/aqua.git
synced 2024-12-04 14:40:17 +00:00
chore: Add E2E tests (#556)
* Redo PR CI * Add comment and fixes * Fixes * Set fluence-js version * Use aqua-playground workflow from master
This commit is contained in:
parent
7b61247ade
commit
f335e1ab3f
157
.github/workflows/snapshot.yml
vendored
Normal file
157
.github/workflows/snapshot.yml
vendored
Normal file
@ -0,0 +1,157 @@
|
||||
name: Publish snapshot
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
fluence-js-version:
|
||||
description: "@fluencejs/fluence version"
|
||||
type: string
|
||||
outputs:
|
||||
aqua-version:
|
||||
description: "@fluencelabs/aqua version"
|
||||
value: ${{ jobs.publish-snapshot.outputs.aqua-version }}
|
||||
|
||||
env:
|
||||
FORCE_COLOR: true
|
||||
|
||||
jobs:
|
||||
compile:
|
||||
name: "Compile aqua"
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: fluencelabs/aqua
|
||||
|
||||
- name: Cache Scala
|
||||
uses: coursier/cache-action@v6
|
||||
|
||||
- name: Setup Scala
|
||||
uses: coursier/setup-action@v1
|
||||
|
||||
- name: Compile aqua
|
||||
run: sbt "cliJS/fastOptJS"
|
||||
|
||||
- name: Upload compiled aqua
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: aqua
|
||||
path: cli/.js/target/scala-*/cli-fastopt.js
|
||||
|
||||
publish-snapshot:
|
||||
name: "Publish aqua snapshot"
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
needs: compile
|
||||
|
||||
outputs:
|
||||
aqua-version: "${{ steps.build.outputs.version }}"
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write
|
||||
|
||||
steps:
|
||||
- name: Checkout aqua
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: fluencelabs/aqua
|
||||
|
||||
- name: Download compiled aqua
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: aqua
|
||||
|
||||
- run: mv scala-*/cli-fastopt.js npm/aqua.js
|
||||
|
||||
- name: Import secrets
|
||||
uses: hashicorp/vault-action@v2.4.2
|
||||
with:
|
||||
url: https://vault.fluence.dev
|
||||
path: jwt/github
|
||||
role: ci
|
||||
method: jwt
|
||||
jwtGithubAudience: "https://github.com/fluencelabs"
|
||||
jwtTtl: 300
|
||||
exportToken: false
|
||||
secrets: |
|
||||
kv/npm-registry/basicauth/ci token | NODE_AUTH_TOKEN
|
||||
|
||||
- name: Setup node with self-hosted npm registry
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: "16"
|
||||
registry-url: "https://npm.fluence.dev"
|
||||
cache-dependency-path: "npm/package-lock.json"
|
||||
cache: "npm"
|
||||
|
||||
- name: Set fluence-js version from branch
|
||||
if: inputs.fluence-js-version != ''
|
||||
working-directory: npm
|
||||
run: npm i @fluencelabs/fluence@${{ inputs.fluence-js-version }}
|
||||
|
||||
- run: npm i
|
||||
working-directory: npm
|
||||
|
||||
- run: npm run build
|
||||
working-directory: npm
|
||||
|
||||
- name: Generate package version
|
||||
id: version
|
||||
run: |
|
||||
SHA=$(git rev-parse --short HEAD)
|
||||
echo "::set-output name=sha::$SHA"
|
||||
echo "::set-output name=branch::${GITHUB_HEAD_REF//[^a-zA-Z0-9-]/-}"
|
||||
|
||||
- name: Set package version
|
||||
id: build
|
||||
env:
|
||||
BRANCH: ${{ steps.version.outputs.branch }}
|
||||
SHA: ${{ steps.version.outputs.sha }}
|
||||
RUN: ${{ github.run_number }}
|
||||
ATTEMPT: ${{ github.run_attempt }}
|
||||
working-directory: npm
|
||||
run: |
|
||||
echo "::set-output name=version::$(\
|
||||
npm version prerelease \
|
||||
--no-git-tag-version \
|
||||
--preid ${{ env.BRANCH }}-${{ env.SHA }}-${{ env.RUN }}-${{ env.ATTEMPT }})"
|
||||
|
||||
- name: Publish to self-hosted npm repo
|
||||
working-directory: npm
|
||||
run: npm publish --tag snapshot --registry https://npm.fluence.dev
|
||||
|
||||
comment:
|
||||
name: "Update comment"
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
needs:
|
||||
- publish-snapshot
|
||||
|
||||
env:
|
||||
AQUA_VERSION: ${{ needs.publish-snapshot.outputs.aqua-version }}
|
||||
|
||||
steps:
|
||||
- name: Find comment
|
||||
uses: peter-evans/find-comment@v1
|
||||
id: comment
|
||||
with:
|
||||
issue-number: "${{ github.event.pull_request.number }}"
|
||||
comment-author: github-actions[bot]
|
||||
body-includes: "## Aqua version is"
|
||||
|
||||
- name: Update comment
|
||||
uses: peter-evans/create-or-update-comment@v1
|
||||
with:
|
||||
comment-id: "${{ steps.comment.outputs.comment-id }}"
|
||||
issue-number: "${{ github.event.pull_request.number }}"
|
||||
edit-mode: replace
|
||||
body: |
|
||||
## Aqua version is [${{ env.AQUA_VERSION }}](https://npm.fluence.dev/-/web/detail/@fluencelabs/aqua/v/${{ env.AQUA_VERSION }})
|
||||
To install it run:
|
||||
```shell
|
||||
npm login --registry https://npm.fluence.dev
|
||||
npm i @fluencelabs/aqua@${{ env.AQUA_VERSION }} --registry=https://npm.fluence.dev
|
||||
```
|
64
.github/workflows/test_branch.yml
vendored
64
.github/workflows/test_branch.yml
vendored
@ -1,64 +0,0 @@
|
||||
name: "test"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches-ignore:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: "sbt test"
|
||||
runs-on: "ubuntu-latest"
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
### Setup
|
||||
- name: Cache SBT
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.ivy2/cache
|
||||
~/.sbt
|
||||
key: ${{ runner.os }}-sbt-${{ hashFiles('**/build.sbt') }}
|
||||
|
||||
- name: Cache npm
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-node-
|
||||
|
||||
- name: Cache coursier
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/.cache/coursier
|
||||
key: ${{ runner.OS }}-coursier-cache-${{ hashFiles('**/*.sbt') }}
|
||||
restore-keys: |
|
||||
${{ runner.OS }}-coursier-cache-${{ hashFiles('**/*.sbt') }}-
|
||||
${{ runner.OS }}-coursier-cache-
|
||||
|
||||
- uses: olafurpg/setup-scala@v10
|
||||
|
||||
- name: Sbt test
|
||||
run: |
|
||||
sbt test
|
||||
|
||||
### Update & build
|
||||
- name: Integration test
|
||||
run: |
|
||||
git clone https://github.com/fluencelabs/aqua-playground.git
|
||||
sbt "cliJS/fastOptJS"
|
||||
rm -rf aqua-playground/src/compiled/examples/*
|
||||
mv cli/.js/target/scala-3.1.3/cli-fastopt.js npm/aqua.js
|
||||
cd npm
|
||||
npm i
|
||||
npm run build
|
||||
cd ../aqua-playground
|
||||
npm i --save-dev ../npm
|
||||
npm i
|
||||
cd ../aqua-playground
|
||||
npm run compile-aqua -- -c "UNIQUE_CONST = 1" -c "ANOTHER_CONST = \"ab\""
|
||||
npm run examples
|
39
.github/workflows/tests.yml
vendored
Normal file
39
.github/workflows/tests.yml
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
name: Run tests
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths-ignode:
|
||||
- "**.md"
|
||||
|
||||
concurrency:
|
||||
group: "${{ github.workflow }}-${{ github.ref }}"
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
name: "Run sbt tests"
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: fluencelabs/aqua
|
||||
|
||||
- name: Cache Scala
|
||||
uses: coursier/cache-action@v6
|
||||
|
||||
- name: Setup Scala
|
||||
uses: coursier/setup-action@v1
|
||||
|
||||
- name: Run tests
|
||||
run: sbt test
|
||||
|
||||
snapshot:
|
||||
uses: ./.github/workflows/snapshot.yml
|
||||
|
||||
aqua-playground:
|
||||
needs: snapshot
|
||||
uses: fluencelabs/aqua-playground/.github/workflows/tests.yml@master
|
||||
with:
|
||||
aqua-version: ${{ needs.snapshot.outputs.aqua-version }}
|
Loading…
Reference in New Issue
Block a user