flyingit / github-actions-for-ci

https://lab.github.com/githubtraining/github-actions:-continuous-integration
MIT License
0 stars 0 forks source link

Updated OS #13

Open flyingit opened 2 years ago

flyingit commented 2 years ago

Changes have been done to the matrix to os

github-learning-lab[bot] commented 2 years ago

New Job

Great, if you look at the logs now, you'll notice that multiple builds will exist: 4 build to be exact! That's because for each of the 2 operating systems we're running tests against 2 versions so: 2 OS :heavy_multiplication_x: 2 Node.js versions = 4 builds.

Our custom workflow now accounts for:

Step 9: Use multiple jobs

icon of gears indicating relationship between multiple jobs

Let's now try to create a dedicated test job and satisfy the second item in our custom workflow checklist.

This will allow us to separate the build and test functions of our workflow into more than one job that will run when our workflow is triggered.

Activity: Edit your workflow file to separate build and test jobs

  1. Edit your workflow file
  2. Create a new job called "test" as follows (we'll use ellipses ... to only show the parts of the workflow we're interested in, but you should not copy the ellipses directly):

    name: Node CI
    
    on: [push]
    
    jobs:
      build:
        ...
      test:
        ...
  3. In the build job, include the following portions of your existing workflow:
    build:
      runs-on: ubuntu-latest
      steps:
        - uses: actions/checkout@v2
        - name: npm install and build webpack
          run: |
            npm install
            npm run build
  4. In the newly created test job, include the following portions of your existing workflow:
    test:
      runs-on: ubuntu-latest
      strategy:
        matrix:
          os: [ubuntu-latest, windows-2016]
          node-version: [12.x, 14.x]
      steps:
      - uses: actions/checkout@v2
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v1
        with:
          node-version: ${{ matrix.node-version }}
      - name: npm install, and test
        run: |
          npm install
          npm test
        env:
          CI: true
If you'd like to copy and paste the full workflow file instead, click here to see it in its entirety. ```yaml name: Node CI on: [push] jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: npm install and build webpack run: | npm install npm run build test: runs-on: ubuntu-latest strategy: matrix: os: [ubuntu-latest, windows-2016] node-version: [12.x, 14.x] steps: - uses: actions/checkout@v2 - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v1 with: node-version: ${{ matrix.node-version }} - name: npm install, and test run: | npm install npm test env: CI: true ```

When you commit to this branch, the workflow should run again. I'll respond when it is finished running.


Actions workflow not running? Click here When a GitHub Actions workflow is running, you should see some checks in progress, like the screenshot below. ![checks in progress in a merge box](https://user-images.githubusercontent.com/16547949/66080348-ecc5f580-e533-11e9-909e-c213b08790eb.png) If the checks don't appear or if the checks are stuck in progress, there's a few things you can do to try and trigger them: - Refresh the page, it's possible the workflow ran and the page just hasn't been updated with that change - Try making a commit on this branch. Our workflow is triggered with a `push` event, and committing to this branch will result in a new `push` - Edit the workflow file on GitHub and ensure there are no red lines indicating a syntax problem
github-learning-lab[bot] commented 2 years ago

Waiting on tests

Great! We've now got two nicely separated build and test jobs. Our custom workflow now accounts for:

If you'd like to learn more about jobs, see:

Step 10: Run multiple jobs

:keyboard: Activity: Wait for the result of multiple jobs in your workflow

No action required in this step - just waiting. I'll respond when the workflow runs your jobs.


Actions workflow not running? Click here When a GitHub Actions workflow is running, you should see some checks in progress, like the screenshot below. ![checks in progress in a merge box](https://user-images.githubusercontent.com/16547949/66080348-ecc5f580-e533-11e9-909e-c213b08790eb.png) If the checks don't appear or if the checks are stuck in progress, there's a few things you can do to try and trigger them: - Refresh the page, it's possible the workflow ran and the page just hasn't been updated with that change - Try making a commit on this branch. Our workflow is triggered with a `push` event, and committing to this branch will result in a new `push` - Edit the workflow file on GitHub and ensure there are no red lines indicating a syntax problem