enso/gui/.github/workflows/gui-ci.yml
2021-03-15 17:14:11 +01:00

501 lines
18 KiB
YAML

# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# DO NOT CHANGE THIS FILE. IT WAS GENERATED FROM 'build/workflow.js'. READ DOCS THERE TO LEARN MORE.
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
name: GUI CI
'on':
push:
branches:
- develop
- unstable
- stable
pull_request: {}
jobs:
info:
name: Build Info
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- macOS-latest
fail-fast: false
steps:
- uses: actions/checkout@v1
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
version_assertions:
name: Assertions
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- macOS-latest
fail-fast: false
steps:
- uses: actions/checkout@v1
- name: Read changelog info
id: changelog
run: |2-
node ./run ci-gen --skip-version-validation
content=`cat CURRENT_RELEASE_CHANGELOG.json`
echo "::set-output name=content::$content"
shell: bash
- name: Assert Version Unstable
run: node ./run assert-version-unstable --skip-version-validation
if: github.ref == 'refs/heads/unstable' || github.base_ref == 'unstable'
- name: Assert Version Stable
run: node ./run assert-version-stable --skip-version-validation
if: github.ref == 'refs/heads/stable' || github.base_ref == 'stable'
- id: checkCurrentReleaseTag
uses: mukunku/tag-exists-action@v1.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag: v${{fromJson(steps.changelog.outputs.content).version}}
- name: Fail if release already exists
run: >-
if [[ ${{ steps.checkCurrentReleaseTag.outputs.exists }} == true ]];
then exit 1; fi
if: github.base_ref == 'unstable' || github.base_ref == 'stable'
- name: Get list of changed files
id: changed_files
run: |2-
list=`git diff --name-only origin/${{github.base_ref}} HEAD | tr '\n' ' '`
echo $list
echo "::set-output name=list::'$list'"
shell: bash
if: >-
github.base_ref == 'develop' || github.base_ref == 'unstable' ||
github.base_ref == 'stable'
- name: Assert if CHANGELOG.md was updated (on pull request)
run: >-
if [[ ${{ contains(steps.changed_files.outputs.list,'CHANGELOG.md') ||
contains(github.event.head_commit.message,'[ci no changelog needed]')
}} == false ]]; then exit 1; fi
if: >-
github.base_ref == 'develop' || github.base_ref == 'unstable' ||
github.base_ref == 'stable'
- name: Fail if squash commit to the 'unstable' or the 'stable' branch.
run: >-
if [[ "${{ github.base_ref }}" == "unstable" || "${{ github.base_ref
}}" == "stable" ]]; then exit 1; fi
lint:
name: Linter
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- macOS-latest
fail-fast: false
steps:
- uses: actions/checkout@v1
- name: Install Node
uses: actions/setup-node@v1
with:
node-version: 14.15.0
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2019-11-04
override: true
- name: Install Prettier
run: npm install --save-dev --save-exact prettier
- name: Install Clippy
run: rustup component add clippy
- name: Lint Markdown sources
run: npx prettier --check '*.md'
- name: Lint JavaScript sources
run: npx prettier --check 'src/**/*.js'
- name: Lint Rust sources
run: node ./run lint --skip-version-validation
test:
name: Tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- macOS-latest
fail-fast: false
steps:
- uses: actions/checkout@v1
- name: Install Node
uses: actions/setup-node@v1
with:
node-version: 14.15.0
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2019-11-04
override: true
- name: Run tests (no WASM)
run: node ./run test --no-wasm --skip-version-validation
wasm-test:
name: WASM Tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- macOS-latest
fail-fast: false
steps:
- uses: actions/checkout@v1
- name: Install Node
uses: actions/setup-node@v1
with:
node-version: 14.15.0
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2019-11-04
override: true
- name: Install wasm-pack (macOS)
env:
WASMPACKURL: https://github.com/rustwasm/wasm-pack/releases/download/v0.9.1
WASMPACKDIR: wasm-pack-v0.9.1-x86_64-apple-darwin
run: |2-
curl -L "$WASMPACKURL/$WASMPACKDIR.tar.gz" | tar -xz -C .
mv $WASMPACKDIR/wasm-pack ~/.cargo/bin
rm -r $WASMPACKDIR
shell: bash
if: startsWith(matrix.os,'macOS')
- name: Install wasm-pack (Windows)
env:
WASMPACKURL: https://github.com/rustwasm/wasm-pack/releases/download/v0.9.1
WASMPACKDIR: wasm-pack-v0.9.1-x86_64-pc-windows-msvc
run: |2-
curl -L "$WASMPACKURL/$WASMPACKDIR.tar.gz" | tar -xz -C .
mv $WASMPACKDIR/wasm-pack ~/.cargo/bin
rm -r $WASMPACKDIR
shell: bash
if: startsWith(matrix.os,'windows')
- name: Install wasm-pack (Linux)
env:
WASMPACKURL: https://github.com/rustwasm/wasm-pack/releases/download/v0.9.1
WASMPACKDIR: wasm-pack-v0.9.1-x86_64-unknown-linux-musl
run: |2-
curl -L "$WASMPACKURL/$WASMPACKDIR.tar.gz" | tar -xz -C .
mv $WASMPACKDIR/wasm-pack ~/.cargo/bin
rm -r $WASMPACKDIR
shell: bash
if: startsWith(matrix.os,'ubuntu')
- name: Run tests (WASM)
run: node ./run test --no-native --skip-version-validation
simple_build:
name: Simple Build (WASM size limit check)
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- macOS-latest
fail-fast: false
steps:
- uses: actions/checkout@v1
- name: Install Node
uses: actions/setup-node@v1
with:
node-version: 14.15.0
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2019-11-04
override: true
- name: Install wasm-pack (macOS)
env:
WASMPACKURL: https://github.com/rustwasm/wasm-pack/releases/download/v0.9.1
WASMPACKDIR: wasm-pack-v0.9.1-x86_64-apple-darwin
run: |2-
curl -L "$WASMPACKURL/$WASMPACKDIR.tar.gz" | tar -xz -C .
mv $WASMPACKDIR/wasm-pack ~/.cargo/bin
rm -r $WASMPACKDIR
shell: bash
if: startsWith(matrix.os,'macOS')
- name: Install wasm-pack (Windows)
env:
WASMPACKURL: https://github.com/rustwasm/wasm-pack/releases/download/v0.9.1
WASMPACKDIR: wasm-pack-v0.9.1-x86_64-pc-windows-msvc
run: |2-
curl -L "$WASMPACKURL/$WASMPACKDIR.tar.gz" | tar -xz -C .
mv $WASMPACKDIR/wasm-pack ~/.cargo/bin
rm -r $WASMPACKDIR
shell: bash
if: startsWith(matrix.os,'windows')
- name: Install wasm-pack (Linux)
env:
WASMPACKURL: https://github.com/rustwasm/wasm-pack/releases/download/v0.9.1
WASMPACKDIR: wasm-pack-v0.9.1-x86_64-unknown-linux-musl
run: |2-
curl -L "$WASMPACKURL/$WASMPACKDIR.tar.gz" | tar -xz -C .
mv $WASMPACKDIR/wasm-pack ~/.cargo/bin
rm -r $WASMPACKDIR
shell: bash
if: startsWith(matrix.os,'ubuntu')
- name: Build (macos)
run: node ./run dist --skip-version-validation --target macos
if: startsWith(matrix.os,'macos')
if: >-
!(contains(github.event.head_commit.message,'[ci build]') || github.ref ==
'refs/heads/develop' || github.base_ref == 'unstable' || github.base_ref
== 'stable' || github.ref == 'refs/heads/unstable' || github.ref ==
'refs/heads/stable')
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- windows-latest
- macOS-latest
- ubuntu-latest
fail-fast: false
steps:
- uses: actions/checkout@v1
- name: Read changelog info
id: changelog
run: |2-
node ./run ci-gen --skip-version-validation
content=`cat CURRENT_RELEASE_CHANGELOG.json`
echo "::set-output name=content::$content"
shell: bash
- name: Install Node
uses: actions/setup-node@v1
with:
node-version: 14.15.0
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2019-11-04
override: true
- name: Install wasm-pack (macOS)
env:
WASMPACKURL: https://github.com/rustwasm/wasm-pack/releases/download/v0.9.1
WASMPACKDIR: wasm-pack-v0.9.1-x86_64-apple-darwin
run: |2-
curl -L "$WASMPACKURL/$WASMPACKDIR.tar.gz" | tar -xz -C .
mv $WASMPACKDIR/wasm-pack ~/.cargo/bin
rm -r $WASMPACKDIR
shell: bash
if: startsWith(matrix.os,'macOS')
- name: Install wasm-pack (Windows)
env:
WASMPACKURL: https://github.com/rustwasm/wasm-pack/releases/download/v0.9.1
WASMPACKDIR: wasm-pack-v0.9.1-x86_64-pc-windows-msvc
run: |2-
curl -L "$WASMPACKURL/$WASMPACKDIR.tar.gz" | tar -xz -C .
mv $WASMPACKDIR/wasm-pack ~/.cargo/bin
rm -r $WASMPACKDIR
shell: bash
if: startsWith(matrix.os,'windows')
- name: Install wasm-pack (Linux)
env:
WASMPACKURL: https://github.com/rustwasm/wasm-pack/releases/download/v0.9.1
WASMPACKDIR: wasm-pack-v0.9.1-x86_64-unknown-linux-musl
run: |2-
curl -L "$WASMPACKURL/$WASMPACKDIR.tar.gz" | tar -xz -C .
mv $WASMPACKDIR/wasm-pack ~/.cargo/bin
rm -r $WASMPACKDIR
shell: bash
if: startsWith(matrix.os,'ubuntu')
- name: Build (macos)
run: node ./run dist --skip-version-validation --target macos
if: startsWith(matrix.os,'macos')
- name: Build (win)
run: node ./run dist --skip-version-validation --target win
if: startsWith(matrix.os,'windows')
- name: Build (linux)
run: node ./run dist --skip-version-validation --target linux
if: startsWith(matrix.os,'ubuntu')
- name: Upload Content Artifacts
uses: actions/upload-artifact@v1
with:
name: content
path: dist/content
if: startsWith(matrix.os,'macOS')
- name: Upload Artifacts (macOS, dmg)
uses: actions/upload-artifact@v1
with:
name: enso-mac-${{fromJson(steps.changelog.outputs.content).version}}.dmg
path: >-
dist/client/enso-mac-${{fromJson(steps.changelog.outputs.content).version}}.dmg
if: startsWith(matrix.os,'macos')
- name: Upload Artifacts (macOS, dmg.sha256)
uses: actions/upload-artifact@v1
with:
name: >-
enso-mac-${{fromJson(steps.changelog.outputs.content).version}}.dmg.sha256
path: >-
dist/client/enso-mac-${{fromJson(steps.changelog.outputs.content).version}}.dmg.sha256
if: startsWith(matrix.os,'macos')
- name: Upload Artifacts (Windows, exe)
uses: actions/upload-artifact@v1
with:
name: enso-win-${{fromJson(steps.changelog.outputs.content).version}}.exe
path: >-
dist/client/enso-win-${{fromJson(steps.changelog.outputs.content).version}}.exe
if: startsWith(matrix.os,'windows')
- name: Upload Artifacts (Windows, exe.sha256)
uses: actions/upload-artifact@v1
with:
name: >-
enso-win-${{fromJson(steps.changelog.outputs.content).version}}.exe.sha256
path: >-
dist/client/enso-win-${{fromJson(steps.changelog.outputs.content).version}}.exe.sha256
if: startsWith(matrix.os,'windows')
- name: Upload Artifacts (Linux, AppImage)
uses: actions/upload-artifact@v1
with:
name: >-
enso-linux-${{fromJson(steps.changelog.outputs.content).version}}.AppImage
path: >-
dist/client/enso-linux-${{fromJson(steps.changelog.outputs.content).version}}.AppImage
if: startsWith(matrix.os,'ubuntu')
- name: Upload Artifacts (Linux, AppImage.sha256)
uses: actions/upload-artifact@v1
with:
name: >-
enso-linux-${{fromJson(steps.changelog.outputs.content).version}}.AppImage.sha256
path: >-
dist/client/enso-linux-${{fromJson(steps.changelog.outputs.content).version}}.AppImage.sha256
if: startsWith(matrix.os,'ubuntu')
if: >-
contains(github.event.head_commit.message,'[ci build]') || github.ref ==
'refs/heads/develop' || github.base_ref == 'unstable' || github.base_ref
== 'stable' || github.ref == 'refs/heads/unstable' || github.ref ==
'refs/heads/stable'
release_to_github:
name: GitHub Release
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- macOS-latest
fail-fast: false
steps:
- uses: actions/checkout@v1
- name: Download artifacts
uses: actions/download-artifact@v2
with:
path: artifacts
- name: Read changelog info
id: changelog
run: |2-
node ./run ci-gen --skip-version-validation
content=`cat CURRENT_RELEASE_CHANGELOG.json`
echo "::set-output name=content::$content"
shell: bash
- id: checkCurrentReleaseTag
uses: mukunku/tag-exists-action@v1.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag: v${{fromJson(steps.changelog.outputs.content).version}}
- name: Fail if release already exists
run: >-
if [[ ${{ steps.checkCurrentReleaseTag.outputs.exists }} == true ]];
then exit 1; fi
if: github.base_ref == 'unstable' || github.base_ref == 'stable'
- name: Install Prettier
run: npm install --save-dev --save-exact prettier
- name: Pretty print changelog.
run: npx prettier --prose-wrap never CHANGELOG.md --write
- name: Upload GitHub Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: artifacts/**/enso-*
name: Enso ${{fromJson(steps.changelog.outputs.content).version}}
tag_name: v${{fromJson(steps.changelog.outputs.content).version}}
body: ${{fromJson(steps.changelog.outputs.content).body}}
prerelease: ${{fromJson(steps.changelog.outputs.content).prerelease}}
if: github.ref == 'refs/heads/unstable' || github.ref == 'refs/heads/stable'
needs:
- version_assertions
- lint
- test
- wasm-test
- build
release_to_cdn:
name: CDN Release
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-18.04
fail-fast: false
steps:
- uses: actions/checkout@v1
- name: Download artifacts
uses: actions/download-artifact@v2
with:
path: artifacts
- name: Read changelog info
id: changelog
run: |2-
node ./run ci-gen --skip-version-validation
content=`cat CURRENT_RELEASE_CHANGELOG.json`
echo "::set-output name=content::$content"
shell: bash
- shell: bash
run: |2-
aws configure --profile s3-upload <<-EOF > /dev/null 2>&1
${{ secrets.ARTEFACT_S3_ACCESS_KEY_ID }}
${{ secrets.ARTEFACT_S3_SECRET_ACCESS_KEY }}
us-west-1
text
EOF
- name: Upload 'index.js.gz' to CDN
shell: bash
run: >-
aws s3 cp ./artifacts/content/assets/index.js.gz
s3://ensocdn/ide/${{fromJson(steps.changelog.outputs.content).version}}/index.js.gz
--profile s3-upload --acl public-read --content-encoding gzip
- name: Upload 'style.css' to CDN
shell: bash
run: >-
aws s3 cp ./artifacts/content/assets/style.css
s3://ensocdn/ide/${{fromJson(steps.changelog.outputs.content).version}}/style.css
--profile s3-upload --acl public-read --content-encoding gzip
- name: Upload 'ide.wasm' to CDN
shell: bash
run: >-
aws s3 cp ./artifacts/content/assets/ide.wasm
s3://ensocdn/ide/${{fromJson(steps.changelog.outputs.content).version}}/ide.wasm
--profile s3-upload --acl public-read --content-encoding gzip
- name: Upload 'wasm_imports.js.gz' to CDN
shell: bash
run: >-
aws s3 cp ./artifacts/content/assets/wasm_imports.js.gz
s3://ensocdn/ide/${{fromJson(steps.changelog.outputs.content).version}}/wasm_imports.js.gz
--profile s3-upload --acl public-read --content-encoding gzip
if: github.ref == 'refs/heads/unstable' || github.ref == 'refs/heads/stable'
needs:
- version_assertions
- lint
- test
- wasm-test
- build