Skip to content

Commit 8da8f2a

Browse files
authored
Merge pull request #117 from bcmi-labs/gh_actions_needs
Made the upload and release depend on the build job.
2 parents 9518840 + 5a353ff commit 8da8f2a

File tree

2 files changed

+67
-27
lines changed

2 files changed

+67
-27
lines changed

.github/workflows/build.yml

Lines changed: 61 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,17 @@ on:
1212
schedule:
1313
- cron: '0 3 * * *' # run every day at 3AM (https://docs.github.com/en/actions/reference/events-that-trigger-workflows#scheduled-events-schedule)
1414

15-
env:
16-
IS_NIGHTLY: ${{ github.event_name == 'schedule' || github.head_ref == 'gh-actions' }} # TODO: remove OR once PR is merged.
17-
IS_RELEASE: ${{ startsWith(github.ref, 'refs/tags/v') }}
18-
1915
jobs:
16+
2017
build:
2118
strategy:
2219
matrix:
2320
config:
2421
- os: windows-2016
2522
- os: ubuntu-latest
2623
- os: turin-macmini # self-hosted macOS
27-
2824
runs-on: ${{ matrix.config.os }}
29-
25+
timeout-minutes: 30
3026
steps:
3127
- name: Checkout
3228
uses: actions/checkout@v2
@@ -42,48 +38,86 @@ jobs:
4238
with:
4339
python-version: '2.7'
4440

45-
- name: Build
46-
env:
47-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48-
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true
49-
run: yarn
50-
51-
- name: Test
52-
run: yarn test
41+
- name: Update Keychain [macOS]
42+
if: runner.OS == 'macOS'
43+
run: |
44+
echo "${{ secrets.KEYCHAIN }}" | base64 --decode > ~/Library/Keychains/apple-developer.keychain-db
45+
security list-keychains -s ~/Library/Keychains/apple-developer.keychain-db
46+
security unlock-keychain -p "${{ secrets.KEYCHAIN_PASSWORD }}" ~/Library/Keychains/apple-developer.keychain-db
5347
5448
- name: Package
5549
shell: bash
5650
env:
57-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} # https://github.com/Microsoft/vscode/issues/28434#issuecomment-346199674
5951
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true
52+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6053
AC_USERNAME: ${{ secrets.AC_USERNAME }}
6154
AC_PASSWORD: ${{ secrets.AC_PASSWORD }}
6255
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
6356
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
57+
IS_NIGHTLY: ${{ github.event_name == 'schedule' }}
58+
IS_RELEASE: ${{ startsWith(github.ref, 'refs/tags/v') }}
6459
run: |
65-
if [ "$RUNNER_OS" == "macOS" ]; then
66-
echo ">>> Detected macOS runner. Updating keychain for the app signing..."
67-
echo "${{ secrets.KEYCHAIN }}" | base64 --decode > ~/Library/Keychains/apple-developer.keychain-db
68-
security list-keychains -s ~/Library/Keychains/apple-developer.keychain-db
69-
security unlock-keychain -p "${{ secrets.KEYCHAIN_PASSWORD }}" ~/Library/Keychains/apple-developer.keychain-db
70-
echo "<<< The keychain has been successfully updated."
71-
fi
7260
yarn --cwd ./electron/packager/
7361
yarn --cwd ./electron/packager/ package
7462
7563
- name: Upload [GitHub Actions]
7664
uses: actions/upload-artifact@v2
7765
with:
78-
name: ${{ runner.os }}
66+
name: build-artifacts
7967
path: electron/build/dist/build-artifacts/
8068

81-
- name: Upload [S3]
82-
if: env.IS_NIGHTLY == 'true'
69+
publish:
70+
needs: build
71+
if: github.event_name == 'schedule'
72+
runs-on: ubuntu-latest
73+
steps:
74+
- name: Download [GitHub Actions]
75+
uses: actions/download-artifact@v2
76+
with:
77+
name: build-artifacts
78+
path: build-artifacts
79+
80+
- name: Publish Nightly [S3]
8381
uses: kittaakos/upload-s3-action@v0.0.1
8482
with:
8583
aws_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
8684
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
8785
aws_bucket: ${{ secrets.DOWNLOADS_BUCKET }}
88-
source_dir: electron/build/dist/build-artifacts/
86+
source_dir: build-artifacts/
8987
destination_dir: arduino-pro-ide/nightly/
88+
89+
release:
90+
needs: build
91+
if: startsWith(github.ref, 'refs/tags/v')
92+
runs-on: ubuntu-latest
93+
steps:
94+
- name: Download [GitHub Actions]
95+
uses: actions/download-artifact@v2
96+
with:
97+
name: build-artifacts
98+
path: build-artifacts
99+
100+
- name: Create Release [GitHub]
101+
uses: actions/create-release@v1
102+
env:
103+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
104+
with:
105+
tag_name: ${{ github.ref }}
106+
release_name: ${{ github.ref }}
107+
108+
- name: Publish Release [GitHub]
109+
uses: svenstaro/upload-release-action@v1-release
110+
with:
111+
repo_token: ${{ secrets.GITHUB_TOKEN }}
112+
file: build-artifacts/*
113+
tag: ${{ github.ref }}
114+
file_glob: true
115+
116+
- name: Publish Release [S3]
117+
uses: kittaakos/upload-s3-action@v0.0.1
118+
with:
119+
aws_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
120+
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
121+
aws_bucket: ${{ secrets.DOWNLOADS_BUCKET }}
122+
source_dir: build-artifacts/
123+
destination_dir: arduino-pro-ide/

electron/packager/index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,12 @@
102102
// Rebuild the extension with the copied `yarn.lock`. It is a must to use the same Theia versions. |
103103
//-------------------------------------------------------------------------------------------------+
104104
exec(`yarn --network-timeout 1000000 --cwd ${path('..', workingCopy)}`, `Building the ${productName} application`);
105+
106+
//-------------------------------------------------------------------------------------------------------------------------+
107+
// Test the application. With this approach, we cannot publish test results to GH Actions but save 6-10 minutes per builds |
108+
//-------------------------------------------------------------------------------------------------------------------------+
109+
exec(`yarn --network-timeout 1000000 --cwd ${path('..', workingCopy)} test`, `Testing the ${productName} application`);
110+
105111
// Collect all unused dependencies by the backend. We have to remove them from the electron app.
106112
// The `bundle.js` already contains everything we need for the frontend.
107113
// We have to do it before changing the dependencies to `local-path`.

0 commit comments

Comments
 (0)