Skip to content

Commit

Permalink
ci: init ci
Browse files Browse the repository at this point in the history
  • Loading branch information
meskill committed Sep 25, 2022
1 parent b0df1ef commit c9d99e1
Show file tree
Hide file tree
Showing 13 changed files with 1,784 additions and 802 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
170 changes: 170 additions & 0 deletions .github/workflows/publish-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json

name: Publish test

on:
push:
branches-ignore:
- master
paths:
- native-app/**
- chrome-extension/**
- .releaserc.yml
- '.github/workflows/publish-test.yml'

jobs:
get-version:
runs-on: windows-2022
outputs:
version: ${{ steps.release.outputs.new_release_version }}
steps:
- name: Generate Token
id: generate-token
uses: tibdex/github-app-token@v1
with:
app_id: ${{ secrets.TOKEN_APP_ID }}
private_key: ${{ secrets.TOKEN_APP_PRIVATE_KEY }}
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ steps.generate-token.outputs.token }}
- name: Get branch name
id: branch-name
uses: tj-actions/branch-names@v5
- name: Dry-Run Publish
uses: cycjimmy/semantic-release-action@v3
id: release
env:
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
with:
dry_run: true
branches: '["${{ steps.branch-name.outputs.current_branch }}"]'
extra_plugins: |
@semantic-release/changelog
@semantic-release/git
conventional-changelog-conventionalcommits
build-native-app:
runs-on: windows-2022
needs: get-version
env:
MYSTIC_LIGHT_SDK_PATH: ${{ github.workspace }}/native-app/sdk
defaults:
run:
working-directory: native-app
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
# TODO: only 1.64.0 as there is an warning: the following packages contain code that will be rejected by a future version of Rust: winapi v0.2.8
toolchain: 1.64.0
- name: Set version
run: |
cargo install cargo-edit
cargo set-version ${{ needs.get-version.outputs.version }}
- name: Create artifact for manifest
uses: actions/upload-artifact@v3
with:
name: manifests
path: native-app/Cargo.toml
retention-days: 7
- name: Build
run: cargo build --release --bin install --bin uninstall --bin service
- name: Generate Installer
run: iscc.exe installer/inno-setup.iss
- name: Rename release with version
run: mv dist/mystic-light-browser-cinema.exe dist/mystic-light-browser-cinema-${{ needs.get-version.outputs.version }}.exe
- name: Create artifact from installer
uses: actions/upload-artifact@v3
with:
name: installer
path: native-app/dist/
retention-days: 7

build-chrome-extension:
runs-on: windows-2022
needs: get-version
defaults:
run:
working-directory: chrome-extension
steps:
# checking out master as yarn version requires it
- name: Checkout master
uses: actions/checkout@v3
with:
ref: master
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 10
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16
cache: yarn
cache-dependency-path: chrome-extension/yarn.lock
- name: Install dependencies
run: yarn
- name: Set version
run: yarn version ${{ needs.get-version.outputs.version }}
- name: Create artifact for manifest
uses: actions/upload-artifact@v3
with:
name: manifests
path: chrome-extension/package.json
retention-days: 7
- name: Build extension
run: |
yarn build --zip
mv build/chrome-mv3-prod.zip build/mystic-light-browser-cinema-extension-${{ needs.get-version.outputs.version }}.zip
- name: Create artifact from extension
uses: actions/upload-artifact@v3
with:
name: extension
path: chrome-extension/build/*.zip
retention-days: 7

test-release:
runs-on: windows-2022
needs:
- build-native-app
- build-chrome-extension
steps:
- name: Generate Token
id: generate-token
uses: tibdex/github-app-token@v1
with:
app_id: ${{ secrets.TOKEN_APP_ID }}
private_key: ${{ secrets.TOKEN_APP_PRIVATE_KEY }}
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ steps.generate-token.outputs.token }}
- name: Get installer artifact
uses: actions/download-artifact@v3
with:
name: installer
path: dist
- name: Get extension artifact
uses: actions/download-artifact@v3
with:
name: extension
path: dist
- name: Get manifests artifact
uses: actions/download-artifact@v3
with:
name: manifests
path: manifests
- name: Restore manifests
shell: bash
run: |
mv manifests/Cargo.toml native-app/Cargo.toml
mv manifests/package.json chrome-extension/package.json
- name: Test dist output
run: ls dist
- name: Test cargo manifest
run: cat native-app/Cargo.toml
- name: Test extension package.json
run: cat chrome-extension/package.json
166 changes: 166 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json

name: Publish

on:
workflow_dispatch:
push:
branches:
- master
paths:
- 'native-app/**'
- 'chrome-extension/**'
- '.github/workflows/publish.yml'
- '.github/scripts/prepare.sh'

jobs:
get-version:
runs-on: windows-2022
outputs:
version: ${{ steps.release.outputs.new_release_version }}
steps:
- name: Generate Token
id: generate-token
uses: tibdex/github-app-token@v1
with:
app_id: ${{ secrets.TOKEN_APP_ID }}
private_key: ${{ secrets.TOKEN_APP_PRIVATE_KEY }}
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ steps.generate-token.outputs.token }}
- name: Dry-Run Publish
uses: cycjimmy/semantic-release-action@v3
id: release
env:
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
with:
dry_run: true
extra_plugins: |
@semantic-release/changelog
@semantic-release/git
conventional-changelog-conventionalcommits
build-native-app:
runs-on: windows-2022
needs: get-version
env:
MYSTIC_LIGHT_SDK_PATH: ${{ github.workspace }}/native-app/sdk
defaults:
run:
working-directory: native-app
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
# TODO: only 1.64.0 as there is an warning: the following packages contain code that will be rejected by a future version of Rust: winapi v0.2.8
toolchain: 1.64.0
- name: Set version
run: |
cargo install cargo-edit
cargo set-version ${{ needs.get-version.outputs.version }}
- name: Create artifact for manifest
uses: actions/upload-artifact@v3
with:
name: manifests
path: native-app/Cargo.toml
retention-days: 1
- name: Build
run: cargo build --release --bin install --bin uninstall --bin service
- name: Generate Installer
run: iscc.exe installer/inno-setup.iss
- name: Rename release with version
run: mv dist/mystic-light-browser-cinema.exe dist/mystic-light-browser-cinema-${{ needs.get-version.outputs.version }}.exe
- name: Create artifact from installer
uses: actions/upload-artifact@v3
with:
name: installer
path: native-app/dist/
retention-days: 1

build-chrome-extension:
runs-on: windows-2022
needs: get-version
defaults:
run:
working-directory: chrome-extension
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 10
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16
cache: yarn
cache-dependency-path: chrome-extension/yarn.lock
- name: Install dependencies
run: yarn
- name: Set version
run: yarn version ${{ needs.get-version.outputs.version }}
- name: Create artifact for manifest
uses: actions/upload-artifact@v3
with:
name: manifests
path: chrome-extension/package.json
retention-days: 1
- name: Build extension
run: |
yarn build --zip
mv build/chrome-mv3-prod.zip build/mystic-light-browser-cinema-extension-${{ needs.get-version.outputs.version }}.zip
- name: Create artifact from extension
uses: actions/upload-artifact@v3
with:
name: extension
path: chrome-extension/build/
retention-days: 1

release:
runs-on: windows-2022
needs:
- build-native-app
- build-chrome-extension
steps:
- name: Generate Token
id: generate-token
uses: tibdex/github-app-token@v1
with:
app_id: ${{ secrets.TOKEN_APP_ID }}
private_key: ${{ secrets.TOKEN_APP_PRIVATE_KEY }}
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ steps.generate-token.outputs.token }}
- name: Get installer artifact
uses: actions/download-artifact@v3
with:
name: installer
path: dist
- name: Get extension artifact
uses: actions/download-artifact@v3
with:
name: extension
path: dist
- name: Get manifests artifact
uses: actions/download-artifact@v3
with:
name: manifests
path: manifests
- name: Restore manifests
shell: bash
run: |
mv manifests/Cargo.toml native-app/Cargo.toml
mv manifests/package.json chrome-extension/package.json
- name: Release
uses: cycjimmy/semantic-release-action@v3
id: release
env:
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
with:
extra_plugins: |
@semantic-release/changelog
@semantic-release/git
conventional-changelog-conventionalcommits
53 changes: 53 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json

name: test

on:
pull_request:
branches:
- master

jobs:
native-app:
name: Test native app
runs-on: windows-2022
env:
MYSTIC_LIGHT_SDK_PATH: ${{ github.workspace }}/native-app/sdk
defaults:
run:
working-directory: native-app
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
# TODO: only 1.64.0 as there is an warning: the following packages contain code that will be rejected by a future version of Rust: winapi v0.2.8
toolchain: 1.64.0
components: clippy
- name: check
run: cargo check --locked --all-targets
- name: Lint src
run: cargo clippy --all-targets -- -D warnings

chrome-extension:
name: Test chrome extension
runs-on: windows-2022
defaults:
run:
working-directory: chrome-extension
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16
cache: yarn
cache-dependency-path: chrome-extension/yarn.lock
- name: Install dependencies
run: yarn
- name: Lint src
run: yarn lint
- name: Unit tests
run: yarn test

0 comments on commit c9d99e1

Please sign in to comment.