|
| 1 | +name: tests |
| 2 | +on: |
| 3 | + pull_request: |
| 4 | +permissions: |
| 5 | + contents: read |
| 6 | +jobs: |
| 7 | + setup_environment: |
| 8 | + name: Set up go, NVM, and Node.js |
| 9 | + runs-on: ubuntu-latest |
| 10 | + steps: |
| 11 | + - uses: actions/setup-go@v3 |
| 12 | + with: |
| 13 | + go-version: "1.18.10" |
| 14 | + - uses: actions/setup-node@v3 |
| 15 | + with: |
| 16 | + node-version: "12" |
| 17 | + - run: | |
| 18 | + echo "PATH=$PATH:$HOME/go/bin" >> $GITHUB_ENV |
| 19 | + echo "SOURCE_MAP_SUPPORT=true" >> $GITHUB_ENV |
| 20 | + # Make nodejs able to require installed modules from any working path. |
| 21 | + echo "NODE_PATH=$(npm root)" >> $GITHUB_ENV |
| 22 | + echo ::notice::$(go version) |
| 23 | + echo ::notice::$(node -v) |
| 24 | + echo ::notice::$(npm -v) |
| 25 | +
|
| 26 | + install_deps: |
| 27 | + name: Install Go and Node dependency packages |
| 28 | + runs-on: ubuntu-latest |
| 29 | + steps: |
| 30 | + - name: Install required Node.js packages |
| 31 | + run: | |
| 32 | + # Extra flags to avoid installing node-syscall. |
| 33 | + npm install --no-optional --no-package-lock |
| 34 | +
|
| 35 | + checkout: |
| 36 | + name: Check out the GopherJS repo |
| 37 | + runs-on: ubuntu-latest |
| 38 | + steps: |
| 39 | + - uses: actions/checkout@v3 |
| 40 | + |
| 41 | + install_gopherjs: |
| 42 | + name: Install GopherJS |
| 43 | + runs-on: ubuntu-latest |
| 44 | + steps: |
| 45 | + - name: Install GopherJS |
| 46 | + run: | |
| 47 | + go install -v && gopherjs version |
| 48 | +
|
| 49 | + setup_and_install_gopherjs: |
| 50 | + name: A shorthand for setting up GopherJS environment and building the binary |
| 51 | + runs-on: ubuntu-latest |
| 52 | + needs: [setup_environment, checkout, install_deps, install_gopherjs] |
| 53 | + |
| 54 | + tests: |
| 55 | + name: tests |
| 56 | + runs-on: ubuntu-latest |
| 57 | + needs: [setup_and_install_gopherjs] |
| 58 | + steps: |
| 59 | + - uses: actions/checkout@v3 |
| 60 | + |
| 61 | + - name: Smoke tests |
| 62 | + run: | |
| 63 | + gopherjs build -v net/http # Should build successfully. |
| 64 | + gopherjs test -v fmt log # Should catch problems with test execution and source maps. |
0 commit comments