From e57e4e65b7437270b32674659a91c2e4333a46ec Mon Sep 17 00:00:00 2001 From: Luca Soldaini Date: Sat, 29 Jul 2023 14:02:33 -0700 Subject: [PATCH] improve CI --- .github/workflows/CI.yml | 23 +++++++++++++++++++++++ python/dolma/core/parallel.py | 3 ++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 7b7764a0..b5659ecb 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -8,6 +8,9 @@ on: tags: - '*' pull_request: + branches: + - main + - master workflow_dispatch: @@ -16,6 +19,20 @@ permissions: jobs: + info: + runs-on: ubuntu-latest + steps: + - name: Echo environment variables + run: | + echo "reference: ${{ github.ref }}" + echo "event name: ${{ github.event_name }}" + echo "run tests: ${{ github.event_name == 'pull_request' || github.event_name == 'push' }}" + echo "is main: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' }}" + echo "is release: ${{ startsWith(github.ref, 'refs/tags/') }}" + echo "commit: ${{ github.sha }}" + echo "-------------------------------------------------------------------------" + echo "PR: ${{ toJson(github.event.pull_request) }}" + tests: runs-on: ubuntu-latest env: @@ -93,7 +110,10 @@ jobs: source .venv/bin/activate pip uninstall -y dolma + + build-linux: + if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') }} runs-on: ubuntu-latest env: CC: gcc-11 @@ -128,6 +148,7 @@ jobs: path: dist build-windows: + if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') }} runs-on: windows-latest strategy: matrix: @@ -151,6 +172,7 @@ jobs: path: dist build-macos: + if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') }} runs-on: macos-latest strategy: matrix: @@ -174,6 +196,7 @@ jobs: sdist: runs-on: ubuntu-latest + if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') }} steps: - uses: actions/checkout@v3 - name: Build sdist diff --git a/python/dolma/core/parallel.py b/python/dolma/core/parallel.py index e70007dc..31d16488 100644 --- a/python/dolma/core/parallel.py +++ b/python/dolma/core/parallel.py @@ -30,7 +30,8 @@ METADATA_SUFFIX = ".done.txt" -QueueType: TypeAlias = Queue[Union[None, Tuple[int, ...]]] +# we need to quote the type alias because we want to support Python 3.8 +QueueType: TypeAlias = "Queue[Union[None, Tuple[int, ...]]]" class BaseParallelProcessor: