diff --git a/.github/workflows/deploy.yml b/.github/workflows/test-and-deploy.yml similarity index 58% rename from .github/workflows/deploy.yml rename to .github/workflows/test-and-deploy.yml index 944a3323f..6003e4165 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/test-and-deploy.yml @@ -1,13 +1,45 @@ -name: CE Deploy +name: Compiler Explorer -on: - workflow_run: - workflows: [ "Compiler Explorer" ] - types: [ completed ] +on: [ push, pull_request ] jobs: - build-node: - if: ${{ github.event.workflow_run.conclusion == 'success' }} + build-and-test: + runs-on: ubuntu-20.04 + + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Use Node.js 12.x + uses: actions/setup-node@v1 + with: + node-version: 12.x + - name: TEST + run: | + which npx + npx --version + - name: Get npm cache directory + id: npm-cache + run: | + echo "::set-output name=dir::$(npm config get cache)" + - uses: actions/cache@v1 + with: + path: ${{ steps.npm-cache.outputs.dir }} + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + - name: Install prerequisites + run: make prereqs + - name: Build and test + run: | + npm run lint + npm run ci-test + - name: Code coverage + run: npm run codecov + + build-dist-and-deploy: + needs: build-and-test + if: ${{ secrets.AWS_SECRET_ACCESS_KEY }} runs-on: ubuntu-20.04 steps: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 50d46944e..000000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Compiler Explorer - -on: [ push, pull_request ] - -jobs: - build-node: - runs-on: ubuntu-20.04 - - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Use Node.js 12.x - uses: actions/setup-node@v1 - with: - node-version: 12.x - - name: TEST - run: | - which npx - npx --version - - name: Get npm cache directory - id: npm-cache - run: | - echo "::set-output name=dir::$(npm config get cache)" - - uses: actions/cache@v1 - with: - path: ${{ steps.npm-cache.outputs.dir }} - key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-node- - - name: Install prerequisites - run: make prereqs - - name: Build and test - run: | - npm run lint - npm run ci-test - - name: Code coverage - run: npm run codecov diff --git a/Makefile b/Makefile index a47ec30ca..b42517564 100644 --- a/Makefile +++ b/Makefile @@ -40,9 +40,7 @@ $(NODE_MODULES): package.json | node-installed @touch $@ WEBPACK:=./node_modules/webpack-cli/bin/cli.js -webpack: $(NODE_MODULES) ## Runs webpack (useful only for debugging webpack) - rm -rf out/dist/static out/dist/manifest.json - $(WEBPACK) $(WEBPACK_ARGS) +$(WEBPACK): $(NODE_MODULES) lint: $(NODE_MODULES) ## Checks if the source currently matches code conventions $(NPM) run lint @@ -54,7 +52,9 @@ ci-lint: $(NODE_MODULES) $(NPM) run ci-lint node_modules: $(NODE_MODULES) -webpack: $(WEBPACK) +webpack: $(WEBPACK) ## Runs webpack (useful only for debugging webpack) + rm -rf out/dist/static out/dist/manifest.json + $(WEBPACK) $(WEBPACK_ARGS) test: $(NODE_MODULES) ## Runs the tests $(NPM) run test