Fix issues brought up in QA of PR #1206 #5193
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: Run pre-commit | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: false | |
- name: Setup Python 3.8 | |
id: setup-python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.8" | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: "20" | |
- name: Get node version | |
id: node-version | |
run: echo "::set-output name=node-version::$(node --version)" | |
- uses: snok/install-poetry@v1 | |
with: | |
virtualenvs-in-project: true | |
- name: Cache poetry venv | |
id: cache-poetry | |
uses: actions/cache@v2 | |
with: | |
path: .venv | |
key: "poetry-${{ runner.os }}-\ | |
${{ steps.setup-python.outputs.python-version }}-\ | |
${{ hashFiles('poetry.lock') }}" | |
restore-keys: | | |
poetry-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}- | |
- name: Install poetry dependencies | |
run: poetry install | |
- name: Cache pre-commit cache | |
uses: actions/cache@v2 | |
with: | |
path: ~/.cache/pre-commit | |
key: "pre-commit-${{ runner.os }}-\ | |
${{ steps.setup-python.outputs.python-version }}-\ | |
${{ steps.node-version.outputs.node-version }}-\ | |
${{ hashFiles('.pre-commit-config.yaml') }}" | |
- name: Run pre-commit | |
run: poetry run 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_SITE_URL: ${{ vars.NEXT_PUBLIC_SITE_URL }} | |
NEXT_PUBLIC_API_URL: ${{ vars.NEXT_PUBLIC_API_URL }} | |
PUBLIC_SITE_URL: ${{ vars.NEXT_PUBLIC_SITE_URL }} | |
PUBLIC_API_URL: ${{ vars.NEXT_PUBLIC_API_URL }} | |
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-remix | |
run: yarn workspace @thunderstore/cyberstorm-remix build | |
chromatic-deployment: | |
runs-on: ubuntu-latest | |
needs: ["test", "pre-commit", "get-node-version"] | |
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 |