Skip to content

Merge pull request #1055 from thunderstore-io/02-29-Improve_Communiti… #4189

Merge pull request #1055 from thunderstore-io/02-29-Improve_Communiti…

Merge pull request #1055 from thunderstore-io/02-29-Improve_Communiti… #4189

Workflow file for this run

name: Test
on:
push:
branches:
- "**"
pull_request:
branches:
- "**"
jobs:
get-node-version:
name: Get Node version
if: github.event_name != 'pull_request' || (github.event_name == 'pull_request' && github.event.base.repo.id != github.event.head.repo.id)
runs-on: ubuntu-latest
outputs:
node-version: ${{ steps.get-node-version.outputs.node-version }}
steps:
- uses: actions/checkout@v2
- name: Check get-node-version version
uses: ./.github/actions/get-node-version
with:
package-json: .github/actions/get-node-version/package.json
- name: Get Node version
id: get-node-version
uses: ./.github/actions/get-node-version
pre-commit:
name: Code style check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.8'
- name: Install pre-commit
run: curl https://pre-commit.com/install-local.py | python -
- name: Run pre-commit
run: ~/bin/pre-commit run --show-diff-on-failure --color=always --all-files
# TODO: Configure build secrets & re-enable
# build:
# name: Build
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - name: Build Docker images
# run: IMAGE_TAG=${GITHUB_REF##*/} docker compose -f docker-compose.build.yml build --pull
# - name: Login to Docker Hub
# if: github.event_name != 'pull_request'
# env:
# DOCKER_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
# DOCKER_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }}
# run: docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
# - name: Push image to Docker Hub
# if: github.event_name != 'pull_request'
# run: IMAGE_TAG=${GITHUB_REF##*/} docker compose -f docker-compose.build.yml push
test:
name: Test
runs-on: ubuntu-latest
needs: get-node-version
env:
NEXT_PUBLIC_ROOT_DOMAIN: ${{ vars.NEXT_PUBLIC_ROOT_DOMAIN }}
NEXT_PUBLIC_API_DOMAIN: ${{ vars.NEXT_PUBLIC_API_DOMAIN }}
steps:
- uses: actions/checkout@v4
- name: Set up Node ${{ needs.get-node-version.outputs.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ needs.get-node-version.outputs.node-version }}
cache: "yarn"
- name: Set fontawesome token
run: |
npm config set "@fortawesome:registry" https://npm.fontawesome.com/
npm config set "//npm.fontawesome.com/:_authToken" ${{ secrets.NPM_FA_TOKEN }}
- name: Install Yarn dependencies
run: yarn install --frozen-lockfile
- name: Build @thunderstore/cyberstorm
run: yarn workspace @thunderstore/cyberstorm build
- name: Build @thunderstore/dapper
run: yarn workspace @thunderstore/dapper build
- name: Build @thunderstore/dapper-fake
run: yarn workspace @thunderstore/dapper-fake build
- name: Build @thunderstore/thunderstore-api
run: yarn workspace @thunderstore/thunderstore-api build
- name: Test @thunderstore/thunderstore-api
run: yarn workspace @thunderstore/thunderstore-api test
- name: Build @thunderstore/dapper-ts
run: yarn workspace @thunderstore/dapper-ts build
- name: Test @thunderstore/dapper-ts
run: yarn workspace @thunderstore/dapper-ts test
- name: Build @thunderstore/use-promise
run: yarn workspace @thunderstore/use-promise build
- name: Build @thunderstore/cyberstorm-nextjs
run: yarn workspace @thunderstore/cyberstorm-nextjs build
# TODO: Enable but as a separate job once needed
# deploy:
# name: Trigger deploy
# runs-on: ubuntu-latest
# needs: [test]
# if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request'
# strategy:
# matrix:
# app: [sertra]
# steps:
# - name: Call deployment workflow
# run: |
# curl \
# -X POST \
# -u "${{ secrets.DEPLOY_WORKFLOW_DISPATCH_USER }}:${{ secrets.DEPLOY_WORKFLOW_DISPATCH_PAT }}" \
# -H "Accept: application/vnd.github.v3+json" \
# ${{ secrets.DEPLOY_WORKFLOW_DISPATCH_URL }} \
# -d '{"ref": "master", "inputs": {"sourceOrg": "${{ github.repository_owner }}", "sourceRepo": "${{ github.event.repository.name }}", "appName": "${{ matrix.app }}", "environment": "dev"}}'
chromatic-deployment:
runs-on: ubuntu-latest
needs: ["test", "pre-commit"]
strategy:
matrix:
projects: [
{ dir: "apps/cyberstorm-storybook", token: "CHROMATIC_CYBERSTORM_TOKEN" },
]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Node ${{ needs.get-node-version.outputs.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ needs.get-node-version.outputs.node-version }}
cache: "yarn"
- name: Set fontawesome token
run: |
npm config set "@fortawesome:registry" https://npm.fontawesome.com/
npm config set "//npm.fontawesome.com/:_authToken" ${{ secrets.NPM_FA_TOKEN }}
- name: Install Yarn dependencies
run: yarn install --frozen-lockfile
- name: Publish to Chromatic
uses: chromaui/action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
projectToken: ${{ secrets[matrix.projects.token] }}
workingDir: ${{ matrix.projects.dir }}
exitOnceUploaded: true