diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..3b8bd1b --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,45 @@ +name: Test + +on: pull_request + +jobs: + lint: + name: Linting and formatting + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v3 + name: Install Python + with: + python-version: "3.x" + + - name: Install tox + run: python -m pip install tox + + - name: Run test suite + run: python -m tox -e flake8,black,yamllint + + test_tox: + name: Run full tests + needs: lint + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v3 + name: Install Python + with: + python-version: "3.x" + - name: Install Node + uses: actions/setup-node@v3 + with: + node-version: "lts" + + - name: Install node modules + run: npm ci + + - name: Install tox + run: python -m pip install tox + + - name: Run test suite + run: python -m tox -e py3 diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 1a9d4bd..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,39 +0,0 @@ -image: python:latest - -variables: - HTTP_PROXY: $CODE_PROXY - HTTPS_PROXY: $CODE_PROXY - NO_PROXY: $CODE_NO_PROXY - -stages: # List of stages for jobs, and their order of execution - - build - - test - - deploy - -build-job: # This job runs in the build stage, which runs first. - stage: build - script: - - echo "Compiling the code..." - - pip install . - - echo "Compile complete." - -unit-test-job: # This job runs in the test stage. - stage: test # It only starts when the job in the build stage completes successfully. - script: - - echo "Running unit tests... This will take about 60 seconds." - - sleep 60 - - echo "Code coverage is 90%" - -lint-test-job: # This job also runs in the test stage. - stage: test # It can run at the same time as unit-test-job (in parallel). - script: - - echo "Linting code... This will take about 10 seconds." - - sleep 10 - - echo "No lint issues found." - -deploy-job: # This job runs in the deploy stage. - stage: deploy # It only runs when *both* jobs in the test stage complete successfully. - environment: production - script: - - echo "Deploying application..." - - echo "Application successfully deployed."