aboutsummaryrefslogtreecommitdiffstats
path: root/.github/workflows/job.yml
diff options
context:
space:
mode:
Diffstat (limited to '.github/workflows/job.yml')
-rw-r--r--.github/workflows/job.yml59
1 files changed, 59 insertions, 0 deletions
diff --git a/.github/workflows/job.yml b/.github/workflows/job.yml
new file mode 100644
index 0000000..c4f7f81
--- /dev/null
+++ b/.github/workflows/job.yml
@@ -0,0 +1,59 @@
+name: Test, build and publish UI
+on:
+ push:
+ branches:
+ - main
+env:
+ GCS_BUCKET: slam-lang-gh-artifacts
+ VITE_RUNNER_API_URL: https://runner-api-6hdcd6nxsq-ew.a.run.app
+ VITE_EXAMPLE_API_URL: https://example-api-6hdcd6nxsq-ew.a.run.app
+
+jobs:
+ test-build-and-publish:
+ runs-on: ubuntu-latest
+ steps:
+ - id: checkout
+ uses: actions/checkout@v2
+
+ - name: "Compute archive name"
+ run: |
+ echo "Long commit SHA: ${GITHUB_SHA}"
+ export TAG=$(echo "${GITHUB_SHA}" | head -c 7)
+ export ARCHIVE="ui-${TAG}.zip"
+ echo "ARCHIVE: ${ARCHIVE}"
+ echo "TAG=${TAG}" >> ${GITHUB_ENV}
+ echo "ARCHIVE=${ARCHIVE}" >> ${GITHUB_ENV}
+
+ - id: "auth"
+ uses: "google-github-actions/auth@v0"
+ with:
+ credentials_json: "${{ secrets.GCP_CREDENTIALS }}"
+
+ - name: "Set up Node.js 16"
+ uses: actions/setup-node@v2
+ with:
+ node-version: "16"
+
+ - name: "Set up Cloud SDK"
+ uses: "google-github-actions/setup-gcloud@v0"
+
+ - name: "Install NPM deps"
+ run: |
+ npm ci
+ npm i serve
+
+ - name: "Build"
+ run: |
+ npm run build
+
+ - name: "Run E2E tests"
+ run: |
+ npx -y serve -p 3000 dist &
+ npm run test
+ kill %1
+
+ - name: "Compress and publish"
+ run: |
+ zip -r "${ARCHIVE}" dist
+ gsutil cp "${ARCHIVE}" gs://${GCS_BUCKET}/
+ echo "Published revision ${TAG} (archive gs://${GCS_BUCKET}/${ARCHIVE})"