From f937ff74916a8a32e663baedb7df9fec475d26ca Mon Sep 17 00:00:00 2001 From: Jacob Bieker Date: Tue, 12 Oct 2021 15:49:37 +0100 Subject: [PATCH 1/3] Setup cross-repo testing --- .github/workflows/test-dataloader.yaml | 38 ++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/test-dataloader.yaml diff --git a/.github/workflows/test-dataloader.yaml b/.github/workflows/test-dataloader.yaml new file mode 100644 index 00000000..05809946 --- /dev/null +++ b/.github/workflows/test-dataloader.yaml @@ -0,0 +1,38 @@ +# This workflow will install Python dependencies, run tests and lint with a single version of Python +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions + +name: Test Nowcasting_dataloader + +on: [push] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.9 + uses: actions/setup-python@v2 + with: + python-version: 3.9 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install flake8 pytest + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + pip install git+https://github.com/SheffieldSolar/PV_Live-API + pip install -e .[torch] + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Test with pytest + run: | + pytest -s --cov=nowcasting_dataset + - name: Test with nowcasting_dataloader + run: | + curl -XPOST -u "${{ secrets.PAT_USERNAME}}:${{secrets.PAT_TOKEN}}" -H "Accept: + application/vnd.github.everest-preview+json" -H "Content-Type: + application/json" https://api.github.com/repos/openclimatefix/nowcasting_dataloader/dispatches --data '{"event_type": "build_application" }' From 9b6fe0455a9674426ff1adf9e8496a1ca7cf7b05 Mon Sep 17 00:00:00 2001 From: Jacob Bieker Date: Tue, 12 Oct 2021 16:17:45 +0100 Subject: [PATCH 2/3] Update with a different way of doing dispatches --- .github/workflows/test-dataloader.yaml | 31 +++++--------------------- 1 file changed, 6 insertions(+), 25 deletions(-) diff --git a/.github/workflows/test-dataloader.yaml b/.github/workflows/test-dataloader.yaml index 05809946..a108978a 100644 --- a/.github/workflows/test-dataloader.yaml +++ b/.github/workflows/test-dataloader.yaml @@ -10,29 +10,10 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Set up Python 3.9 - uses: actions/setup-python@v2 + - name: Repository Dispatch + uses: peter-evans/repository-dispatch@v1 with: - python-version: 3.9 - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install flake8 pytest - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - pip install git+https://github.com/SheffieldSolar/PV_Live-API - pip install -e .[torch] - - name: Lint with flake8 - run: | - # stop the build if there are Python syntax errors or undefined names - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - name: Test with pytest - run: | - pytest -s --cov=nowcasting_dataset - - name: Test with nowcasting_dataloader - run: | - curl -XPOST -u "${{ secrets.PAT_USERNAME}}:${{secrets.PAT_TOKEN}}" -H "Accept: - application/vnd.github.everest-preview+json" -H "Content-Type: - application/json" https://api.github.com/repos/openclimatefix/nowcasting_dataloader/dispatches --data '{"event_type": "build_application" }' + token: ${{ secrets.REPO_ACCESS_TOKEN }} + repository: openclimatefix/nowcasting_dataloader + event-type: my-event + client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}' From a2d907e4f5e72edca14ed9cabf1c59099fd472e6 Mon Sep 17 00:00:00 2001 From: Jacob Bieker Date: Tue, 12 Oct 2021 16:38:33 +0100 Subject: [PATCH 3/3] Update string --- .github/workflows/test-dataloader.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/test-dataloader.yaml b/.github/workflows/test-dataloader.yaml index a108978a..27297e3a 100644 --- a/.github/workflows/test-dataloader.yaml +++ b/.github/workflows/test-dataloader.yaml @@ -1,5 +1,4 @@ -# This workflow will install Python dependencies, run tests and lint with a single version of Python -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions +# This workflow will trigger the repository_dispath in nowcasting_dataloader and run pytest over there on every push name: Test Nowcasting_dataloader