mirror of
https://github.com/discordeno/discordeno.git
synced 2026-09-17 00:37:22 +00:00
* ci: Simplify GitHub Actions workflows * Restore codecov flags using script * use gpgv instead of gpg --verify * Remove verbose * remove test script
243 lines
7.8 KiB
YAML
243 lines
7.8 KiB
YAML
name: Library Checks
|
|
permissions:
|
|
contents: read
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches:
|
|
- main
|
|
merge_group:
|
|
|
|
jobs:
|
|
build-type-and-test:
|
|
name: Build Type and Test
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
- uses: actions/setup-node@v7
|
|
with:
|
|
node-version: 22
|
|
cache: yarn
|
|
- run: yarn install --immutable
|
|
- name: Cache for Turbo
|
|
uses: rharkor/caching-for-turbo@v2.5.0
|
|
with:
|
|
cache-prefix: turbo-cache-
|
|
- name: Build Types
|
|
run: yarn build:type
|
|
|
|
build-dist:
|
|
name: Build Dist
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
- uses: actions/setup-node@v7
|
|
with:
|
|
node-version: 22
|
|
cache: yarn
|
|
- run: yarn install --immutable
|
|
- name: Cache for Turbo
|
|
uses: rharkor/caching-for-turbo@v2.5.0
|
|
with:
|
|
cache-prefix: turbo-cache-
|
|
- name: Build Dist
|
|
run: yarn build
|
|
|
|
format:
|
|
name: Format
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
- uses: actions/setup-node@v7
|
|
with:
|
|
node-version: 22
|
|
cache: yarn
|
|
- run: yarn install --immutable
|
|
- name: Cache for Turbo
|
|
uses: rharkor/caching-for-turbo@v2.5.0
|
|
with:
|
|
cache-prefix: turbo-cache-
|
|
- name: Build Types
|
|
run: yarn build:type
|
|
- name: Check Formatting
|
|
run: yarn biome ci --reporter=github
|
|
|
|
test-type-unit-and-integration-test:
|
|
name: Typecheck Tests
|
|
runs-on: ubuntu-latest
|
|
needs: build-type-and-test
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
- uses: actions/setup-node@v7
|
|
with:
|
|
node-version: 22
|
|
cache: yarn
|
|
- run: yarn install --immutable
|
|
- name: Cache for Turbo
|
|
uses: rharkor/caching-for-turbo@v2.5.0
|
|
with:
|
|
cache-prefix: turbo-cache-
|
|
- name: Test Type Test
|
|
run: yarn test:test-type
|
|
|
|
unit-tests:
|
|
name: Unit Tests
|
|
needs: [build-dist]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
- uses: actions/setup-node@v7
|
|
with:
|
|
node-version: 22
|
|
cache: yarn
|
|
- run: yarn install --immutable
|
|
- name: Cache for Turbo
|
|
uses: rharkor/caching-for-turbo@v2.5.0
|
|
with:
|
|
cache-prefix: turbo-cache-
|
|
- run: yarn test:unit
|
|
- name: Download and verify codecov cli
|
|
run: |
|
|
curl https://keybase.io/codecovsecops/pgp_keys.asc | gpg --no-default-keyring --keyring trustedkeys.gpg --import
|
|
|
|
curl -Os https://cli.codecov.io/latest/linux/codecov
|
|
curl -Os https://cli.codecov.io/latest/linux/codecov.SHA256SUM
|
|
curl -Os https://cli.codecov.io/latest/linux/codecov.SHA256SUM.sig
|
|
gpgv codecov.SHA256SUM.sig codecov.SHA256SUM
|
|
|
|
shasum -a 256 -c codecov.SHA256SUM
|
|
sudo chmod +x codecov
|
|
- name: Upload coverage report to codecov
|
|
run: |
|
|
find packages/ -name "lcov.info" -type f | awk -F'/' '{ print $2 }' | while read -r package; do
|
|
sed -i "s|SF:src|SF:packages/${package}/src|g" "packages/$package/coverage/lcov.info"
|
|
|
|
echo "Uploading $package converage/lcov.info file"
|
|
./codecov upload-process --disable-search --token ${{ secrets.CODECOV_TOKEN }} \
|
|
--fail-on-error --git-service github --sha $(git rev-parse HEAD) \
|
|
--file packages/$package/coverage/lcov.info --flag $package-unit --flag $package
|
|
done
|
|
|
|
unit-tests-deno:
|
|
name: Deno Unit Tests
|
|
needs: [build-dist, unit-tests]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
- uses: actions/setup-node@v7
|
|
with:
|
|
node-version: 22
|
|
cache: yarn
|
|
- uses: denoland/setup-deno@v2
|
|
with:
|
|
deno-version: 'v2.9.x'
|
|
- run: yarn install --immutable
|
|
- name: Cache for Turbo
|
|
uses: rharkor/caching-for-turbo@v2.5.0
|
|
with:
|
|
cache-prefix: turbo-cache-
|
|
- run: yarn test:deno-unit
|
|
|
|
unit-tests-bun:
|
|
name: Bun Unit Tests
|
|
needs: [build-dist, unit-tests]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
- uses: actions/setup-node@v7
|
|
with:
|
|
node-version: 22
|
|
cache: yarn
|
|
- uses: oven-sh/setup-bun@v2
|
|
with:
|
|
bun-version: '1.3.14'
|
|
- run: yarn install --immutable
|
|
- name: Cache for Turbo
|
|
uses: rharkor/caching-for-turbo@v2.5.0
|
|
with:
|
|
cache-prefix: turbo-cache-
|
|
- run: yarn test:bun-unit
|
|
|
|
integration-tests:
|
|
name: Integration Tests
|
|
needs: [build-dist]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
- uses: actions/setup-node@v7
|
|
with:
|
|
node-version: 22
|
|
cache: yarn
|
|
- run: yarn install --immutable
|
|
- name: Cache for Turbo
|
|
uses: rharkor/caching-for-turbo@v2.5.0
|
|
with:
|
|
cache-prefix: turbo-cache-
|
|
- run: yarn test:integration
|
|
- name: Download and verify codecov cli
|
|
run: |
|
|
curl https://keybase.io/codecovsecops/pgp_keys.asc | gpg --no-default-keyring --keyring trustedkeys.gpg --import
|
|
|
|
curl -Os https://cli.codecov.io/latest/linux/codecov
|
|
curl -Os https://cli.codecov.io/latest/linux/codecov.SHA256SUM
|
|
curl -Os https://cli.codecov.io/latest/linux/codecov.SHA256SUM.sig
|
|
gpgv codecov.SHA256SUM.sig codecov.SHA256SUM
|
|
|
|
shasum -a 256 -c codecov.SHA256SUM
|
|
sudo chmod +x codecov
|
|
- name: Upload coverage report to codecov
|
|
run: |
|
|
find packages/ -name "lcov.info" -type f | awk -F'/' '{ print $2 }' | while read -r package; do
|
|
sed -i "s|SF:src|SF:packages/${package}/src|g" "packages/$package/coverage/lcov.info"
|
|
|
|
echo "Uploading $package converage/lcov.info file"
|
|
./codecov upload-process --disable-search --token ${{ secrets.CODECOV_TOKEN }} \
|
|
--fail-on-error --git-service github --sha $(git rev-parse HEAD) \
|
|
--file packages/$package/coverage/lcov.info --flag $package-integration --flag $package
|
|
done
|
|
|
|
e2e-tests:
|
|
name: E2E Tests
|
|
needs: [build-dist]
|
|
runs-on: ubuntu-latest
|
|
if: github.event_name != 'pull_request'
|
|
concurrency:
|
|
group: e2e-tests
|
|
queue: max
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
- uses: actions/setup-node@v7
|
|
with:
|
|
node-version: 22
|
|
cache: yarn
|
|
- run: yarn install --immutable
|
|
- name: Cache for Turbo
|
|
uses: rharkor/caching-for-turbo@v2.5.0
|
|
with:
|
|
cache-prefix: turbo-cache-
|
|
- run: yarn test:e2e
|
|
env:
|
|
DISCORD_TOKEN: ${{ secrets.DISCORD_TOKEN }}
|
|
E2E_TEST_GUILD_ID: ${{ secrets.UNIT_TEST_GUILD_ID }}
|
|
- name: Download and verify codecov cli
|
|
run: |
|
|
curl https://keybase.io/codecovsecops/pgp_keys.asc | gpg --no-default-keyring --keyring trustedkeys.gpg --import
|
|
|
|
curl -Os https://cli.codecov.io/latest/linux/codecov
|
|
curl -Os https://cli.codecov.io/latest/linux/codecov.SHA256SUM
|
|
curl -Os https://cli.codecov.io/latest/linux/codecov.SHA256SUM.sig
|
|
gpgv codecov.SHA256SUM.sig codecov.SHA256SUM
|
|
|
|
shasum -a 256 -c codecov.SHA256SUM
|
|
sudo chmod +x codecov
|
|
- name: Upload coverage report to codecov
|
|
run: |
|
|
find packages/ -name "lcov.info" -type f | awk -F'/' '{ print $2 }' | while read -r package; do
|
|
sed -i "s|SF:src|SF:packages/${package}/src|g" "packages/$package/coverage/lcov.info"
|
|
|
|
echo "Uploading $package converage/lcov.info file"
|
|
./codecov upload-process --disable-search --token ${{ secrets.CODECOV_TOKEN }} \
|
|
--fail-on-error --git-service github --sha $(git rev-parse HEAD) \
|
|
--file packages/$package/coverage/lcov.info --flag $package-e2e --flag $package
|
|
done
|